mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-24 22:30:03 +00:00
Speedup CI (#842)
- Remove `tools: cross` input to `actions/just-setup` since we use `cargo-zigbuild` for cross compiling instead of `cross-rs` now. - Only install `cargo-zigbuild` in `just ci-install-deps` if `JUST_USE_CARGO_ZIGBUILD` is enabled - Include hash of `rustc -vV` in `build-cache` Switching between different versions of `rustc` will cause all crates to be rebuilt using new `rustc`. - Replace input `cache` with `index-cache` and `build-cache` in `actions/just-setup` for better control of caching behavior - Reuse workflow `test`'s `build-cache` in workflow `lint` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
599bcaf333
commit
c8b92b1985
4 changed files with 30 additions and 13 deletions
23
.github/actions/just-setup/action.yml
vendored
23
.github/actions/just-setup/action.yml
vendored
|
@ -4,8 +4,13 @@ inputs:
|
||||||
description: Extra tools
|
description: Extra tools
|
||||||
required: false
|
required: false
|
||||||
default: ""
|
default: ""
|
||||||
cache:
|
index-cache:
|
||||||
description: Enable caches
|
description: Enable index cache
|
||||||
|
required: true
|
||||||
|
default: true
|
||||||
|
type: boolean
|
||||||
|
build-cache:
|
||||||
|
description: Enable build cache
|
||||||
required: true
|
required: true
|
||||||
default: true
|
default: true
|
||||||
type: boolean
|
type: boolean
|
||||||
|
@ -27,7 +32,7 @@ runs:
|
||||||
with:
|
with:
|
||||||
tool: just,${{ inputs.tools }}
|
tool: just,${{ inputs.tools }}
|
||||||
|
|
||||||
- if: inputs.cache
|
- if: inputs.index-cache
|
||||||
name: Configure index cache
|
name: Configure index cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
|
@ -40,10 +45,18 @@ runs:
|
||||||
${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}-
|
${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}-
|
||||||
${{ runner.os }}-cargo-index-
|
${{ runner.os }}-cargo-index-
|
||||||
|
|
||||||
- if: inputs.cache
|
- name: Install rust toolchains
|
||||||
|
run: just toolchain
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: rustc version
|
||||||
|
run: rustc -vV | tee /tmp/rustc-version
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- if: inputs.build-cache
|
||||||
name: Configure build cache
|
name: Configure build cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
target/
|
target/
|
||||||
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ inputs.cache-suffix }}
|
key: ${{ runner.os }}-cargo-build-${{ hashFiles('/tmp/rustc-version') }}-${{ hashFiles('**/Cargo.lock') }}-${{ inputs.cache-suffix }}
|
||||||
|
|
14
.github/workflows/ci.yml
vendored
14
.github/workflows/ci.yml
vendored
|
@ -53,7 +53,6 @@ jobs:
|
||||||
with:
|
with:
|
||||||
cache-suffix: ${{ env.CARGO_BUILD_TARGET }}
|
cache-suffix: ${{ env.CARGO_BUILD_TARGET }}
|
||||||
|
|
||||||
- run: just toolchain
|
|
||||||
- run: just ci-install-deps
|
- run: just ci-install-deps
|
||||||
- run: just test
|
- run: just test
|
||||||
env:
|
env:
|
||||||
|
@ -78,10 +77,8 @@ jobs:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: ./.github/actions/just-setup
|
- uses: ./.github/actions/just-setup
|
||||||
with:
|
with:
|
||||||
tools: cross
|
|
||||||
cache-suffix: ${{ env.CARGO_BUILD_TARGET }}
|
cache-suffix: ${{ env.CARGO_BUILD_TARGET }}
|
||||||
|
|
||||||
- run: just toolchain
|
|
||||||
- run: just ci-install-deps
|
- run: just ci-install-deps
|
||||||
- run: just check
|
- run: just check
|
||||||
|
|
||||||
|
@ -96,19 +93,26 @@ jobs:
|
||||||
with:
|
with:
|
||||||
cache-suffix: ${{ env.CARGO_BUILD_TARGET }}
|
cache-suffix: ${{ env.CARGO_BUILD_TARGET }}
|
||||||
|
|
||||||
- run: just toolchain
|
|
||||||
- run: just check
|
- run: just check
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
include:
|
||||||
|
- target: x86_64-apple-darwin
|
||||||
|
os: macos-latest
|
||||||
|
- target: x86_64-unknown-linux-gnu
|
||||||
|
os: ubuntu-latest
|
||||||
|
- target: x86_64-pc-windows-msvc
|
||||||
|
os: windows-latest
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: ./.github/actions/just-setup
|
- uses: ./.github/actions/just-setup
|
||||||
|
with:
|
||||||
|
cache-suffix: ${{ matrix.target }}
|
||||||
|
|
||||||
- run: just toolchain rustfmt,clippy
|
- run: just toolchain rustfmt,clippy
|
||||||
- run: just ci-install-deps
|
- run: just ci-install-deps
|
||||||
|
|
4
.github/workflows/release-build.yml
vendored
4
.github/workflows/release-build.yml
vendored
|
@ -42,7 +42,6 @@ jobs:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: ./.github/actions/just-setup
|
- uses: ./.github/actions/just-setup
|
||||||
with:
|
with:
|
||||||
tools: cross
|
|
||||||
cache-suffix: release-${{ matrix.t }}
|
cache-suffix: release-${{ matrix.t }}
|
||||||
|
|
||||||
- run: just toolchain rust-src
|
- run: just toolchain rust-src
|
||||||
|
@ -87,7 +86,8 @@ jobs:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: ./.github/actions/just-setup
|
- uses: ./.github/actions/just-setup
|
||||||
with:
|
with:
|
||||||
cache: false
|
index-cache: false
|
||||||
|
build-cache: false
|
||||||
|
|
||||||
- uses: actions/download-artifact@v3
|
- uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
|
|
2
justfile
2
justfile
|
@ -151,7 +151,7 @@ ci-apt-deps := if target == "x86_64-unknown-linux-gnu" { "liblzma-dev libzip-dev
|
||||||
[linux]
|
[linux]
|
||||||
ci-install-deps:
|
ci-install-deps:
|
||||||
if [ -n "{{ci-apt-deps}}" ]; then sudo apt update && sudo apt install -y --no-install-recommends {{ci-apt-deps}}; fi
|
if [ -n "{{ci-apt-deps}}" ]; then sudo apt update && sudo apt install -y --no-install-recommends {{ci-apt-deps}}; fi
|
||||||
pip3 install cargo-zigbuild
|
if [ -n "{{use-cargo-zigbuild}}" ]; then pip3 install cargo-zigbuild; fi
|
||||||
|
|
||||||
[macos]
|
[macos]
|
||||||
[windows]
|
[windows]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue