Skip to content

Commit de8f05c

Browse files
committed
Auto merge of rust-lang#3696 - RalfJung:ci, r=oli-obk
CI: try to share setup code across actions
2 parents 4be2c66 + eaacf00 commit de8f05c

File tree

2 files changed

+54
-85
lines changed

2 files changed

+54
-85
lines changed

src/tools/miri/.github/workflows/ci.yml

Lines changed: 2 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -33,50 +33,7 @@ jobs:
3333
HOST_TARGET: ${{ matrix.host_target }}
3434
steps:
3535
- uses: actions/checkout@v4
36-
37-
- name: Show Rust version (stable toolchain)
38-
run: |
39-
rustup show
40-
rustc -Vv
41-
cargo -V
42-
43-
# Cache the global cargo directory, but NOT the local `target` directory which
44-
# we cannot reuse anyway when the nightly changes (and it grows quite large
45-
# over time).
46-
- name: Add cache for cargo
47-
id: cache
48-
uses: actions/cache@v4
49-
with:
50-
path: |
51-
# Taken from <https://doc.rust-lang.org/nightly/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci>.
52-
# Cache package/registry information
53-
~/.cargo/registry/index
54-
~/.cargo/registry/cache
55-
~/.cargo/git/db
56-
# Cache installed binaries
57-
~/.cargo/bin
58-
~/.cargo/.crates.toml
59-
~/.cargo/.crates2.json
60-
key: cargo-${{ runner.os }}-reset20240425-${{ hashFiles('**/Cargo.lock') }}
61-
restore-keys: cargo-${{ runner.os }}-reset20240425
62-
63-
- name: Install tools
64-
if: steps.cache.outputs.cache-hit != 'true'
65-
run: cargo install -f rustup-toolchain-install-master hyperfine
66-
67-
- name: Install miri toolchain
68-
run: |
69-
if [[ ${{ github.event_name }} == 'schedule' ]]; then
70-
echo "Building against latest rustc git version"
71-
git ls-remote https://github.com/rust-lang/rust/ HEAD | cut -f 1 > rust-version
72-
fi
73-
./miri toolchain --host ${{ matrix.host_target }}
74-
75-
- name: Show Rust version (miri toolchain)
76-
run: |
77-
rustup show
78-
rustc -Vv
79-
cargo -V
36+
- uses: ./.github/workflows/setup
8037

8138
# The `style` job only runs on Linux; this makes sure the Windows-host-specific
8239
# code is also covered by clippy.
@@ -92,47 +49,7 @@ jobs:
9249
runs-on: ubuntu-latest
9350
steps:
9451
- uses: actions/checkout@v4
95-
96-
# This is exactly duplicated from above. GHA is pretty terrible when it comes
97-
# to avoiding code duplication.
98-
99-
# Cache the global cargo directory, but NOT the local `target` directory which
100-
# we cannot reuse anyway when the nightly changes (and it grows quite large
101-
# over time).
102-
- name: Add cache for cargo
103-
id: cache
104-
uses: actions/cache@v4
105-
with:
106-
path: |
107-
# Taken from <https://doc.rust-lang.org/nightly/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci>.
108-
# Cache package/registry information
109-
~/.cargo/registry/index
110-
~/.cargo/registry/cache
111-
~/.cargo/git/db
112-
# Cache installed binaries
113-
~/.cargo/bin
114-
~/.cargo/.crates.toml
115-
~/.cargo/.crates2.json
116-
key: cargo-${{ runner.os }}-reset20240331-${{ hashFiles('**/Cargo.lock') }}
117-
restore-keys: cargo-${{ runner.os }}-reset20240331
118-
119-
- name: Install rustup-toolchain-install-master
120-
if: steps.cache.outputs.cache-hit != 'true'
121-
run: cargo install -f rustup-toolchain-install-master
122-
123-
- name: Install "master" toolchain
124-
run: |
125-
if [[ ${{ github.event_name }} == 'schedule' ]]; then
126-
echo "Building against latest rustc git version"
127-
git ls-remote https://github.com/rust-lang/rust/ HEAD | cut -f 1 > rust-version
128-
fi
129-
./miri toolchain
130-
131-
- name: Show Rust version
132-
run: |
133-
rustup show
134-
rustc -Vv
135-
cargo -V
52+
- uses: ./.github/workflows/setup
13653

13754
- name: rustfmt
13855
run: ./miri fmt --check
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: "Miri CI setup"
2+
description: "Sets up Miri CI"
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Show Rust version (stable toolchain)
7+
run: |
8+
rustup show
9+
rustc -Vv
10+
cargo -V
11+
shell: bash
12+
13+
# Cache the global cargo directory, but NOT the local `target` directory which
14+
# we cannot reuse anyway when the nightly changes (and it grows quite large
15+
# over time).
16+
- name: Add cache for cargo
17+
id: cache
18+
uses: actions/cache@v4
19+
with:
20+
path: |
21+
# Taken from <https://doc.rust-lang.org/nightly/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci>.
22+
# Cache package/registry information
23+
~/.cargo/registry/index
24+
~/.cargo/registry/cache
25+
~/.cargo/git/db
26+
# Cache installed binaries
27+
~/.cargo/bin
28+
~/.cargo/.crates.toml
29+
~/.cargo/.crates2.json
30+
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock', '.github/workflows/**/*.yml') }}
31+
restore-keys: cargo-${{ runner.os }}
32+
33+
- name: Install rustup-toolchain-install-master
34+
if: steps.cache.outputs.cache-hit != 'true'
35+
run: cargo install -f rustup-toolchain-install-master hyperfine
36+
shell: bash
37+
38+
- name: Install "master" toolchain
39+
run: |
40+
if [[ ${{ github.event_name }} == 'schedule' ]]; then
41+
echo "Building against latest rustc git version"
42+
git ls-remote https://github.com/rust-lang/rust/ HEAD | cut -f 1 > rust-version
43+
fi
44+
./miri toolchain
45+
shell: bash
46+
47+
- name: Show Rust version (miri toolchain)
48+
run: |
49+
rustup show
50+
rustc -Vv
51+
cargo -V
52+
shell: bash

0 commit comments

Comments
 (0)