Skip to content

chore(deps): update github actions (major) #2298

chore(deps): update github actions (major)

chore(deps): update github actions (major) #2298

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
name: Check out repository
- uses: jdx/mise-action@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- run: mise run lint
test-matrix:
name: Generate test matrix
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
name: Check out repository
- uses: jdx/mise-action@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Go cache
uses: ./.github/actions/go-cache
- name: Generate test matrix
id: generate
run: echo "matrix=$(go run ./tools/ci/test-matrix)" >> "$GITHUB_OUTPUT"
outputs:
matrix: ${{ steps.generate.outputs.matrix }}
test:
needs: [test-matrix]
strategy:
fail-fast: true
matrix: ${{ fromJson(needs.test-matrix.outputs.matrix) }}
# Schema of matrix:
# name: string
# os: ubuntu-latest | windows-latest
# git-version: system | 2.38.0 | ...
# suite: default | script
# race: bool
# cover: bool
#
# If suite is 'script', then:
# shard-index: int
# shard-count: int
runs-on: ${{ matrix.os }}
name: Test / ${{ matrix.name }}
steps:
- uses: actions/checkout@v6
- uses: jdx/mise-action@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Go cache
uses: ./.github/actions/go-cache
- name: Install Git
uses: ./.github/actions/install-git
if: matrix.git-version != 'system'
with:
version: ${{ matrix.git-version }}
- name: Report Git version
shell: bash
run:
git --version
# TODO: can probably generate the exact test command in the matrix
- name: Test
if: ${{ matrix.suite == 'default' }}
run: >- # join lines with spaces
mise run
${{ matrix.cover && 'cover:default' || 'test:default' }}
${{ matrix.race && '--race' || '' }}
# NB:
# Windows tests are already slow.
# Run them without race detection to avoid slowing them further.
shell: bash
env:
GOTESTSUM_FORMAT: github-actions
- name: Script tests
if: ${{ matrix.suite == 'script' }}
run: |
mise run \
${{ matrix.cover && 'cover:script' || 'test:script' }} \
${{ matrix.race && '--race' || '' }} \
--shard-index "${{ matrix.shard-index || '0' }}" \
--shard-count "${{ matrix.shard-count || '1' }}"
shell: bash
env:
GOTESTSUM_FORMAT: github-actions
- name: Upload coverage
uses: codecov/codecov-action@v5.5.2
if: ${{ matrix.os != 'windows-latest' }}
with:
files: ./cover.out
token: ${{ secrets.CODECOV_TOKEN }}
# Depends on lint and test.
# Stable name for branch protection to require
# instead of adding lint and test there directly.
ok:
name: OK
runs-on: ubuntu-latest
needs: [lint, test]
# Workaround for GitHub marking this job as skipped,
# and allowing a bad PR to merge anyway.
if: always()
steps:
- run: exit 1
if: >-
needs.lint.result != 'success' ||
needs.test.result != 'success'
- run: exit 0