-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Succeed action when irrelevant tests are not run.
Instead of not running an action at all when relevant files are unchanged, run the action but skip the actual tests. This allows required checks to succees.
- Loading branch information
1 parent
634b1b6
commit 94c48c9
Showing
2 changed files
with
44 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,15 +13,31 @@ on: | |
- 'hotfix/**' | ||
- 'release/**' | ||
- 'dependabot/**' | ||
paths-ignore: | ||
- 'frontend/**' | ||
- '**.md' | ||
|
||
jobs: | ||
backend-test: | ||
name: Test Backend | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Run backend tests | ||
run: sudo mkdir -p /ci-data && sudo docker-compose --env-file .env-ci run backend pytest | ||
- name: Check if files have been changed in the backend | ||
uses: actions/[email protected] | ||
id: backend-changed | ||
with: | ||
result-encoding: string | ||
script: | | ||
const result = await github.pulls.listFiles({ | ||
owner: context.payload.repository.owner.login, | ||
repo: context.payload.repository.name, | ||
pull_number: context.payload.number, | ||
per_page: 100 | ||
}) | ||
const backendChanged = result.data.filter(f => f.filename.startsWith("backend/") || f.filename.startsWith(".github") || f.filename.startsWith("docker-compose") || f.filename.startsWith(".env-ci")).length > 0 | ||
console.log("backend changed: ", backendChanged) | ||
return backendChanged | ||
- name: Checkout repository | ||
if: ${{ steps.backend-changed.outputs.result == 'true' }} | ||
uses: actions/checkout@v3 | ||
|
||
- name: Run backend tests | ||
run: sudo mkdir -p /ci-data && sudo docker-compose --env-file .env-ci run backend pytest |
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 |
---|---|---|
|
@@ -13,15 +13,31 @@ on: | |
- 'hotfix/**' | ||
- 'release/**' | ||
- 'dependabot/**' | ||
paths-ignore: | ||
- 'backend/**' | ||
- '**.md' | ||
|
||
jobs: | ||
frontend-test: | ||
name: Test Frontend | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Run frontend tests | ||
run: sudo docker-compose --env-file .env-ci run frontend yarn test | ||
- name: Check if files have been changed in the frontend | ||
uses: actions/[email protected] | ||
id: frontend-changed | ||
with: | ||
result-encoding: string | ||
script: | | ||
const result = await github.pulls.listFiles({ | ||
owner: context.payload.repository.owner.login, | ||
repo: context.payload.repository.name, | ||
pull_number: context.payload.number, | ||
per_page: 100 | ||
}) | ||
const frontendChanged = result.data.filter(f => f.filename.startsWith("frontend/") || f.filename.startsWith(".github") || f.filename.startsWith("docker-compose") || f.filename.startsWith(".env-ci")).length > 0 | ||
console.log("Frontend changed: ", frontendChanged) | ||
return frontendChanged | ||
- name: Checkout repository | ||
if: ${{ steps.frontend-changed.outputs.result == 'true' }} | ||
uses: actions/checkout@v3 | ||
|
||
- name: Run frontend tests | ||
run: sudo docker-compose --env-file .env-ci run frontend yarn test |