Auto merge of #3696 - RalfJung:ci, r=oli-obk
CI: try to share setup code across actions
This commit is contained in:
commit
de8f05c9e7
2 changed files with 54 additions and 85 deletions
87
src/tools/miri/.github/workflows/ci.yml
vendored
87
src/tools/miri/.github/workflows/ci.yml
vendored
|
|
@ -33,50 +33,7 @@ jobs:
|
|||
HOST_TARGET: ${{ matrix.host_target }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Show Rust version (stable toolchain)
|
||||
run: |
|
||||
rustup show
|
||||
rustc -Vv
|
||||
cargo -V
|
||||
|
||||
# Cache the global cargo directory, but NOT the local `target` directory which
|
||||
# we cannot reuse anyway when the nightly changes (and it grows quite large
|
||||
# over time).
|
||||
- name: Add cache for cargo
|
||||
id: cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
# Taken from <https://doc.rust-lang.org/nightly/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci>.
|
||||
# Cache package/registry information
|
||||
~/.cargo/registry/index
|
||||
~/.cargo/registry/cache
|
||||
~/.cargo/git/db
|
||||
# Cache installed binaries
|
||||
~/.cargo/bin
|
||||
~/.cargo/.crates.toml
|
||||
~/.cargo/.crates2.json
|
||||
key: cargo-${{ runner.os }}-reset20240425-${{ hashFiles('**/Cargo.lock') }}
|
||||
restore-keys: cargo-${{ runner.os }}-reset20240425
|
||||
|
||||
- name: Install tools
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: cargo install -f rustup-toolchain-install-master hyperfine
|
||||
|
||||
- name: Install miri toolchain
|
||||
run: |
|
||||
if [[ ${{ github.event_name }} == 'schedule' ]]; then
|
||||
echo "Building against latest rustc git version"
|
||||
git ls-remote https://github.com/rust-lang/rust/ HEAD | cut -f 1 > rust-version
|
||||
fi
|
||||
./miri toolchain --host ${{ matrix.host_target }}
|
||||
|
||||
- name: Show Rust version (miri toolchain)
|
||||
run: |
|
||||
rustup show
|
||||
rustc -Vv
|
||||
cargo -V
|
||||
- uses: ./.github/workflows/setup
|
||||
|
||||
# The `style` job only runs on Linux; this makes sure the Windows-host-specific
|
||||
# code is also covered by clippy.
|
||||
|
|
@ -92,47 +49,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# This is exactly duplicated from above. GHA is pretty terrible when it comes
|
||||
# to avoiding code duplication.
|
||||
|
||||
# Cache the global cargo directory, but NOT the local `target` directory which
|
||||
# we cannot reuse anyway when the nightly changes (and it grows quite large
|
||||
# over time).
|
||||
- name: Add cache for cargo
|
||||
id: cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
# Taken from <https://doc.rust-lang.org/nightly/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci>.
|
||||
# Cache package/registry information
|
||||
~/.cargo/registry/index
|
||||
~/.cargo/registry/cache
|
||||
~/.cargo/git/db
|
||||
# Cache installed binaries
|
||||
~/.cargo/bin
|
||||
~/.cargo/.crates.toml
|
||||
~/.cargo/.crates2.json
|
||||
key: cargo-${{ runner.os }}-reset20240331-${{ hashFiles('**/Cargo.lock') }}
|
||||
restore-keys: cargo-${{ runner.os }}-reset20240331
|
||||
|
||||
- name: Install rustup-toolchain-install-master
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: cargo install -f rustup-toolchain-install-master
|
||||
|
||||
- name: Install "master" toolchain
|
||||
run: |
|
||||
if [[ ${{ github.event_name }} == 'schedule' ]]; then
|
||||
echo "Building against latest rustc git version"
|
||||
git ls-remote https://github.com/rust-lang/rust/ HEAD | cut -f 1 > rust-version
|
||||
fi
|
||||
./miri toolchain
|
||||
|
||||
- name: Show Rust version
|
||||
run: |
|
||||
rustup show
|
||||
rustc -Vv
|
||||
cargo -V
|
||||
- uses: ./.github/workflows/setup
|
||||
|
||||
- name: rustfmt
|
||||
run: ./miri fmt --check
|
||||
|
|
|
|||
52
src/tools/miri/.github/workflows/setup/action.yml
vendored
Normal file
52
src/tools/miri/.github/workflows/setup/action.yml
vendored
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
name: "Miri CI setup"
|
||||
description: "Sets up Miri CI"
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Show Rust version (stable toolchain)
|
||||
run: |
|
||||
rustup show
|
||||
rustc -Vv
|
||||
cargo -V
|
||||
shell: bash
|
||||
|
||||
# Cache the global cargo directory, but NOT the local `target` directory which
|
||||
# we cannot reuse anyway when the nightly changes (and it grows quite large
|
||||
# over time).
|
||||
- name: Add cache for cargo
|
||||
id: cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
# Taken from <https://doc.rust-lang.org/nightly/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci>.
|
||||
# Cache package/registry information
|
||||
~/.cargo/registry/index
|
||||
~/.cargo/registry/cache
|
||||
~/.cargo/git/db
|
||||
# Cache installed binaries
|
||||
~/.cargo/bin
|
||||
~/.cargo/.crates.toml
|
||||
~/.cargo/.crates2.json
|
||||
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock', '.github/workflows/**/*.yml') }}
|
||||
restore-keys: cargo-${{ runner.os }}
|
||||
|
||||
- name: Install rustup-toolchain-install-master
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: cargo install -f rustup-toolchain-install-master hyperfine
|
||||
shell: bash
|
||||
|
||||
- name: Install "master" toolchain
|
||||
run: |
|
||||
if [[ ${{ github.event_name }} == 'schedule' ]]; then
|
||||
echo "Building against latest rustc git version"
|
||||
git ls-remote https://github.com/rust-lang/rust/ HEAD | cut -f 1 > rust-version
|
||||
fi
|
||||
./miri toolchain
|
||||
shell: bash
|
||||
|
||||
- name: Show Rust version (miri toolchain)
|
||||
run: |
|
||||
rustup show
|
||||
rustc -Vv
|
||||
cargo -V
|
||||
shell: bash
|
||||
Loading…
Add table
Add a link
Reference in a new issue