diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index a727a5e2..cedb5024 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -7,15 +7,45 @@ jobs: 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 and shfmt (used for testing) - run: sudo apt-get install -y shellcheck shfmt + - 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: @@ -34,7 +64,14 @@ jobs: - name: Publish coverage to codecov.io uses: codecov/codecov-action@v5 - if: success() && matrix.node-version == '22.x' + 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"