fix(cards): prevent concurrent default card race condition (#344) #98
Workflow file for this run
This file contains hidden or 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
| name: CI | |
| on: | |
| pull_request_target: | |
| types: [opened, synchronize, reopened] | |
| permissions: | |
| pull-requests: write | |
| jobs: | |
| detect-changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| backendChanged: ${{ steps.detect.outputs.backendChanged }} | |
| mobileChanged: ${{ steps.detect.outputs.mobileChanged }} | |
| webChanged: ${{ steps.detect.outputs.webChanged }} | |
| backendFiles: ${{ steps.detect.outputs.backendFiles }} | |
| mobileFiles: ${{ steps.detect.outputs.mobileFiles }} | |
| webFiles: ${{ steps.detect.outputs.webFiles }} | |
| backendTestFiles: ${{ steps.detect.outputs.backendTestFiles }} | |
| mobileTestFiles: ${{ steps.detect.outputs.mobileTestFiles }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - name: Detect changed files | |
| id: detect | |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const script = require('./.github/scripts/ciScript.js'); | |
| return await script({ github, context, core }); | |
| backend-ci: | |
| needs: detect-changes | |
| if: needs.detect-changes.outputs.backendChanged == 'true' | |
| runs-on: ubuntu-latest | |
| outputs: | |
| lint_result: ${{ steps.backend_lint.outcome }} | |
| test_result: ${{ steps.backend_test.outcome }} | |
| typecheck_result: ${{ steps.backend_typecheck.outcome }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e | |
| with: | |
| node-version: 22 | |
| - uses: pnpm/action-setup@v6.0.8 | |
| - run: pnpm install | |
| - name: Backend lint | |
| id: backend_lint | |
| continue-on-error: true | |
| run: cd apps/backend && pnpm eslint ${{ needs.detect-changes.outputs.backendFiles }} | |
| - name: Backend test | |
| id: backend_test | |
| if: needs.detect-changes.outputs.backendTestFiles != '' | |
| continue-on-error: true | |
| run: cd apps/backend && pnpm test --passWithNoTests ${{ needs.detect-changes.outputs.backendTestFiles }} | |
| - name: Backend typecheck | |
| id: backend_typecheck | |
| continue-on-error: true | |
| run: cd apps/backend && pnpm typecheck | |
| - name: Fail job if any check failed | |
| if: > | |
| steps.backend_lint.outcome == 'failure' || | |
| steps.backend_test.outcome == 'failure' || | |
| steps.backend_typecheck.outcome == 'failure' | |
| run: exit 1 | |
| web-ci: | |
| needs: detect-changes | |
| if: needs.detect-changes.outputs.webChanged == 'true' | |
| runs-on: ubuntu-latest | |
| outputs: | |
| check_result: ${{ steps.web_check.outcome }} | |
| build_result: ${{ steps.web_build.outcome }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e | |
| with: | |
| node-version: 22 | |
| - uses: pnpm/action-setup@v6.0.8 | |
| - run: pnpm install | |
| - name: Web check | |
| id: web_check | |
| continue-on-error: true | |
| run: cd apps/web && pnpm check | |
| - name: Web build | |
| id: web_build | |
| continue-on-error: true | |
| run: cd apps/web && pnpm build | |
| - name: Fail job if any check failed | |
| if: > | |
| steps.web_check.outcome == 'failure' || | |
| steps.web_build.outcome == 'failure' | |
| run: exit 1 | |
| mobile-ci: | |
| needs: detect-changes | |
| if: needs.detect-changes.outputs.mobileChanged == 'true' | |
| runs-on: ubuntu-latest | |
| outputs: | |
| lint_result: ${{ steps.mobile_lint.outcome }} | |
| test_result: ${{ steps.mobile_test.outcome }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e | |
| with: | |
| node-version: 22 | |
| - uses: pnpm/action-setup@v6.0.8 | |
| - run: pnpm install | |
| - name: Mobile lint | |
| id: mobile_lint | |
| continue-on-error: true | |
| run: cd apps/mobile && pnpm eslint ${{ needs.detect-changes.outputs.mobileFiles }} | |
| - name: Mobile test | |
| id: mobile_test | |
| if: needs.detect-changes.outputs.mobileTestFiles != '' | |
| continue-on-error: true | |
| run: cd apps/mobile && pnpm test --passWithNoTests ${{ needs.detect-changes.outputs.mobileTestFiles }} | |
| - name: Fail job if any check failed | |
| if: > | |
| steps.mobile_lint.outcome == 'failure' || | |
| steps.mobile_test.outcome == 'failure' | |
| run: exit 1 | |
| comment-results: | |
| needs: | |
| - backend-ci | |
| - web-ci | |
| - mobile-ci | |
| if: always() | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd | |
| - name: Comment results | |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const script = require('./.github/scripts/commentResults.js'); | |
| await script({ | |
| github, | |
| context, | |
| backend: '${{ needs.backend-ci.result }}', | |
| web: '${{ needs.web-ci.result }}', | |
| mobile: '${{ needs.mobile-ci.result }}', | |
| backendLint: '${{ needs.backend-ci.outputs.lint_result }}', | |
| backendTest: '${{ needs.backend-ci.outputs.test_result }}', | |
| backendTypecheck: '${{ needs.backend-ci.outputs.typecheck_result }}', | |
| webCheck: '${{ needs.web-ci.outputs.check_result }}', | |
| webBuild: '${{ needs.web-ci.outputs.build_result }}', | |
| mobileLint: '${{ needs.mobile-ci.outputs.lint_result }}', | |
| mobileTest: '${{ needs.mobile-ci.outputs.test_result }}', | |
| }); |