ci: also run the tests against the latest shfmt #4804
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: Verify changes | |
| on: [pull_request] | |
| jobs: | |
| verify: | |
| runs-on: ubuntu-latest | |
| name: verify (node ${{ matrix.node-version }}, ${{ matrix.shfmt }} shfmt) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| node-version: [20.x, 22.x] | |
| shfmt: [distro] | |
| include: | |
| # shfmt occasionally changes its output and its error messages, which | |
| # the formatter tests assert on. The archive version lags well behind, | |
| # so run one job against the latest release to catch such changes when | |
| # they happen rather than when a user reports them. | |
| - node-version: 22.x | |
| shfmt: latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install shellcheck (used for testing) | |
| run: sudo apt-get install -y shellcheck | |
| - name: Install shfmt from the Ubuntu archive (used for testing) | |
| if: matrix.shfmt == 'distro' | |
| run: sudo apt-get install -y shfmt | |
| - name: Install the latest shfmt release (used for testing) | |
| if: matrix.shfmt == 'latest' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| tag=$(gh release view --repo mvdan/sh --json tagName --jq .tagName) | |
| sudo curl -fsSL -o /usr/local/bin/shfmt \ | |
| "https://github.com/mvdan/sh/releases/download/$tag/shfmt_${tag}_linux_amd64" | |
| sudo chmod +x /usr/local/bin/shfmt | |
| - name: Show which shfmt is used | |
| run: | | |
| command -v shfmt | |
| shfmt --version | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| cache: "pnpm" | |
| node-version: ${{ matrix.node-version }} | |
| - run: pnpm install --frozen-lockfile | |
| - name: Verify changes | |
| run: pnpm verify:bail | |
| - name: Publish coverage to codecov.io | |
| uses: codecov/codecov-action@v5 | |
| if: success() && matrix.node-version == '22.x' && matrix.shfmt == 'distro' | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./codecov.yml | |
| all-done: | |
| needs: | |
| - verify | |
| runs-on: ubuntu-latest | |
| steps: | |
| - run: echo "All jobs completed" |