name: CI on: push: branches: [main] 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.13.7" 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" SWIFT_VERSION: "6.4.2" # Cargo env vars CARGO_INCREMENTAL: 0 CARGO_NET_RETRY: 10 CARGO_TERM_COLOR: always RUSTUP_MAX_RETRIES: 10 jobs: plan: runs-on: ubuntu-latest 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 }} publish-dev-docs: ${{ steps.plan.outputs.publish_dev_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 || github.event.before }} HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }} run: | [[ "$GH_REF" == "refs/heads/main" ]] && on_main_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 # The merge commit can include base-branch changes newer than BASE_SHA. # Compare against the PR head to avoid counting those as PR changes. 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" || "$file" == "prek-hooks.schema.json" ]] && generated_from_code_changed=1 [[ "$file" =~ ^docs/ || "$file" == "mkdocs.yml" || "$file" == "pyproject.toml" || "$file" == "uv.lock" || "$file" == ".github/workflows/publish-docs.yml" ]] && 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" == "scripts/setup-release-linker.sh" ]] && release_binaries_workflow_changed=1 [[ "$file" == scripts/cargo.* || "$file" == "scripts/check-release-artifact-sboms.py" ]] && release_binaries_workflow_changed=1 if [[ "$file" == "scripts/install-cargo-tools.sh" ]]; then release_binaries_workflow_changed=1 dockerfile_changed=1 fi [[ "$file" == "scripts/pgo/train.py" || "$file" == "scripts/pgo/workloads.py" ]] && 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/main}...${HEAD_SHA}")" [[ $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_main_branch) ]] && test_code=1 [[ $on_main_branch || $cache_relevant_changed ]] && save_rust_cache=1 [[ ! $has_skip_label && ($any_rust_changed || $bench_related_changed || $on_main_branch) ]] && run_bench=1 [[ ! $has_skip_label && ($workflow_changed || $zizmor_config_changed || $on_main_branch) ]] && run_zizmor=1 [[ ! $has_skip_label && ($docs_related_changed || $on_main_branch) ]] && check_docs=1 [[ $on_main_branch && $docs_related_changed ]] && publish_dev_docs=1 [[ ! $on_main_branch && ! $has_skip_label && ! $has_build_skip_label && ! $has_build_skip_release_label && ($release_build_changed || $has_build_release_label) ]] && build_release_binaries=1 [[ ! $on_main_branch && ! $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 publish_dev_docs "$publish_dev_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@44924fe9ef4a6f88253c4b6b1bf11c689d3ce53d # v3.1.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@45d7276c9ca790aabd705e31ca99c6185c3e76dd # v0.8.1 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@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 with: version: ${{ env.UV_VERSION }} - name: Build documentation run: | uv run --group docs zensical build uv run --group docs llmstxt-standalone build publish-dev-docs: needs: - plan - check-docs if: ${{ needs.plan.outputs.publish-dev-docs == 'true' }} permissions: contents: write id-token: write pages: write uses: $/.github/workflows/publish-docs.yml with: plan: "" 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 - name: "Install mold" run: ./scripts/install-mold.sh - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 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 }}/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@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 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@cfdb7ed4ccc7c7dce37759eae89dc5674b469b39 # v2.90.3 with: tool: cargo-shear - run: cargo shear cargo-test-without-uv: needs: plan if: ${{ needs.plan.outputs.test-code == 'true' }} timeout-minutes: 15 runs-on: ubuntu-latest name: "cargo test | without uv" steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: "Install mold" run: ./scripts/install-mold.sh - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 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@cfdb7ed4ccc7c7dce37759eae89dc5674b469b39 # v2.90.3 with: tool: cargo-nextest - name: "Install cargo-llvm-cov" uses: taiki-e/install-action@cfdb7ed4ccc7c7dce37759eae89dc5674b469b39 # v2.90.3 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 no-debug \ --no-report \ -E 'binary_id(prek::run) and test(run_basic)' echo "::endgroup::" # TODO: Restore aliyun once its PyPI mirror has synced uv 0.13.4. for source in github pypi pip invalid; do echo "::group::Test install uv from $source" export PREK_UV_SOURCE=$source cargo llvm-cov nextest \ --profile ci-core \ --cargo-profile no-debug \ --no-report \ -E 'binary_id(prek::run) and test(run_basic)' echo "::endgroup::" done cargo llvm-cov report --profile no-debug --lcov --output-path lcov.info - name: "Upload coverage reports to Codecov" uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1 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 - name: "Install mold" if: ${{ matrix.os == 'ubuntu-latest' }} run: ./scripts/install-mold.sh - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 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@cfdb7ed4ccc7c7dce37759eae89dc5674b469b39 # v2.90.3 with: tool: cargo-nextest - name: "Install cargo-llvm-cov" uses: taiki-e/install-action@cfdb7ed4ccc7c7dce37759eae89dc5674b469b39 # v2.90.3 with: tool: cargo-llvm-cov - name: "Install uv" uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 with: version: ${{ env.UV_VERSION }} - name: "Install Python" uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.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 no-debug \ --profile ci-core \ --features ci,schemars,self-update \ -E "${CI_CORE_FILTER}" - name: "Upload coverage reports to Codecov" uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1 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 }}/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@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 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@cfdb7ed4ccc7c7dce37759eae89dc5674b469b39 # v2.90.3 with: tool: cargo-nextest - name: "Install cargo-llvm-cov" uses: taiki-e/install-action@cfdb7ed4ccc7c7dce37759eae89dc5674b469b39 # v2.90.3 with: tool: cargo-llvm-cov - name: "Install uv" uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 with: version: ${{ env.UV_VERSION }} cache-local-path: ${{ env.DEV_DRIVE }}/uv-cache - name: "Install Python" uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.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 no-debug ` --features ci,schemars,self-update ` --profile ci-core ` -E $env:CI_CORE_FILTER if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - name: "Upload coverage reports to Codecov" uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1 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 - name: "Install mold" run: ./scripts/install-mold.sh # Swift 6.4's default build system cannot identify mold and fails when # parsing `ld -version_details`. This script replaces the system ld, # so skip it for groups that test Swift. if: ${{ matrix.os == 'ubuntu-latest' && !contains(format(' {0} ', matrix.languages), ' swift ') }} - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 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@cfdb7ed4ccc7c7dce37759eae89dc5674b469b39 # v2.90.3 with: tool: cargo-nextest - name: "Install cargo-llvm-cov" uses: taiki-e/install-action@cfdb7ed4ccc7c7dce37759eae89dc5674b469b39 # v2.90.3 with: tool: cargo-llvm-cov - name: "Install cargo-binstall" if: ${{ contains(format(' {0} ', matrix.languages), ' rust ') }} uses: taiki-e/install-action@cfdb7ed4ccc7c7dce37759eae89dc5674b469b39 # v2.90.3 with: tool: cargo-binstall # 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: ./scripts/setup-msvc.ps1 - name: "Install uv" if: ${{ contains(format(' {0} ', matrix.languages), ' python ') }} uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 with: version: ${{ env.UV_VERSION }} - name: "Install Python" if: ${{ contains(format(' {0} ', matrix.languages), ' python ') }} uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 with: python-version: ${{ env.PYTHON_VERSION }} - name: "Install Node.js" if: ${{ contains(format(' {0} ', matrix.languages), ' node ') }} uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.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@b44d12e7d0d8ee7461bb893e1b1993500433185b # v5.2.7 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@32909a2dea0a48c433aec79e7fcd31b4cd55800f # v13.1.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@b3aaceaef7e0ee231b499e7b5f49c03fc1d32199 # v1.338.0 with: ruby-version: ${{ env.RUBY_VERSION }} - name: "Install Swift" if: ${{ runner.os == 'Linux' && contains(format(' {0} ', matrix.languages), ' swift ') }} shell: bash # Some Ubuntu runner images do not include Swift. run: | platform="ubuntu$(lsb_release -rs)" release="swift-${SWIFT_VERSION}-RELEASE" url="https://download.swift.org/swift-${SWIFT_VERSION}-release/${platform//./}/${release}/${release}-${platform}.tar.gz" archive="$RUNNER_TEMP/swift.tar.gz" curl -fsSL --retry 3 "$url" -o "$archive" curl -fsSL --retry 3 "$url.sig" -o "$archive.sig" curl -fsSL --retry 3 --compressed https://www.swift.org/keys/all-keys.asc -o "$RUNNER_TEMP/swift-keys.asc" gpg --batch --import "$RUNNER_TEMP/swift-keys.asc" gpg --batch --verify "$archive.sig" "$archive" mkdir -p "$RUNNER_TEMP/swift" tar xzf "$archive" -C "$RUNNER_TEMP/swift" --strip-components=1 echo "$RUNNER_TEMP/swift/usr/bin" >> "$GITHUB_PATH" "$RUNNER_TEMP/swift/usr/bin/swift" --version - name: "Install PHP and Composer" if: ${{ contains(format(' {0} ', matrix.languages), ' php ') }} uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0 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 Pixi" if: ${{ contains(format(' {0} ', matrix.languages), ' conda ') }} uses: prefix-dev/setup-pixi@9936258fee697aff89b3fed6ca1f80a382ef694e # v0.11.3 with: pixi-version: v0.84.1 run-install: false cache: false - name: "Install Coursier" if: ${{ contains(format(' {0} ', matrix.languages), ' coursier ') }} uses: coursier/setup-action@d5a17f9aaeb260f9ba336a5b582fb49f79c64ac4 # v3.1.0 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@6afc89df92d6eb3834022f73cd65adc8cdfcb92d # v1.8.1 with: sdk: ${{ env.DART_VERSION }} - name: "Install GHC and Cabal" if: ${{ contains(format(' {0} ', matrix.languages), ' haskell ') }} uses: haskell-actions/setup@0f8e8c99d88aeb3fbfd523f1ef2c6f762d10d64d # v2.12.1 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@da908477b5db94c10ffce8cfea9f2b3b9d5db687 # v3.0.3 with: version: ${{ env.JULIA_VERSION }} - name: "Install .NET" if: ${{ contains(format(' {0} ', matrix.languages), ' dotnet ') }} uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0 with: dotnet-version: ${{ env.DOTNET_VERSION }} - name: "Install R" if: ${{ contains(format(' {0} ', matrix.languages), ' r ') }} uses: r-lib/actions/setup-r@f9a764fea8d5c63df6ef9a5c7795bf7deb5d7e05 # v2.14.0 with: r-version: ${{ env.R_VERSION }} use-public-rspm: true # Rtools' link.exe shadows the MSVC linker when Lua shares this job. windows-path-include-rtools: false - name: "Use Strawberry Perl" if: ${{ matrix.os == 'windows-latest' && contains(format(' {0} ', matrix.languages), ' perl ') }} shell: pwsh # Micromamba puts Git's incomplete Perl ahead of Strawberry Perl. run: | "C:\Strawberry\perl\bin" | Out-File -FilePath $env:GITHUB_PATH -Append -Encoding utf8 - 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 }} PREK_CONDA_INSTALLER: micromamba run: | cargo llvm-cov nextest \ --lcov \ --output-path lcov.info \ --workspace \ --cargo-profile no-debug \ --features ci,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 }} PREK_CONDA_INSTALLER: micromamba 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 no-debug ` --features ci,schemars ` --profile ci-language ` -E $env:NEXTEST_FILTER if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - name: "Upload coverage reports to Codecov" uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1 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@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 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 - publish-dev-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 - build-release-binaries - build-docker runs-on: ubuntu-latest 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) }}