Skip to content

Update prek hooks (#2555) #6110

Update prek hooks (#2555)

Update prek hooks (#2555) #6110

Workflow file for this run

name: CI
on:
push:
branches: [master]
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
permissions: {}
env:
# UV_VERSION should not greater than MAX_UV_VERSION in `languages/python/uv`.
# Otherwise, tests jobs will install their own uv, and it will encounter concurrency issue.
UV_VERSION: "0.12.3"
NODE_VERSION: "20"
BUN_VERSION: "1.3"
GO_VERSION: "1.24"
# The mise tests install 2026.7.18 separately to cover managed downloads.
MISE_VERSION: "2026.8.3"
PYTHON_VERSION: "3.12"
PHP_VERSION: "8.4"
RUBY_VERSION: "3.4"
LUA_VERSION: "5.4"
LUAROCKS_VERSION: "3.12.2"
GHC_VERSION: "9.14.1" # Preinstalled in ubuntu-24.04 runner image
CABAL_VERSION: "3.16.1.0"
JULIA_VERSION: "1.12.4"
DOTNET_VERSION: "10.0"
DENO_VERSION: "2"
DART_VERSION: "3.10.4"
R_VERSION: "4.6.0"
# Cargo env vars
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
CARGO_TERM_COLOR: always
RUSTUP_MAX_RETRIES: 10
jobs:
plan:
runs-on: ubuntu-slim
outputs:
test-code: ${{ steps.plan.outputs.test_code }}
save-rust-cache: ${{ steps.plan.outputs.save_rust_cache }}
language-test-matrix: ${{ steps.nextest.outputs.language-test-matrix }}
ci-core-filter: ${{ steps.nextest.outputs.ci-core-filter }}
run-bench: ${{ steps.plan.outputs.run_bench }}
run-zizmor: ${{ steps.plan.outputs.run_zizmor }}
check-docs: ${{ steps.plan.outputs.check_docs }}
build-release-binaries: ${{ steps.plan.outputs.build_release_binaries }}
build-docker: ${{ steps.plan.outputs.build_docker }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: "Plan"
id: plan
shell: bash
env:
GH_REF: ${{ github.ref }}
HAS_SKIP_LABEL: ${{ contains(github.event.pull_request.labels.*.name, 'test:skip') }}
HAS_BUILD_SKIP_LABEL: ${{ contains(github.event.pull_request.labels.*.name, 'build:skip') }}
HAS_BUILD_SKIP_DOCKER_LABEL: ${{ contains(github.event.pull_request.labels.*.name, 'build:skip-docker') }}
HAS_BUILD_SKIP_RELEASE_LABEL: ${{ contains(github.event.pull_request.labels.*.name, 'build:skip-release') }}
HAS_BUILD_RELEASE_LABEL: ${{ contains(github.event.pull_request.labels.*.name, 'build:release') }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
run: |
[[ "$GH_REF" == "refs/heads/master" ]] && on_master_branch=1
[[ "$HAS_SKIP_LABEL" == "true" ]] && has_skip_label=1
[[ "$HAS_BUILD_SKIP_LABEL" == "true" ]] && has_build_skip_label=1
[[ "$HAS_BUILD_SKIP_DOCKER_LABEL" == "true" ]] && has_build_skip_docker_label=1
[[ "$HAS_BUILD_SKIP_RELEASE_LABEL" == "true" ]] && has_build_skip_release_label=1
[[ "$HAS_BUILD_RELEASE_LABEL" == "true" ]] && has_build_release_label=1
while IFS= read -r file; do
[[ -z "$file" ]] && continue
[[ "$file" =~ \.rs$ ]] && rust_code_changed=1
[[ "$file" == "Cargo.toml" || "$file" == "Cargo.lock" || "$file" =~ ^crates/.*/Cargo\.toml$ ]] && rust_deps_changed=1
[[ "$file" == "rust-toolchain.toml" || "$file" =~ ^\.cargo/ ]] && rust_config_changed=1
[[ "$file" == "pyproject.toml" ]] && pyproject_changed=1
[[ "$file" == "docs/reference/cli.md" || "$file" == "docs/reference/configuration.md" || "$file" == "prek.schema.json" ]] && generated_from_code_changed=1
[[ "$file" =~ ^docs/ || "$file" == "mkdocs.yml" || "$file" == "pyproject.toml" || "$file" == "uv.lock" ]] && docs_related_changed=1
[[ "$file" =~ ^\.github/workflows/.*\.ya?ml$ ]] && workflow_changed=1
[[ "$file" == ".github/workflows/ci.yml" ]] && ci_workflow_changed=1
[[ "$file" == ".github/workflows/build-release-binaries.yml" ]] && release_binaries_workflow_changed=1
[[ "$file" == "dist-workspace.toml" ]] && release_config_changed=1
[[ "$file" == ".github/zizmor.yml" ]] && zizmor_config_changed=1
[[ "$file" == "Dockerfile" ]] && dockerfile_changed=1
[[ "$file" == ".github/workflows/build-docker.yml" ]] && docker_workflow_changed=1
[[ "$file" == ".github/workflows/performance.yml" ]] && bench_workflow_changed=1
[[ "$file" =~ ^scripts/hyperfine-.*\.sh$ ]] && bench_scripts_changed=1
[[ "$file" =~ ^docs/ || "$file" =~ ^mkdocs.*\.yml$ || "$file" =~ \.md$ ]] && continue
any_code_changed=1
done <<< "$(git diff --name-only "${BASE_SHA:-origin/master}...HEAD")"
[[ $rust_code_changed || $rust_deps_changed || $rust_config_changed ]] && any_rust_changed=1
[[ $rust_deps_changed || $rust_config_changed || $workflow_changed ]] && cache_relevant_changed=1
[[ $bench_workflow_changed || $bench_scripts_changed ]] && bench_related_changed=1
[[ $pyproject_changed || $release_binaries_workflow_changed ]] && release_build_changed=1
[[ $rust_deps_changed || $rust_config_changed || $dockerfile_changed || $docker_workflow_changed ]] && docker_build_changed=1
[[ ! $has_skip_label && ($any_code_changed || $generated_from_code_changed || $on_master_branch) ]] && test_code=1
[[ $on_master_branch || $cache_relevant_changed ]] && save_rust_cache=1
[[ ! $has_skip_label && ($any_rust_changed || $bench_related_changed || $on_master_branch) ]] && run_bench=1
[[ ! $has_skip_label && ($workflow_changed || $zizmor_config_changed || $on_master_branch) ]] && run_zizmor=1
[[ ! $has_skip_label && ($docs_related_changed || $on_master_branch) ]] && check_docs=1
[[ ! $has_skip_label && ! $has_build_skip_label && ! $has_build_skip_release_label && ($release_build_changed || $has_build_release_label) ]] && build_release_binaries=1
[[ ! $has_skip_label && ! $has_build_skip_label && ! $has_build_skip_docker_label && $docker_build_changed ]] && build_docker=1
out() { [[ "$2" ]] && echo "$1=true" || echo "$1=false"; }
{
out test_code "$test_code"
out save_rust_cache "$save_rust_cache"
out run_bench "$run_bench"
out run_zizmor "$run_zizmor"
out check_docs "$check_docs"
out build_release_binaries "$build_release_binaries"
out build_docker "$build_docker"
} >> "${GITHUB_OUTPUT}"
- name: "Generate nextest filters"
id: nextest
shell: bash
run: |
python3 scripts/generate-ci-matrix.py --group-size 5 --github-output >> "${GITHUB_OUTPUT}"
lint:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: "Install Rustfmt"
run: rustup component add rustfmt
- name: "rustfmt"
run: cargo fmt --all --check
- name: Run prek checks
uses: j178/prek-action@4e14d07f9231acabce116ccfca13b13dd9755ece # v3.0.0
env:
PREK_SKIP: cargo-fmt,cargo-clippy
check-release:
needs: plan
timeout-minutes: 10
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install dist
shell: bash
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.32.0/cargo-dist-installer.sh | sh"
- name: Run dist plan
run: |
dist plan --output-format=json > plan-dist-manifest.json
echo "dist plan completed successfully"
cat plan-dist-manifest.json
check-zizmor:
name: Run zizmor
needs: plan
if: ${{ needs.plan.outputs.run-zizmor == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Run zizmor
uses: zizmorcore/zizmor-action@3dc1ecc9bcb9e94e9b2c709687979e1298497054 # v0.6.2
check-docs:
needs: plan
if: ${{ needs.plan.outputs.check-docs == 'true' }}
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
with:
version: ${{ env.UV_VERSION }}
- name: Build documentation
run: |
uv run --group docs zensical build
uv run --group docs llmstxt-standalone build
build-release-binaries:
needs: plan
if: ${{ needs.plan.outputs.build-release-binaries == 'true' }}
uses: ./.github/workflows/build-release-binaries.yml
with:
# CI has no cargo-dist manifest; release.yml passes the real plan when publishing.
plan: ""
build-docker:
needs: plan
if: ${{ needs.plan.outputs.build-docker == 'true' }}
uses: ./.github/workflows/build-docker.yml
with:
# CI has no cargo-dist manifest; an empty plan keeps Docker builds in dry-run mode.
plan: ""
permissions:
contents: read
id-token: write
packages: write
attestations: write
cargo-clippy-linux:
name: "cargo clippy | ubuntu"
needs: plan
if: ${{ needs.plan.outputs.test-code == 'true' }}
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: rui314/setup-mold@9c9c13bf4c3f1adef0cc596abc155580bcb04444 # v1
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
with:
save-if: ${{ needs.plan.outputs.save-rust-cache == 'true' }}
- name: "Install Rust toolchain"
run: rustup component add clippy
- name: "Clippy"
run: cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
cargo-clippy-windows:
name: "cargo clippy | windows"
needs: plan
if: ${{ needs.plan.outputs.test-code == 'true' }}
timeout-minutes: 15
runs-on: windows-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Create Dev Drive
run: ${{ github.workspace }}/.github/scripts/setup-dev-drive.ps1
# actions/checkout does not let us clone into anywhere outside ${{ github.workspace }}, so we have to copy the clone...
- name: Copy Git Repo to Dev Drive
run: |
Copy-Item -Path "${{ github.workspace }}" -Destination "$Env:PREK_WORKSPACE" -Recurse
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
with:
workspaces: ${{ env.PREK_WORKSPACE }}
save-if: ${{ needs.plan.outputs.save-rust-cache == 'true' }}
- name: "Install Rust toolchain"
run: rustup component add clippy
- name: "Clippy"
working-directory: ${{ env.PREK_WORKSPACE }}
run: cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
cargo-shear:
name: "cargo shear"
needs: plan
if: ${{ needs.plan.outputs.test-code == 'true' }}
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: "Install cargo shear"
uses: taiki-e/install-action@7f4eb899022d8fe70b20c4f3de697aa85c309026 # v2.85.11
with:
tool: cargo-shear
- run: cargo shear
cargo-test-without-uv:
needs: plan
if: ${{ needs.plan.outputs.test-code == 'true' }}
timeout-minutes: 5
runs-on: ubuntu-latest
name: "cargo test | without uv"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: rui314/setup-mold@9c9c13bf4c3f1adef0cc596abc155580bcb04444 # v1
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
with:
save-if: ${{ needs.plan.outputs.save-rust-cache == 'true' }}
- name: "Install Rust toolchain"
run: rustup component add llvm-tools-preview
- name: "Install cargo nextest"
uses: taiki-e/install-action@7f4eb899022d8fe70b20c4f3de697aa85c309026 # v2.85.11
with:
tool: cargo-nextest
- name: "Install cargo-llvm-cov"
uses: taiki-e/install-action@7f4eb899022d8fe70b20c4f3de697aa85c309026 # v2.85.11
with:
tool: cargo-llvm-cov
- name: "Cargo test without uv"
run: |
echo "::group::Test install uv with auto select"
cargo llvm-cov nextest \
--profile ci-core \
--cargo-profile fast-build \
--no-report \
-E 'binary_id(prek::run) and test(run_basic)'
echo "::endgroup::"
for source in github pypi aliyun pip invalid; do
echo "::group::Test install uv from $source"
export PREK_UV_SOURCE=$source
cargo llvm-cov nextest \
--profile ci-core \
--cargo-profile fast-build \
--no-report \
-E 'binary_id(prek::run) and test(run_basic)'
echo "::endgroup::"
done
cargo llvm-cov report --profile fast-build --lcov --output-path lcov.info
- name: "Upload coverage reports to Codecov"
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
cargo-test:
needs: plan
if: ${{ needs.plan.outputs.test-code == 'true' }}
timeout-minutes: 10
runs-on: ${{ matrix.os }}
name: "cargo test | ${{ matrix.os }}"
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: rui314/setup-mold@9c9c13bf4c3f1adef0cc596abc155580bcb04444 # v1
if: ${{ matrix.os == 'ubuntu-latest' }}
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
with:
save-if: ${{ needs.plan.outputs.save-rust-cache == 'true' }}
# Workaround for https://github.com/Swatinem/rust-cache/issues/341
cache-bin: false
- name: "Install Rust toolchain"
run: rustup component add llvm-tools-preview
- name: "Install cargo nextest"
uses: taiki-e/install-action@7f4eb899022d8fe70b20c4f3de697aa85c309026 # v2.85.11
with:
tool: cargo-nextest
- name: "Install cargo-llvm-cov"
uses: taiki-e/install-action@7f4eb899022d8fe70b20c4f3de697aa85c309026 # v2.85.11
with:
tool: cargo-llvm-cov
- name: "Install uv"
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
with:
version: ${{ env.UV_VERSION }}
- name: "Install Python"
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: "Cargo test"
env:
CI_CORE_FILTER: ${{ needs.plan.outputs.ci-core-filter }}
run: |
cargo llvm-cov nextest \
--lcov \
--output-path lcov.info \
--workspace \
--cargo-profile fast-build \
--profile ci-core \
--features schemars \
-E "${CI_CORE_FILTER}"
- name: "Upload coverage reports to Codecov"
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
cargo-test-windows:
name: "cargo test | windows"
needs: plan
if: ${{ needs.plan.outputs.test-code == 'true' }}
runs-on: windows-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Create Dev Drive
run: ${{ github.workspace }}/.github/scripts/setup-dev-drive.ps1
# actions/checkout does not let us clone into anywhere outside ${{ github.workspace }}, so we have to copy the clone...
- name: Copy Git Repo to Dev Drive
run: |
Copy-Item -Path "${{ github.workspace }}" -Destination "$Env:PREK_WORKSPACE" -Recurse
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
with:
workspaces: ${{ env.PREK_WORKSPACE }}
save-if: ${{ needs.plan.outputs.save-rust-cache == 'true' }}
- name: "Install Rust toolchain"
run: rustup component add llvm-tools-preview
- name: "Install cargo nextest"
uses: taiki-e/install-action@7f4eb899022d8fe70b20c4f3de697aa85c309026 # v2.85.11
with:
tool: cargo-nextest
- name: "Install cargo-llvm-cov"
uses: taiki-e/install-action@7f4eb899022d8fe70b20c4f3de697aa85c309026 # v2.85.11
with:
tool: cargo-llvm-cov
- name: "Install uv"
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
with:
version: ${{ env.UV_VERSION }}
cache-local-path: ${{ env.DEV_DRIVE }}/uv-cache
- name: "Install Python"
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: "Cargo test"
working-directory: ${{ env.PREK_WORKSPACE }}
shell: pwsh
env:
CI_CORE_FILTER: ${{ needs.plan.outputs.ci-core-filter }}
run: |
# Remove msys64 from PATH for Rust compilation
$env:PATH = ($env:PATH -split ';' | Where-Object { $_ -notmatch '\\msys64\\' }) -join ';'
cargo llvm-cov nextest `
--lcov `
--output-path lcov.info `
--workspace `
--cargo-profile fast-build `
--features schemars `
--profile ci-core `
-E $env:CI_CORE_FILTER
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: "Upload coverage reports to Codecov"
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{ env.PREK_WORKSPACE }}/lcov.info
language-tests:
name: "language tests | ${{ matrix.os }} | group ${{ matrix.group }} (${{ matrix.languages }})"
needs: plan
if: ${{ needs.plan.outputs.test-code == 'true' }}
timeout-minutes: 15
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.plan.outputs.language-test-matrix) }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: rui314/setup-mold@9c9c13bf4c3f1adef0cc596abc155580bcb04444 # v1
if: ${{ matrix.os == 'ubuntu-latest' }}
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
with:
save-if: ${{ needs.plan.outputs.save-rust-cache == 'true' }}
# Workaround for https://github.com/Swatinem/rust-cache/issues/341
cache-bin: false
- name: "Install Rust toolchain"
run: rustup component add llvm-tools-preview
- name: "Install cargo nextest"
uses: taiki-e/install-action@7f4eb899022d8fe70b20c4f3de697aa85c309026 # v2.85.11
with:
tool: cargo-nextest
- name: "Install cargo-llvm-cov"
uses: taiki-e/install-action@7f4eb899022d8fe70b20c4f3de697aa85c309026 # v2.85.11
with:
tool: cargo-llvm-cov
# LuaRocks may compile native Lua modules, such as luafilesystem, on Windows.
- name: "Setup MSVC"
if: ${{ matrix.os == 'windows-latest' && contains(format(' {0} ', matrix.languages), ' lua ') }}
shell: pwsh
run: ./.github/scripts/setup-msvc.ps1
- name: "Install uv"
if: ${{ contains(format(' {0} ', matrix.languages), ' python ') }}
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
with:
version: ${{ env.UV_VERSION }}
- name: "Install Python"
if: ${{ contains(format(' {0} ', matrix.languages), ' python ') }}
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: "Install Node.js"
if: ${{ contains(format(' {0} ', matrix.languages), ' node ') }}
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
# Dummy dependency path to satisfy required input while enabling caching
cache-dependency-path: LICENSE
- name: "Install Go"
if: ${{ contains(format(' {0} ', matrix.languages), ' golang ') }}
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: ${{ env.GO_VERSION }}
# Dummy dependency path to satisfy required input while enabling caching
cache-dependency-path: LICENSE
- name: "Install mise"
if: ${{ contains(format(' {0} ', matrix.languages), ' mise ') }}
uses: jdx/mise-action@7e36c90d9ab29c415a2384db3006f3ec8a8cc654 # v4.2.4
with:
version: ${{ env.MISE_VERSION }}
install: false
cache: false
env: false
add_shims_to_path: false
working_directory: ${{ runner.temp }}
- name: "Install Lua"
if: ${{ contains(format(' {0} ', matrix.languages), ' lua ') }}
uses: leafo/gh-actions-lua@6919171ccf181b826f44b9bca76307b577217377 # v13.0.0
with:
luaVersion: ${{ env.LUA_VERSION }}
- name: "Install LuaRocks"
if: ${{ contains(format(' {0} ', matrix.languages), ' lua ') }}
uses: luarocks/gh-actions-luarocks@86ccbcad8c77b22e94c96a2a08632192e2bcd62b
with:
luaRocksVersion: ${{ env.LUAROCKS_VERSION }}
- name: "Install Ruby"
if: ${{ contains(format(' {0} ', matrix.languages), ' ruby ') }}
uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
with:
ruby-version: ${{ env.RUBY_VERSION }}
- name: "Install PHP and Composer"
if: ${{ contains(format(' {0} ', matrix.languages), ' php ') }}
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
with:
php-version: ${{ env.PHP_VERSION }}
tools: composer
coverage: none
- name: "Install Bun"
if: ${{ contains(format(' {0} ', matrix.languages), ' bun ') }}
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: ${{ env.BUN_VERSION }}
- name: "Install Micromamba"
if: ${{ contains(format(' {0} ', matrix.languages), ' conda ') }}
uses: mamba-org/setup-micromamba@f457c30a868e4760d3a6fcea5f25dc655b8edf39 # v3.2.1
with:
init-shell: none
generate-run-shell: false
- name: "Install Coursier"
if: ${{ contains(format(' {0} ', matrix.languages), ' coursier ') }}
uses: coursier/setup-action@9b7939bf01fd1185ce2babe16135168361bf2c62 # v3.0.2
with:
apps: ""
- name: "Install Deno"
if: ${{ contains(format(' {0} ', matrix.languages), ' deno ') }}
uses: denoland/setup-deno@22d081ff2d3a40755e97629de92e3bcbfa7cf2ed # v2.0.5
with:
deno-version: ${{ env.DENO_VERSION }}
- name: "Install Dart"
if: ${{ contains(format(' {0} ', matrix.languages), ' dart ') }}
uses: dart-lang/setup-dart@7654d458321ee25acccccfdb86cd48bd95768ff1 # v1.8.0
with:
sdk: ${{ env.DART_VERSION }}
- name: "Install GHC and Cabal"
if: ${{ contains(format(' {0} ', matrix.languages), ' haskell ') }}
uses: haskell-actions/setup@6037f33647c3f17758a2356c80fc4a53d7e0685d # v2.12.0
with:
ghc-version: ${{ env.GHC_VERSION }}
cabal-version: ${{ env.CABAL_VERSION }}
- name: "Install Julia"
if: ${{ contains(format(' {0} ', matrix.languages), ' julia ') }}
uses: julia-actions/setup-julia@fa02766e078afaaf09b14210362cee14137e6a32 # v3.0.2
with:
version: ${{ env.JULIA_VERSION }}
- name: "Install .NET"
if: ${{ contains(format(' {0} ', matrix.languages), ' dotnet ') }}
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: "Install R"
if: ${{ contains(format(' {0} ', matrix.languages), ' r ') }}
uses: r-lib/actions/setup-r@d3c5be51b12e724e68f33216ca3c148b66d5f0b6 # v2.12.1
with:
r-version: ${{ env.R_VERSION }}
use-public-rspm: true
- name: "Check Perl and CPAN"
if: ${{ contains(format(' {0} ', matrix.languages), ' perl ') }}
run: |
perl -V:version
perl -MCPAN -e 'print "CPAN $CPAN::VERSION\n"'
- name: "Run language tests"
if: ${{ matrix.os != 'windows-latest' }}
env:
# Ruby auto_download test queries the GitHub Releases API; without a
# token, shared runners quickly hit the 60 req/hour rate limit.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NEXTEST_FILTER: ${{ matrix.filter }}
PRE_COMMIT_USE_MICROMAMBA: "true"
run: |
cargo llvm-cov nextest \
--lcov \
--output-path lcov.info \
--workspace \
--cargo-profile fast-build \
--features schemars \
--profile ci-language \
-E "$NEXTEST_FILTER"
- name: "Run language tests (windows)"
if: ${{ matrix.os == 'windows-latest' }}
shell: pwsh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NEXTEST_FILTER: ${{ matrix.filter }}
PRE_COMMIT_USE_MICROMAMBA: "true"
run: |
# Remove msys64 from PATH for Rust compilation
$env:PATH = ($env:PATH -split ';' | Where-Object { $_ -notmatch '\\msys64\\' }) -join ';'
cargo llvm-cov nextest `
--lcov `
--output-path lcov.info `
--workspace `
--cargo-profile fast-build `
--features schemars `
--profile ci-language `
-E $env:NEXTEST_FILTER
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: "Upload coverage reports to Codecov"
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
performance:
needs: plan
if: ${{ needs.plan.outputs.run-bench == 'true' }}
uses: ./.github/workflows/performance.yml
with:
save-rust-cache: ${{ needs.plan.outputs.save-rust-cache }}
ecosystem-cpython:
name: "ecosystem | cpython"
needs: plan
if: ${{ needs.plan.outputs.test-code == 'true' }}
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Checkout python/cpython
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: python/cpython
ref: f3759d21dd5e6510361d7409a1df53f35ebd9a58
path: cpython
fetch-depth: 1
persist-credentials: false
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
with:
save-if: ${{ needs.plan.outputs.save-rust-cache == 'true' }}
- name: Run prek on cpython
working-directory: cpython
run: cargo run -p prek -- --all-files
build-dev-binaries:
needs: plan
if: ${{ needs.plan.outputs.test-code == 'true' }}
uses: ./.github/workflows/build-dev-binaries.yml
with:
save-rust-cache: ${{ needs.plan.outputs.save-rust-cache }}
required-checks-passed:
name: "all required jobs passed"
if: always()
needs:
- lint
- check-release
- check-zizmor
- check-docs
- cargo-clippy-linux
- cargo-clippy-windows
- cargo-shear
- cargo-test-without-uv
- cargo-test
- cargo-test-windows
- language-tests
- ecosystem-cpython
- build-dev-binaries
runs-on: ubuntu-slim
steps:
- name: "Check required jobs passed"
run: |
failing=$(echo "$NEEDS_JSON" | jq -r 'to_entries[] | select(.value.result != "success" and .value.result != "skipped") | "\(.key): \(.value.result)"')
if [ -n "$failing" ]; then
echo "$failing"
exit 1
fi
env:
NEEDS_JSON: ${{ toJSON(needs) }}