ci: add pr title lint workflow #183
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: π Continuous Integration | |
| on: | |
| push: | |
| branches: [main, ci/*, dependabot/*, renovate/*] | |
| tags: | |
| - "v*.*.*" | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| pre: | |
| runs-on: ubuntu-latest | |
| # Map a step output to a job output | |
| outputs: | |
| should_skip: ${{ steps.skip_check.outputs.should_skip == 'true' || (github.event_name == 'push' && contains(github.event.head_commit.message, '[ci-skip]')) }} | |
| steps: | |
| - name: Skip check | |
| id: skip_check | |
| uses: step-security/skip-duplicate-actions@4eef6ae57f2ca5ea100e5c1da2ead9138483f53c # v5 | |
| with: | |
| concurrent_skipping: "never" | |
| skip_after_successful_duplicate: "true" | |
| paths_ignore: '["**/*.md", "**/.vscode/**", "**/.idea/**"]' | |
| paths: '["**/**.fish", "tests/_resources/**", ".github/workflows/ci.yaml", "mise.toml"]' | |
| tests: | |
| name: π¬ ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| needs: pre | |
| if: github.ref_type == 'tag' || needs.pre.outputs.should_skip != 'true' | |
| strategy: | |
| matrix: | |
| os: [macos-latest, ubuntu-latest] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 | |
| - name: Setup mise | |
| uses: jdx/mise-action@dba19683ed58901619b14f395a24841710cb4925 # v4 | |
| with: | |
| cache: true | |
| log_level: debug | |
| - name: Install fish shell | |
| uses: fish-shop/install-fish-shell@e83b4f8c7c4d80c3b65ee0eb5d0e3bf4816536ee # v2 | |
| - name: Install abbreviation-tips with fisher | |
| uses: fish-shop/install-plugin@1ca93fe158b1ad8251835d4e310f99a3ec1f3d86 # v2 | |
| with: | |
| plugin-manager: fisher | |
| plugins: ${{ github.event.pull_request.head.repo.full_name || github.repository }}@${{ github.head_ref || github.ref_name }} | |
| - name: Run Fishtape tests | |
| uses: fish-shop/run-fishtape-tests@d3f44af7c30393801362c283c97fbd753ded76ed # v2 | |
| with: | |
| patterns: tests/**.fish | |
| # timeout in case tests get stuck on fzf | |
| timeout-minutes: 3 | |
| lint: | |
| name: β¨ Lint | |
| runs-on: ubuntu-latest | |
| needs: pre | |
| if: github.ref_type == 'tag' || needs.pre.outputs.should_skip != 'true' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 | |
| - name: Setup mise | |
| uses: jdx/mise-action@dba19683ed58901619b14f395a24841710cb4925 # v4 | |
| with: | |
| cache: true | |
| log_level: debug | |
| - name: Install fish shell | |
| uses: fish-shop/install-fish-shell@e83b4f8c7c4d80c3b65ee0eb5d0e3bf4816536ee # v2 | |
| - name: Run linting | |
| run: mise run lint | |
| # Ensure the workflow is successful only if all job in matrixes are successful | |
| result: | |
| name: β Result | |
| if: (github.ref_type == 'tag' || needs.pre.outputs.should_skip != 'true') && always() | |
| runs-on: ubuntu-latest | |
| needs: | |
| - pre | |
| - tests | |
| - lint | |
| steps: | |
| - name: Mark workflow as failed if lint or tests did not pass or were cancelled | |
| if: contains(fromJson('["failure", "cancelled"]'), needs.tests.result) || contains(fromJson('["failure", "cancelled"]'), needs.lint.result) | |
| run: exit 1 | |
| - name: Invoke release workflow | |
| if: github.ref_type == 'tag' | |
| uses: benc-uk/workflow-dispatch@e2e5e9a103e331dad343f381a29e654aea3cf8fc # v1 | |
| with: | |
| workflow: π Continuous Deployment |