From 228aa23ae098a5bd13469ddf9b3db226cdb5c00b Mon Sep 17 00:00:00 2001 From: Chris Pymm Date: Fri, 10 Jan 2025 10:00:24 +0000 Subject: [PATCH] ci: update the commit status with result of tests (#1067) * ci: update the commit status with result of tests * ci: update the status based on the result of the whole test matrix --- .github/workflows/deploy-production.yml | 20 +++++++++++++++++++- .github/workflows/publish-package.yml | 21 ++++++++++++++++++++- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-production.yml b/.github/workflows/deploy-production.yml index b39b7b1c..d70b6d95 100644 --- a/.github/workflows/deploy-production.yml +++ b/.github/workflows/deploy-production.yml @@ -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 @@ -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 diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml index b87e3ba5..7f0cc80d 100644 --- a/.github/workflows/publish-package.yml +++ b/.github/workflows/publish-package.yml @@ -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 @@ -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: