Skip to content

Commit

Permalink
clean up and use consistent style in github action workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
dpgraham4401 committed Aug 28, 2023
1 parent fe17a02 commit b67bf53
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 20 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/build_image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,35 @@ on:

jobs:
build_image:
name: 'Build Docker Image'
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ inputs.context }}
steps:
- name: Checkout
- name: 'Checkout'
uses: actions/checkout@v3

- name: Docker meta
- name: 'Docker meta'
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository_owner }}/${{ inputs.image_name }}

- name: Set up QEMU
- name: 'Set up QEMU'
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
- name: 'Set up Docker Buildx'
uses: docker/setup-buildx-action@v2

- name: Login to GitHub Image Registry
- name: 'Login to GitHub Image Registry'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
- name: 'Build and push'
uses: docker/build-push-action@v3
with:
context: ${{ inputs.context }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/dependency_review.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ permissions:

jobs:
dependency-review:
name: 'Review Dependencies'
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,30 @@ concurrency:

jobs:
build:
name: 'Build Documentation'
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./docs/haztrak_book
steps:
- name: Checkout
- name: 'Checkout Repo'
uses: actions/checkout@v2

- name: Setup mdBook
- name: 'Setup mdBook'
run: |
mkdir bin
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.25/mdbook-v0.4.25-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin
- name: Build Documentation
- name: 'Build Documentation'
run: bin/mdbook build

- name: upload Docs
- name: 'Upload Docs'
uses: actions/upload-pages-artifact@v1
with:
path: ./docs/haztrak_book/book

deploy_pages:
name: 'Deploy Documentation'
needs: build
environment:
name: github-pages
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release-drafter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ permissions:

jobs:
update_release_draft:
name: 'Update Release Draft'
permissions:
# write permission is required to update the release draft
contents: write
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,23 @@ on:

jobs:
test_server:
name: 'Run Server Tests'
uses: ./.github/workflows/test_server.yaml

test_client:
name: 'Run Client Tests'
uses: ./.github/workflows/test_client.yaml

build_server:
name: 'Build Server Image'
needs: [test_server]
uses: ./.github/workflows/build_image.yaml
with:
context: ./server
image_name: haztrak-server

build_client:
name: 'Build Client Image'
needs: [test_client]
uses: ./.github/workflows/build_image.yaml
with:
Expand Down
38 changes: 33 additions & 5 deletions .github/workflows/test_client.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,29 @@ on:

jobs:
run_client_tests:
name: 'Run Client Tests'
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./client
strategy:
matrix:
node-version: [16, 18]
node-version: [18, 20]
steps:
- uses: actions/checkout@v3
- name: 'Checkout'
uses: actions/checkout@v3

- name: Setup Node
- name: 'Setup Node'
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: '**/package-lock.json'

- name: Install Dependencies
- name: 'Install Dependencies'
run: npm ci

- name: configure env
- name: 'Configure env'
run: |
mv ../configs/.env.test .env
echo "VITE_HT_ENV=TEST" >> .env
Expand All @@ -41,3 +43,29 @@ jobs:
run: npm test
env:
VITE_HT_ENV: 'TEST'

test_client_build:
name: 'Test Build Client'
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./client
strategy:
matrix:
node-version: [18, 20]
steps:
- name: 'Checkout'
uses: actions/checkout@v3

- name: 'Setup Node'
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: '**/package-lock.json'

- name: 'Install Dependencies'
run: npm ci

- name: 'Build Client'
run: npm run build
8 changes: 5 additions & 3 deletions .github/workflows/test_server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ defaults:

jobs:
run_server_tests:
name: 'Run Server Tests'
runs-on: ubuntu-latest

strategy:
Expand All @@ -44,20 +45,21 @@ jobs:
--health-retries 5
steps:
- uses: actions/checkout@v3
- name: 'Checkout'
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
cache: 'pip'
python-version: ${{ matrix.python-version }}

- name: Install Dependencies
- name: 'Install Dependencies'
run: |
python -m pip install --upgrade pip
pip install -r requirements_dev.txt
- name: Run Tests
- name: 'Run Tests'
env:
HT_SECRET_KEY: 'django-insecure-%btjqoun@6ps$e@8bw$48s+!x1e4aiz&5p2nrf6cmiw4)jsx5d'
HT_CORS_DOMAIN: http://localhost:3000
Expand Down
4 changes: 2 additions & 2 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b67bf53

Please sign in to comment.