Skip to content

Commit

Permalink
ci: update the commit status with result of tests (#1067)
Browse files Browse the repository at this point in the history
* ci: update the commit status with result of tests

* ci: update the status based on the result of the whole test matrix
  • Loading branch information
chrispymm authored Jan 10, 2025
1 parent dd472f9 commit 228aa23
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
20 changes: 19 additions & 1 deletion .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ jobs:
node-version: [14.x, 16.x, 18.x, 20.x, 21.x, 22.x]

steps:
- name: Set commit status as pending
uses: myrotvorets/set-commit-status-action@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
status: pending
context: Tests
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
Expand All @@ -60,9 +66,21 @@ jobs:
- name: Test that sass can be compiled
run: npm run test:sass

result:
runs-on: ubuntu-latest
needs: [test]
if: always()
steps:
- name: Set final commit status
uses: myrotvorets/set-commit-status-action@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ needs.test.result }}
context: Tests

deploy:
runs-on: ubuntu-latest
needs: [build, test]
needs: [result]
if: github.event_name == 'push'
permissions:
id-token: write
Expand Down
21 changes: 20 additions & 1 deletion .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ jobs:
node-version: [14.x, 16.x, 18.x, 20.x, 21.x, 22.x]

steps:
- name: Set commit status as pending
uses: myrotvorets/set-commit-status-action@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
status: pending
context: Tests
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
Expand All @@ -55,9 +61,22 @@ jobs:
- name: Test that sass can be compiled
run: npm run test:sass

result:
runs-on: ubuntu-latest
needs: [test]
if: always()
steps:
- name: Set final commit status
uses: myrotvorets/set-commit-status-action@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ needs.test.result }}
context: Tests


publish:
runs-on: ubuntu-latest
needs: [build, test]
needs: [result]
if: github.event_name == 'push'

steps:
Expand Down

0 comments on commit 228aa23

Please sign in to comment.