-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(workflows): DRY and speed up workflows
Motivation ---------- Performance: We will run only *one* detect file changes job for each subfolder. Maintenance: Much less code. Safetey: If anything under `./github/workflows` has changed, run all jobs. It's dangerous to hard-code the workflow name in the file-filters list. How to test ----------- 1. Check the status checks for this PR
- Loading branch information
1 parent
e90affd
commit 71cccdc
Showing
8 changed files
with
133 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
name: "frontend:test:build test code" | ||
|
||
on: [push,pull_request_target] | ||
|
||
jobs: | ||
# only (but most important) job from this workflow required for pull requests | ||
# check results serve as run conditions for all other jobs here | ||
files-changed: | ||
name: Detect File Changes - frontend/ | ||
runs-on: ubuntu-latest | ||
outputs: | ||
frontend: ${{ steps.filter.outputs.frontend }} | ||
frontend-docs: ${{ steps.filter.outputs.frontend-docs }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dorny/paths-filter@v3.0.2 | ||
id: filter | ||
with: | ||
filters: | | ||
frontend: | ||
- '.github/workflows/**/*' | ||
- 'frontend/**/*' | ||
frontend-docs: | ||
- '.github/workflows/**/*' | ||
- 'frontend/**/*.md' | ||
- 'frontend/.vuepress/*' | ||
- 'frontend/package.json' | ||
build: | ||
if: needs.files-changed.outputs.frontend == 'true' | ||
name: Build - Frontend | ||
needs: files-changed | ||
runs-on: ubuntu-latest | ||
env: | ||
WORKING_DIRECTORY: ./frontend | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Frontend | Build | ||
run: npm install && npm run build | ||
working-directory: ${{env.WORKING_DIRECTORY}} | ||
|
||
build-docker-production: | ||
if: needs.files-changed.outputs.frontend == 'true' | ||
name: Build Docker Production - Frontend | ||
needs: files-changed | ||
runs-on: ubuntu-latest | ||
env: | ||
WORKING_DIRECTORY: ./frontend | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Frontend | Build Docker Production | ||
run: docker compose -f docker-compose.yml build | ||
working-directory: ${{env.WORKING_DIRECTORY}} | ||
|
||
build-docker-development: | ||
if: needs.files-changed.outputs.frontend == 'true' | ||
name: Build Docker Development - Frontend | ||
needs: files-changed | ||
runs-on: ubuntu-latest | ||
env: | ||
WORKING_DIRECTORY: ./frontend | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Frontend | Build Docker Development | ||
run: docker compose build | ||
working-directory: ${{env.WORKING_DIRECTORY}} | ||
|
||
build-docs: | ||
if: needs.files-changed.outputs.frontend-docs == 'true' | ||
name: Build Docs - Frontend | ||
needs: files-changed | ||
runs-on: ubuntu-latest | ||
env: | ||
WORKING_DIRECTORY: ./frontend | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Frontend | Build Docs | ||
run: npm install && npm run docs:build | ||
working-directory: ${{env.WORKING_DIRECTORY}} | ||
|
||
storybook: | ||
if: needs.files-changed.outputs.frontend == 'true' | ||
name: Build Storybook - Frontend | ||
needs: files-changed | ||
runs-on: ubuntu-latest | ||
env: | ||
WORKING_DIRECTORY: ./frontend | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Frontend | Build Storybook | ||
run: npm install && npm run storybook:build | ||
working-directory: ${{env.WORKING_DIRECTORY}} | ||
|
||
lint: | ||
if: needs.files-changed.outputs.frontend == 'true' | ||
name: Lint - Frontend | ||
needs: files-changed | ||
runs-on: ubuntu-latest | ||
env: | ||
WORKING_DIRECTORY: ./frontend | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Frontend | Lint | ||
run: npm install && npm run test:lint | ||
working-directory: ${{env.WORKING_DIRECTORY}} | ||
|
||
unit: | ||
if: needs.files-changed.outputs.frontend == 'true' | ||
name: Unit - Frontend | ||
needs: files-changed | ||
runs-on: ubuntu-latest | ||
env: | ||
WORKING_DIRECTORY: ./frontend | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Frontend | Unit | ||
run: npm install && npm run test:unit | ||
working-directory: ${{env.WORKING_DIRECTORY}} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.