mirror of
https://github.com/j178/prek.git
synced 2026-04-03 17:34:03 +02:00
723 lines
25 KiB
YAML
723 lines
25 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.9.26"
|
|
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"
|
|
# 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 only if Rust code changed
|
|
run-bench: ${{ !contains(github.event.pull_request.labels.*.name, 'test:skip') && (steps.changed.outputs.rust_code_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
|
|
|
|
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}" =~ ^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}"
|
|
|
|
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@9d6a3097e0c1865ecce00cfb89fe80f2ee91b547 # v1.0.12
|
|
env:
|
|
PREK_SKIP: cargo-fmt,cargo-clippy
|
|
|
|
check-release:
|
|
name: "check release"
|
|
needs: plan
|
|
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.30.3/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@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.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@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@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
persist-credentials: false
|
|
- name: "Install cargo shear"
|
|
uses: taiki-e/install-action@542cebaaed782771e619bd5609d97659d109c492 # v2.66.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@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.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@542cebaaed782771e619bd5609d97659d109c492 # v2.66.7
|
|
with:
|
|
tool: cargo-nextest
|
|
|
|
- name: "Install cargo-llvm-cov"
|
|
uses: taiki-e/install-action@542cebaaed782771e619bd5609d97659d109c492 # v2.66.7
|
|
with:
|
|
tool: cargo-llvm-cov
|
|
|
|
- name: "Cargo test without uv"
|
|
run: |
|
|
echo "::group::Test install uv with auto select"
|
|
cargo llvm-cov nextest \
|
|
--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 \
|
|
--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@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
files: lcov.info
|
|
|
|
cargo-test-linux:
|
|
needs: plan
|
|
if: ${{ needs.plan.outputs.test-code == 'true' }}
|
|
timeout-minutes: 5
|
|
runs-on: ubuntu-latest
|
|
name: "cargo test | ubuntu"
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
persist-credentials: false
|
|
- uses: rui314/setup-mold@725a8794d15fc7563f59595bd9556495c0564878 # v1
|
|
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.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@542cebaaed782771e619bd5609d97659d109c492 # v2.66.7
|
|
with:
|
|
tool: cargo-nextest
|
|
|
|
- name: "Install cargo-llvm-cov"
|
|
uses: taiki-e/install-action@542cebaaed782771e619bd5609d97659d109c492 # v2.66.7
|
|
with:
|
|
tool: cargo-llvm-cov
|
|
|
|
- name: "Install uv"
|
|
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
|
|
with:
|
|
version: ${{ env.UV_VERSION }}
|
|
|
|
- name: "Install Python"
|
|
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
|
|
with:
|
|
python-version: ${{ env.PYTHON_VERSION }}
|
|
|
|
- name: "Install Node.js"
|
|
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
cache: npm
|
|
# A dummy dependency path to enable caching of go modules.
|
|
cache-dependency-path: LICENSE
|
|
|
|
- name: "Install Go"
|
|
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
# A dummy dependency path to enable caching of go modules.
|
|
cache-dependency-path: LICENSE
|
|
|
|
- name: "Install Lua"
|
|
uses: leafo/gh-actions-lua@8c9e175e7a3d77e21f809eefbee34a19b858641b # v12
|
|
with:
|
|
luaVersion: ${{ env.LUA_VERSION }}
|
|
|
|
- name: "Install LuaRocks"
|
|
uses: luarocks/gh-actions-luarocks@7c85eeff60655651b444126f2a78be784e836a0a #v6
|
|
with:
|
|
luaRocksVersion: ${{ env.LUAROCKS_VERSION }}
|
|
|
|
- name: "Install Ruby"
|
|
uses: ruby/setup-ruby@80740b3b13bf9857e28854481ca95a84e78a2bdf # v1.284.0
|
|
with:
|
|
ruby-version: ${{ env.RUBY_VERSION }}
|
|
|
|
- name: "Install Bun"
|
|
uses: oven-sh/setup-bun@3d267786b128fe76c2f16a390aa2448b815359f3 # v2.1.2
|
|
with:
|
|
bun-version: ${{ env.BUN_VERSION }}
|
|
|
|
- name: "Cargo test"
|
|
run: |
|
|
cargo llvm-cov nextest \
|
|
--no-report \
|
|
--workspace \
|
|
--cargo-profile fast-build \
|
|
--features schemars \
|
|
--status-level skip \
|
|
--failure-output immediate \
|
|
--no-fail-fast \
|
|
-j 8 \
|
|
--final-status-level slow
|
|
|
|
cargo llvm-cov report --profile fast-build --lcov --output-path lcov.info
|
|
|
|
- name: "Upload coverage reports to Codecov"
|
|
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
files: lcov.info
|
|
|
|
cargo-test-macos:
|
|
needs: plan
|
|
if: ${{ needs.plan.outputs.test-code == 'true' }}
|
|
runs-on: macos-latest
|
|
name: "cargo test | macos"
|
|
timeout-minutes: 10
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
persist-credentials: false
|
|
- uses: rui314/setup-mold@725a8794d15fc7563f59595bd9556495c0564878 # v1
|
|
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
|
|
with:
|
|
save-if: ${{ needs.plan.outputs.save-rust-cache == 'true' }}
|
|
|
|
- name: "Install Rust toolchain"
|
|
run: rustup show
|
|
|
|
- name: "Install cargo nextest"
|
|
uses: taiki-e/install-action@542cebaaed782771e619bd5609d97659d109c492 # v2.66.7
|
|
with:
|
|
tool: cargo-nextest
|
|
|
|
- name: "Install uv"
|
|
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
|
|
with:
|
|
version: ${{ env.UV_VERSION }}
|
|
|
|
- name: "Install Python"
|
|
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
|
|
with:
|
|
python-version: ${{ env.PYTHON_VERSION }}
|
|
|
|
- name: "Install Node.js"
|
|
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
cache: npm
|
|
# A dummy dependency path to enable caching of go modules.
|
|
cache-dependency-path: LICENSE
|
|
|
|
- name: "Install Go"
|
|
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
# A dummy dependency path to enable caching of go modules.
|
|
cache-dependency-path: LICENSE
|
|
|
|
- name: "Install Lua"
|
|
uses: leafo/gh-actions-lua@8c9e175e7a3d77e21f809eefbee34a19b858641b # v12
|
|
with:
|
|
luaVersion: ${{ env.LUA_VERSION }}
|
|
|
|
- name: "Install LuaRocks"
|
|
uses: luarocks/gh-actions-luarocks@7c85eeff60655651b444126f2a78be784e836a0a #v6
|
|
with:
|
|
luaRocksVersion: ${{ env.LUAROCKS_VERSION }}
|
|
|
|
- name: "Install Ruby"
|
|
uses: ruby/setup-ruby@80740b3b13bf9857e28854481ca95a84e78a2bdf # v1.284.0
|
|
with:
|
|
ruby-version: ${{ env.RUBY_VERSION }}
|
|
|
|
- name: "Install Bun"
|
|
uses: oven-sh/setup-bun@3d267786b128fe76c2f16a390aa2448b815359f3 # v2.1.2
|
|
with:
|
|
bun-version: ${{ env.BUN_VERSION }}
|
|
|
|
- name: "Cargo test"
|
|
run: |
|
|
cargo nextest run \
|
|
--workspace \
|
|
--cargo-profile fast-build \
|
|
--features schemars \
|
|
--status-level skip \
|
|
--failure-output immediate \
|
|
--no-fail-fast \
|
|
-j 8 \
|
|
--final-status-level slow
|
|
|
|
build-windows-artifact:
|
|
needs: plan
|
|
if: ${{ needs.plan.outputs.test-code == 'true' }}
|
|
name: "build tests archive | windows"
|
|
timeout-minutes: 10
|
|
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@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.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@542cebaaed782771e619bd5609d97659d109c492 # v2.66.7
|
|
with:
|
|
tool: cargo-nextest
|
|
|
|
- name: "Install cargo-llvm-cov"
|
|
uses: taiki-e/install-action@542cebaaed782771e619bd5609d97659d109c492 # v2.66.7
|
|
with:
|
|
tool: cargo-llvm-cov
|
|
|
|
- name: Build and archive tests
|
|
working-directory: ${{ env.PREK_WORKSPACE }}
|
|
shell: pwsh
|
|
run: |
|
|
cargo llvm-cov nextest-archive `
|
|
--no-report `
|
|
--workspace `
|
|
--features schemars `
|
|
--cargo-profile fast-build `
|
|
--archive-file nextest-archive.tar.zst
|
|
|
|
- name: Upload archive to workflow
|
|
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
|
|
with:
|
|
name: nextest-archive
|
|
path: ${{ env.PREK_WORKSPACE }}/nextest-archive.tar.zst
|
|
|
|
cargo-test-windows:
|
|
name: "cargo test | windows ${{ matrix.partition }}/3"
|
|
needs: build-windows-artifact
|
|
runs-on: windows-latest
|
|
timeout-minutes: 15
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
partition: [1, 2, 3]
|
|
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
|
|
|
|
- name: "Install Rust toolchain"
|
|
run: rustup component add llvm-tools-preview
|
|
|
|
- name: "Install cargo nextest"
|
|
uses: taiki-e/install-action@542cebaaed782771e619bd5609d97659d109c492 # v2.66.7
|
|
with:
|
|
tool: cargo-nextest
|
|
|
|
- name: "Install cargo-llvm-cov"
|
|
uses: taiki-e/install-action@542cebaaed782771e619bd5609d97659d109c492 # v2.66.7
|
|
with:
|
|
tool: cargo-llvm-cov
|
|
|
|
- name: Download tests archive
|
|
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
|
|
with:
|
|
name: nextest-archive
|
|
# `path` must be a directory. If you set it to a file path, download-artifact
|
|
# creates a directory with that name, and nextest later fails to read it.
|
|
path: ${{ env.PREK_WORKSPACE }}
|
|
|
|
- name: "Install uv"
|
|
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
|
|
with:
|
|
version: ${{ env.UV_VERSION }}
|
|
cache-local-path: ${{ env.DEV_DRIVE }}/uv-cache
|
|
|
|
- name: "Install Python"
|
|
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
|
|
with:
|
|
python-version: ${{ env.PYTHON_VERSION }}
|
|
|
|
- name: "Install Node.js"
|
|
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
cache: npm
|
|
# A dummy dependency path to enable caching of go modules.
|
|
cache-dependency-path: LICENSE
|
|
|
|
- name: "Install Go"
|
|
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
# A dummy dependency path to enable caching of go modules.
|
|
cache-dependency-path: LICENSE
|
|
|
|
- uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # windows only
|
|
|
|
- name: "Install Lua"
|
|
# luarocks/gh-actions-lua doesn't cache the built lua, use `leafo/gh-actions-lua` instead.
|
|
uses: leafo/gh-actions-lua@8c9e175e7a3d77e21f809eefbee34a19b858641b # v12
|
|
with:
|
|
luaVersion: ${{ env.LUA_VERSION }}
|
|
|
|
- name: "Install LuaRocks"
|
|
# `leafo/gh-actions-lua` doesn't support windows, so we have to use `luarocks/gh-actions-luarocks`.
|
|
uses: luarocks/gh-actions-luarocks@7c85eeff60655651b444126f2a78be784e836a0a #v6
|
|
with:
|
|
luaRocksVersion: ${{ env.LUAROCKS_VERSION }}
|
|
|
|
- name: "Install Ruby"
|
|
uses: ruby/setup-ruby@80740b3b13bf9857e28854481ca95a84e78a2bdf # v1.284.0
|
|
with:
|
|
ruby-version: ${{ env.RUBY_VERSION }}
|
|
|
|
- name: "Install Bun"
|
|
uses: oven-sh/setup-bun@3d267786b128fe76c2f16a390aa2448b815359f3 # v2.1.2
|
|
with:
|
|
bun-version: ${{ env.BUN_VERSION }}
|
|
|
|
- name: "Cargo test"
|
|
working-directory: ${{ env.PREK_WORKSPACE }}
|
|
run: |
|
|
# Remove msys64 from PATH for Rust compilation
|
|
$env:PATH = ($env:PATH -split ';' | Where-Object { $_ -notmatch '\\msys64\\' }) -join ';'
|
|
|
|
cargo llvm-cov nextest `
|
|
--color always `
|
|
--lcov `
|
|
--output-path lcov.info `
|
|
--partition hash:${{ matrix.partition }}/3 `
|
|
--archive-file nextest-archive.tar.zst `
|
|
--status-level skip `
|
|
--failure-output immediate `
|
|
--no-fail-fast `
|
|
-j 8 `
|
|
--final-status-level slow `
|
|
-E 'not test(swift::)'
|
|
|
|
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
|
shell: pwsh
|
|
|
|
- name: "Upload coverage reports to Codecov"
|
|
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
files: lcov.info
|
|
|
|
performance:
|
|
needs: plan
|
|
if: ${{ needs.plan.outputs.test-code == 'true' }}
|
|
uses: ./.github/workflows/performance.yml
|
|
with:
|
|
save-rust-cache: ${{ needs.plan.outputs.save-rust-cache }}
|
|
|
|
ecosystem-cpython:
|
|
name: "ecosystem | cpython"
|
|
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@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.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-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@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
|
|
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@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
|
|
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: rui314/setup-mold@725a8794d15fc7563f59595bd9556495c0564878 # v1
|
|
|
|
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
|
|
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@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
|
|
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@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
|
|
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@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
|
|
with:
|
|
name: prek-windows-x86_64-${{ github.sha }}
|
|
path: |
|
|
${{ env.PREK_WORKSPACE }}/target/no-debug/prek.exe
|
|
retention-days: 1
|