Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
bde1f6c
HT-17 Run code coverage on pull requests
jarrodback Feb 3, 2022
7857141
HT-17 Update coverage version
jarrodback Feb 3, 2022
a4091b8
HT-17 seperate jobs
jarrodback Feb 3, 2022
a5841d2
HT-17 Add step definition
jarrodback Feb 3, 2022
c3c1585
HT-17 Add needs
jarrodback Feb 3, 2022
f34ebdf
HT-17 add artifcats to share data between jobs
jarrodback Feb 3, 2022
f7bed83
HT-17 add all to artifact
jarrodback Feb 3, 2022
7aec5d2
HT-17 narrow down files for artifact
jarrodback Feb 3, 2022
76ed98d
HT-17 Use artifact for ui
jarrodback Feb 3, 2022
e2329ad
HT-17 Use artifact for ui #2
jarrodback Feb 3, 2022
9af3264
HT-17 try and remove node_modules from artifact
jarrodback Feb 3, 2022
4f32321
HT-17 try and remove node_modules from artifact #2
jarrodback Feb 3, 2022
84d810f
HT-17 try and remove node_modules from artifact #3
jarrodback Feb 3, 2022
414bf18
HT-17 try and remove node_modules from artifact #4
jarrodback Feb 3, 2022
dc5d030
HT-17 try and remove node_modules from artifact #5
jarrodback Feb 3, 2022
5aa00c2
HT-17 try and remove node_modules from artifact #6
jarrodback Feb 3, 2022
ca02e52
HT-17 fix workflow file
jarrodback Feb 3, 2022
b82a02d
HT-17 add mongo to server test
jarrodback Feb 3, 2022
0fd3cb1
HT-17 install modules before testing
jarrodback Feb 3, 2022
6a384b3
HT-17 Fix spelling mistake
jarrodback Feb 3, 2022
3c860ee
HT-17 readd mongo to server test
jarrodback Feb 3, 2022
66464f3
HT-17 add coverage artifacts
jarrodback Feb 3, 2022
06445e6
HT-17 fix file paths
jarrodback Feb 3, 2022
bfc5b41
HT-17 checkout in deploy
jarrodback Feb 3, 2022
06810a1
HT-17 move checkout before artifact pull
jarrodback Feb 3, 2022
a8f8ade
HT-17 attempt to stop 2 builds from running
jarrodback Feb 3, 2022
0160dd7
HT-17 readd both runs
jarrodback Feb 3, 2022
07172f7
HT-17 move if outside steps
jarrodback Feb 3, 2022
595d348
HT-17 add release workflow
jarrodback Feb 3, 2022
3f877ef
HT-17 fix indents on publish workflow
jarrodback Feb 3, 2022
6441faf
HT-17 fix indents on publish workflow #2
jarrodback Feb 3, 2022
10ac1eb
HT-17 add correct file path for dockerfile
jarrodback Feb 3, 2022
6e3f6b2
HT-17 add correct file path for dockerfile #2
jarrodback Feb 3, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Publish Docker image

on:
release:
types: [published]

jobs:
push_to_registries:
name: Push Docker image
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v2

- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: |
jarrodback/highway-tracker
ghcr.io/${{ github.repository }}

- name: Build and push Docker images
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: ./server/
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
105 changes: 89 additions & 16 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,56 +4,129 @@
name: Build-Test-Deploy Pipeline

on:
push
workflow_dispatch:
pull_request:
push:

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x]
mongodb-version: [4.2]

steps:
- uses: actions/checkout@v2
- name: Start MongoDB v${{ matrix.mongodb-version }}
uses: supercharge/mongodb-github-action@1.2.0
with:
mongodb-version: ${{ matrix.mongodb-version }}

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: server/package-lock.json

- name: Server - run build
run: |
cd server
npm ci
npm run build --if-present

- name: UI - run build
run: |
cd ui
npm ci
npm run build --if-present
- name: Server - run tests

- uses: actions/upload-artifact@master
with:
name: build-ui
path: |
ui
!ui/node_modules

- uses: actions/upload-artifact@master
with:
name: build-server
path: |
server
!server/node_modules

test-ui:
runs-on: ubuntu-latest
needs: [build]

steps:
- uses: actions/download-artifact@master
with:
name: build-ui

- name: UI - run tests
run: |
cd server
npm i
npm test
- name: UI - run tests

test-server:
runs-on: ubuntu-latest
needs: [build]

strategy:
matrix:
mongodb-version: [4.2]

steps:
- name: Start MongoDB v${{ matrix.mongodb-version }}
uses: supercharge/mongodb-github-action@1.2.0
with:
mongodb-version: ${{ matrix.mongodb-version }}

- uses: actions/download-artifact@master
with:
name: build-server

- name: Server - run tests
run: |
cd ui
npm i
npm test

- uses: actions/upload-artifact@master
with:
name: coverage-server
path: |
coverage

coverage:
runs-on: ubuntu-latest
needs: [test-server,test-ui]

if: >-
github.event_name == 'pull_request'
steps:
- uses: actions/download-artifact@master
with:
name: coverage-server

- name: Code Coverage
if: github.event_name == 'pull_request'
uses: romeovs/lcov-reporter-action@v0.2.16
uses: romeovs/lcov-reporter-action@v0.3.1
with:
lcov-file: ./server/coverage/lcov.info
lcov-file: lcov.info
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy

deploy:
runs-on: ubuntu-latest
needs: [test-server,test-ui]

if: >-
github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v2

- uses: actions/download-artifact@master
with:
name: build-ui

- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4.2.3
with:
branch: gh-pages
folder: ./ui/dist/
folder: dist