CI #1621
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: | |
| release: | |
| types: [released] | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| permissions: | |
| contents: read | |
| jobs: | |
| quality_checks: | |
| name: Quality checks | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| strategy: | |
| matrix: | |
| node: [ 18, 20, 22 ] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3.3.0 | |
| - name: Setup NodeJS ${{ matrix.node }} | |
| uses: actions/setup-node@v3.6.0 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| cache: 'npm' | |
| - name: Install deps | |
| run: npm ci | |
| - name: Run tests | |
| run: npm test -- --coverage | |
| security_checks: | |
| name: Security checks | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3.3.0 | |
| - name: Setup NodeJS 22 | |
| uses: actions/setup-node@v3.6.0 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| - name: Audit dependencies | |
| run: npm audit --audit-level=low --omit=dev | |
| lint: | |
| name: Lint | |
| if: github.ref != 'refs/heads/main' # Don't run for main branch | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3.3.0 | |
| - name: Lint Code Base | |
| uses: docker://github/super-linter:v2.1.1 | |
| env: | |
| VALIDATE_ALL_CODEBASE: false | |
| DEFAULT_BRANCH: main | |
| VALIDATE_JAVASCRIPT_ES: true | |
| VALIDATE_JSON: true | |
| VALIDATE_YAML: true | |
| publish: | |
| name: Publish | |
| needs: [quality_checks, security_checks, lint] | |
| if: github.event_name == 'release' && github.event.action == 'released' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3.3.0 | |
| - name: Setup NodeJS 22 | |
| uses: actions/setup-node@v3.6.0 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| registry-url: https://registry.npmjs.org | |
| scope: '@quickcase' | |
| - name: Install deps | |
| run: npm ci | |
| - name: Publish | |
| run: npm publish | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| end: | |
| name: End | |
| needs: [quality_checks, security_checks, lint, publish] | |
| if: always() | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| env: | |
| SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
| steps: | |
| - name: Build summary | |
| id: summary | |
| env: | |
| QUALITY: ${{ needs.quality_checks.result }} | |
| SECURITY: ${{ needs.security_checks.result }} | |
| LINT: ${{ needs.lint.result }} | |
| PUBLISH: ${{ needs.publish.result }} | |
| run: | | |
| echo ::set-output name=success::$(if [[ "$QUALITY$SECURITY$LINT$PUBLISH" =~ ^(success|skipped)+$ ]]; then echo "true"; else echo "false"; fi) | |
| - name: Notify slack success | |
| if: steps.summary.outputs.success == 'true' && github.event_name == 'release' && env.SLACK_BOT_TOKEN != 0 | |
| uses: voxmedia/github-action-slack-notify-build@v1 | |
| with: | |
| channel: dev | |
| status: SUCCESS | |
| color: good | |
| - name: Notify slack fail | |
| if: steps.summary.outputs.success != 'true' && env.SLACK_BOT_TOKEN != 0 | |
| uses: voxmedia/github-action-slack-notify-build@v1 | |
| with: | |
| channel: dev | |
| status: FAILED | |
| color: danger |