1
0
mirror of https://github.com/j178/prek.git synced 2026-04-25 02:11:36 +02:00
Files
renovate[bot] c3b9f115da Update GitHub Actions (major) (#1961)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
|
[actions/upload-pages-artifact](https://redirect.github.com/actions/upload-pages-artifact)
| action | major | `v4` → `v5.0.0` |
|
[julia-actions/setup-julia](https://redirect.github.com/julia-actions/setup-julia)
| action | major | `v2.7.0` → `v3.0.0` |

---

### Release Notes

<details>
<summary>actions/upload-pages-artifact
(actions/upload-pages-artifact)</summary>

###
[`v5.0.0`](https://redirect.github.com/actions/upload-pages-artifact/releases/tag/v5.0.0)

[Compare
Source](https://redirect.github.com/actions/upload-pages-artifact/compare/v4.0.0...v5.0.0)

### Changelog

- Update upload-artifact action to version 7
[@&#8203;Tom-van-Woudenberg](https://redirect.github.com/Tom-van-Woudenberg)
([#&#8203;139](https://redirect.github.com/actions/upload-pages-artifact/issues/139))
- feat: add `include-hidden-files` input
[@&#8203;jonchurch](https://redirect.github.com/jonchurch)
([#&#8203;137](https://redirect.github.com/actions/upload-pages-artifact/issues/137))

See details of [all code
changes](https://redirect.github.com/actions/upload-pages-artifact/compare/v4.0.0...v4.0.1)
since previous release.

</details>

<details>
<summary>julia-actions/setup-julia (julia-actions/setup-julia)</summary>

###
[`v3.0.0`](https://redirect.github.com/julia-actions/setup-julia/releases/tag/v3.0.0)

[Compare
Source](https://redirect.github.com/julia-actions/setup-julia/compare/v2.7.0...v3.0.0)

#### ⚠️ Breaking Changes, and Migration Guide for v2 ⟶ v3

1. v3 requires Node 24 (compared to v2, which required Node 20).
2. The behavior of `version: min` has changed between v2 and v3.
- In v2, `version: min` would resolve to the minimum major/minor/patch,
e.g. 1.10.0.
- In v3, `version: min` resolves to the minimum major/minor but the
latest patch, e.g. 1.10.11.
- If you specifically want the minimum major/minor/patch under v3, you
should specify `version: min-patch`. Note: v3 also adds the alias
`version: min-minor`, which is equivalent to `version: min`.
3. v3 will throw an error if `x86_64` Julia binaries are requested on
Apple Silicon macOS. (Under v2, this was a warning.) Under v3, if you
specifically want to run `x86_64` Julia binaries on Apple Silicon (under
Rosetta 2), you must now opt-in by specifying the `force-arch: true`
input.

#### Other Changes

We updated some dependencies, and we improved and updated the CI tooling
on this repo.

#### Full Changelog

**Full Changelog**:
<https://github.com/julia-actions/setup-julia/compare/v2.7.0...v3.0.0>

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - Between 12:00 AM and 03:59 AM, only on Monday (`* 0-3 * * 1`)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config
help](https://redirect.github.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/j178/prek).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMjMuOCIsInVwZGF0ZWRJblZlciI6IjQzLjEyMy44IiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIiwibGFiZWxzIjpbImludGVybmFsIl19-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-04-20 10:44:44 +08:00

738 lines
26 KiB
YAML

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.11.6"
NODE_VERSION: "20"
BUN_VERSION: "1.3"
GO_VERSION: "1.24"
PYTHON_VERSION: "3.12"
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"
# 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: ${{ !contains(github.event.pull_request.labels.*.name, 'test:skip') && (steps.changed.outputs.any_code_changed == 'true' || github.ref == 'refs/heads/master') }}
save-rust-cache: ${{ github.ref == 'refs/heads/master' || steps.changed.outputs.cache_changed == 'true' }}
# Run benchmarks if Rust code or benchmark-related files changed
run-bench: ${{ !contains(github.event.pull_request.labels.*.name, 'test:skip') && (steps.changed.outputs.rust_code_changed == 'true' || steps.changed.outputs.bench_related_changed == 'true' || github.ref == 'refs/heads/master') }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
persist-credentials: false
- name: "Determine changed files"
id: changed
shell: bash
run: |
CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha || 'origin/master' }}...HEAD)
ANY_CODE_CHANGED=false
CACHE_CHANGED=false
RUST_CODE_CHANGED=false
BENCH_RELATED_CHANGED=false
while IFS= read -r file; do
# Check if cache-relevant files changed (Cargo files, toolchain, workflows)
if [[ "${file}" == "Cargo.lock" || "${file}" == "Cargo.toml" || "${file}" == "rust-toolchain.toml" || "${file}" == ".cargo/config.toml" || "${file}" =~ ^crates/.*/Cargo\.toml$ || "${file}" =~ ^\.github/workflows/.*\.yml$ ]]; then
echo "Detected cache-relevant change: ${file}"
CACHE_CHANGED=true
fi
# Check if Rust code changed (for benchmarks)
if [[ "${file}" =~ \.rs$ ]] || [[ "${file}" =~ Cargo\.toml$ ]] || [[ "${file}" == "Cargo.lock" ]] || [[ "${file}" == "rust-toolchain.toml" ]] || [[ "${file}" =~ ^\.cargo/ ]]; then
echo "Detected Rust code change: ${file}"
RUST_CODE_CHANGED=true
fi
if [[ "${file}" == ".github/workflows/performance.yml" ]] || [[ "${file}" =~ ^scripts/hyperfine-.*\.sh$ ]]; then
echo "Detected benchmark-related change: ${file}"
BENCH_RELATED_CHANGED=true
fi
if [[ "${file}" =~ ^docs/ ]]; then
echo "Skipping ${file} (matches docs/ pattern)"
continue
fi
if [[ "${file}" =~ ^mkdocs.*\.yml$ ]]; then
echo "Skipping ${file} (matches mkdocs*.yml pattern)"
continue
fi
if [[ "${file}" =~ \.md$ ]]; then
echo "Skipping ${file} (matches *.md pattern)"
continue
fi
echo "Detected code change in: ${file}"
ANY_CODE_CHANGED=true
done <<< "${CHANGED_FILES}"
echo "any_code_changed=${ANY_CODE_CHANGED}" >> "${GITHUB_OUTPUT}"
echo "cache_changed=${CACHE_CHANGED}" >> "${GITHUB_OUTPUT}"
echo "rust_code_changed=${RUST_CODE_CHANGED}" >> "${GITHUB_OUTPUT}"
echo "bench_related_changed=${BENCH_RELATED_CHANGED}" >> "${GITHUB_OUTPUT}"
lint:
name: "lint"
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
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@53276d8b0d10f8b6672aa85b4588c6921d0370cc # v2.0.1
env:
PREK_SKIP: cargo-fmt,cargo-clippy
check-release:
name: "check release"
needs: plan
timeout-minutes: 10
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
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.31.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
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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: rui314/setup-mold@725a8794d15fc7563f59595bd9556495c0564878 # v1
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Create Dev Drive
run: ${{ github.workspace }}/.github/workflows/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@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: "Install cargo shear"
uses: taiki-e/install-action@0abfcd587b70a713fdaa7fb502c885e2112acb15 # v2.75.7
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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: rui314/setup-mold@725a8794d15fc7563f59595bd9556495c0564878 # v1
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
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@0abfcd587b70a713fdaa7fb502c885e2112acb15 # v2.75.7
with:
tool: cargo-nextest
- name: "Install cargo-llvm-cov"
uses: taiki-e/install-action@0abfcd587b70a713fdaa7fb502c885e2112acb15 # v2.75.7
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@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: rui314/setup-mold@725a8794d15fc7563f59595bd9556495c0564878 # v1
if: ${{ matrix.os == 'ubuntu-latest' }}
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
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@0abfcd587b70a713fdaa7fb502c885e2112acb15 # v2.75.7
with:
tool: cargo-nextest
- name: "Install cargo-llvm-cov"
uses: taiki-e/install-action@0abfcd587b70a713fdaa7fb502c885e2112acb15 # v2.75.7
with:
tool: cargo-llvm-cov
- name: "Install uv"
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
version: ${{ env.UV_VERSION }}
- name: "Install Python"
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: "Cargo test"
run: |
cargo llvm-cov nextest \
--lcov \
--output-path lcov.info \
--workspace \
--cargo-profile fast-build \
--profile ci-core \
--features schemars
- name: "Upload coverage reports to Codecov"
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Create Dev Drive
run: ${{ github.workspace }}/.github/workflows/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@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
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@0abfcd587b70a713fdaa7fb502c885e2112acb15 # v2.75.7
with:
tool: cargo-nextest
- name: "Install cargo-llvm-cov"
uses: taiki-e/install-action@0abfcd587b70a713fdaa7fb502c885e2112acb15 # v2.75.7
with:
tool: cargo-llvm-cov
- name: "Install uv"
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
version: ${{ env.UV_VERSION }}
cache-local-path: ${{ env.DEV_DRIVE }}/uv-cache
- name: "Install Python"
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # windows only
- name: "Cargo test"
working-directory: ${{ env.PREK_WORKSPACE }}
shell: pwsh
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
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: "Upload coverage reports to Codecov"
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{ env.PREK_WORKSPACE }}/lcov.info
language-tests:
name: "language tests | ${{ matrix.language }} | ${{ matrix.os }}"
needs: plan
if: ${{ needs.plan.outputs.test-code == 'true' }}
timeout-minutes: 15
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
language:
- bun
- deno
- docker
- dotnet
- golang
- haskell
- julia
- lua
- node
- python
- ruby
- rust
- swift
exclude:
# Docker is only available on ubuntu-latest
- os: macos-latest
language: docker
- os: windows-latest
language: docker
# Swift is preinstalled on ubuntu and macOS; Windows requires setup which is slow
- os: windows-latest
language: swift
# GHC is not preinstalled on macOS, and installing it takes a long time
- os: macos-latest
language: haskell
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: rui314/setup-mold@725a8794d15fc7563f59595bd9556495c0564878 # v1
if: ${{ matrix.os == 'ubuntu-latest' }}
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
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@0abfcd587b70a713fdaa7fb502c885e2112acb15 # v2.75.7
with:
tool: cargo-nextest
- name: "Install cargo-llvm-cov"
uses: taiki-e/install-action@0abfcd587b70a713fdaa7fb502c885e2112acb15 # v2.75.7
with:
tool: cargo-llvm-cov
- uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # windows only
if: ${{ matrix.os == 'windows-latest' }}
- name: "Install uv"
if: ${{ matrix.language == 'python' }}
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
version: ${{ env.UV_VERSION }}
- name: "Install Python"
if: ${{ matrix.language == 'python' }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: "Install Node.js"
if: ${{ matrix.language == 'node' }}
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.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: ${{ matrix.language == 'golang' }}
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version: ${{ env.GO_VERSION }}
# Dummy dependency path to satisfy required input while enabling caching
cache-dependency-path: LICENSE
- name: "Install Lua"
if: ${{ matrix.language == 'lua' }}
uses: leafo/gh-actions-lua@8c9e175e7a3d77e21f809eefbee34a19b858641b # v12
with:
luaVersion: ${{ env.LUA_VERSION }}
- name: "Install LuaRocks"
if: ${{ matrix.language == 'lua' }}
uses: luarocks/gh-actions-luarocks@7c85eeff60655651b444126f2a78be784e836a0a #v6
with:
luaRocksVersion: ${{ env.LUAROCKS_VERSION }}
- name: "Install Ruby"
if: ${{ matrix.language == 'ruby' }}
uses: ruby/setup-ruby@4c56a21280b36d862b5fc31348f463d60bdc55d5 # v1.301.0
with:
ruby-version: ${{ env.RUBY_VERSION }}
- name: "Install Bun"
if: ${{ matrix.language == 'bun' }}
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: ${{ env.BUN_VERSION }}
- name: "Install Deno"
if: ${{ matrix.language == 'deno' }}
uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282 # v2.0.4
with:
deno-version: ${{ env.DENO_VERSION }}
- name: "Install GHC and Cabal"
if: ${{ matrix.language == 'haskell' }}
uses: haskell-actions/setup@de26526e12bc780fb9d384c1fb61c0bf02e3a40d # v2.10.4
with:
ghc-version: ${{ env.GHC_VERSION }}
cabal-version: ${{ env.CABAL_VERSION }}
- name: "Install Julia"
if: ${{ matrix.language == 'julia' }}
uses: julia-actions/setup-julia@4a12c5f801ca5ef0458bba44687563ef276522dd # v3.0.0
with:
version: ${{ env.JULIA_VERSION }}
- name: "Install .NET"
if: ${{ matrix.language == 'dotnet' }}
uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5.2.0
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- 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 }}
run: |
cargo llvm-cov nextest \
--lcov \
--output-path lcov.info \
--workspace \
--cargo-profile fast-build \
--features schemars \
--profile lang-${{ matrix.language }}
- name: "Run language tests (windows)"
if: ${{ matrix.os == 'windows-latest' }}
shell: pwsh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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 lang-${{ matrix.language }}
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: "Upload coverage reports to Codecov"
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Checkout python/cpython
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: python/cpython
ref: f3759d21dd5e6510361d7409a1df53f35ebd9a58
path: cpython
fetch-depth: 1
persist-credentials: false
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
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-binary-msrv:
needs: plan
if: ${{ needs.plan.outputs.test-code == 'true' }}
name: "build binary | msrv"
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: "Read MSRV from Cargo.toml"
id: msrv
run: |
MSRV=$(grep -m1 'rust-version' Cargo.toml | sed 's/.*"\([^"]*\)".*/\1/')
echo "value=$MSRV" >> "$GITHUB_OUTPUT"
- name: "Install Rust toolchain"
run: rustup default ${MSRV}
env:
MSRV: ${{ steps.msrv.outputs.value }}
- name: "Install mold"
uses: rui314/setup-mold@725a8794d15fc7563f59595bd9556495c0564878 # v1
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
save-if: ${{ needs.plan.outputs.save-rust-cache == 'true' }}
- run: cargo +${MSRV} build --profile no-debug --bin prek
env:
MSRV: ${{ steps.msrv.outputs.value }}
- run: ./target/no-debug/prek --version
build-binary-linux-libc:
needs: plan
if: ${{ needs.plan.outputs.test-code == 'true' }}
timeout-minutes: 10
runs-on: ubuntu-latest
name: "build binary | linux libc"
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: rui314/setup-mold@725a8794d15fc7563f59595bd9556495c0564878 # v1
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
save-if: ${{ needs.plan.outputs.save-rust-cache == 'true' }}
- name: "Build"
run: cargo build --profile no-debug --bin prek
- name: "Upload binary"
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: prek-linux-libc-${{ github.sha }}
path: |
./target/no-debug/prek
retention-days: 1
build-binary-macos-aarch64:
needs: plan
if: ${{ needs.plan.outputs.test-code == 'true' }}
timeout-minutes: 10
runs-on: macos-latest
name: "build binary | macos aarch64"
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
save-if: ${{ needs.plan.outputs.save-rust-cache == 'true' }}
- name: "Build"
run: cargo build --profile no-debug --bin prek
- name: "Upload binary"
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: prek-macos-aarch64-${{ github.sha }}
path: |
./target/no-debug/prek
retention-days: 1
build-binary-windows-x86_64:
needs: plan
if: ${{ needs.plan.outputs.test-code == 'true' }}
timeout-minutes: 10
runs-on: windows-latest
name: "build binary | windows x86_64"
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup Dev Drive
run: ${{ github.workspace }}/.github/workflows/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@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
workspaces: ${{ env.PREK_WORKSPACE }}
save-if: ${{ needs.plan.outputs.save-rust-cache == 'true' }}
- name: "Build"
working-directory: ${{ env.PREK_WORKSPACE }}
run: cargo build --profile no-debug --bin prek
- name: "Upload binary"
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: prek-windows-x86_64-${{ github.sha }}
path: |
${{ env.PREK_WORKSPACE }}/target/no-debug/prek.exe
retention-days: 1