fork/cargo

git clone https://git.julia.blue/fork/cargo

Eric Husschore(deps): update actions/checkout action to v5 (#16031)5b48cf2aa

0.93.0
10.6 KiB306 linesraw
1name: CI
2on:
3  merge_group:
4  pull_request:
5    branches:
6      - "**"
7
8defaults:
9  run:
10    shell: bash
11
12permissions:
13  contents: read
14
15concurrency:
16  group: "${{ github.workflow }}-${{ github.ref }}"
17  cancel-in-progress: true
18
19jobs:
20  conclusion:
21    needs:
22      - build_std
23      - clippy
24      - msrv
25      - docs
26      - lint-docs
27      - lockfile
28      - resolver
29      - rustfmt
30      - schema
31      - test
32      - test_gitoxide
33    permissions:
34      contents: none
35    # We need to ensure this job does *not* get skipped if its dependencies fail,
36    # because a skipped job is considered a success by GitHub. So we have to
37    # overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run
38    # when the workflow is canceled manually.
39    #
40    # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
41    if: ${{ !cancelled() }}
42    runs-on: ubuntu-latest
43    steps:
44      # Manually check the status of all dependencies. `if: failure()` does not work.
45      - name: Conclusion
46        run: |
47          # Print the dependent jobs to see them in the CI log
48          jq -C <<< '${{ toJson(needs) }}'
49          # Check if all jobs that we depend on (in the needs array) were successful.
50          jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
51
52  # Check Code style quickly by running `rustfmt` over all code
53  rustfmt:
54    runs-on: ubuntu-latest
55    steps:
56    - uses: actions/checkout@v5
57    - run: rustup update stable && rustup default stable
58    - run: rustup component add rustfmt
59    - run: cargo fmt --all --check
60
61  # Ensure there are no clippy warnings
62  clippy:
63    runs-on: ubuntu-latest
64    steps:
65      - uses: actions/checkout@v5
66      - run: rustup update stable && rustup default stable
67      - run: rustup component add clippy
68      - run: cargo clippy --workspace --all-targets --no-deps -- -D warnings
69
70  stale-label:
71    runs-on: ubuntu-latest
72    steps:
73      - uses: actions/checkout@v5
74      - run: rustup update stable && rustup default stable
75      - run: cargo stale-label
76
77  lint-docs:
78    runs-on: ubuntu-latest
79    steps:
80      - uses: actions/checkout@v5
81      - run: rustup update stable && rustup default stable
82      - run: cargo lint-docs --check
83
84  # Ensure Cargo.lock is up-to-date
85  lockfile:
86    runs-on: ubuntu-latest
87    steps:
88      - uses: actions/checkout@v5
89      - run: rustup update stable && rustup default stable
90      - run: cargo update -p cargo --locked
91
92  check-version-bump:
93    runs-on: ubuntu-latest
94    if: github.repository_owner == 'rust-lang'
95    env:
96      BASE_SHA: ${{ github.event.pull_request.base.sha }}
97      HEAD_SHA: ${{ github.event.pull_request.head.sha != '' && github.event.pull_request.head.sha || github.sha  }}
98    steps:
99      - uses: actions/checkout@v5
100        with:
101          fetch-depth: 0
102      - run: rustup update stable && rustup default stable
103      - name: Install cargo-semver-checks
104        run: |
105          mkdir installed-bins
106          curl -Lf https://github.com/obi1kenobi/cargo-semver-checks/releases/download/v0.44.0/cargo-semver-checks-x86_64-unknown-linux-gnu.tar.gz \
107            | tar -xz --directory=./installed-bins
108          echo `pwd`/installed-bins >> $GITHUB_PATH
109      - run: ci/validate-version-bump.sh
110
111  test:
112    runs-on: ${{ matrix.os }}
113    env:
114      CARGO_PROFILE_DEV_DEBUG: 1
115      CARGO_PROFILE_TEST_DEBUG: 1
116      CARGO_INCREMENTAL: 0
117      CARGO_PUBLIC_NETWORK_TESTS: 1
118      # Workaround for https://github.com/rust-lang/rustup/issues/3036
119      RUSTUP_WINDOWS_PATH_ADD_BIN: 0
120    strategy:
121      matrix:
122        include:
123        - name: Linux x86_64 stable
124          os: ubuntu-latest
125          rust: stable
126          other: i686-unknown-linux-gnu
127        - name: Linux x86_64 beta
128          os: ubuntu-latest
129          rust: beta
130          other: i686-unknown-linux-gnu
131        - name: Linux x86_64 nightly
132          os: ubuntu-latest
133          rust: nightly
134          other: i686-unknown-linux-gnu
135        - name: Linux aarch64 stable
136          os: ubuntu-24.04-arm
137          rust: stable
138          other: TODO # cross-compile tests are disabled, this shouldn't matter.
139        - name: Linux aarch64 nightly
140          os: ubuntu-24.04-arm
141          rust: nightly
142          other: TODO # cross-compile tests are disabled, this shouldn't matter.
143        - name: macOS aarch64 stable
144          os: macos-14
145          rust: stable
146          other: x86_64-apple-darwin
147        - name: macOS aarch64 nightly
148          os: macos-14
149          rust: nightly
150          other: x86_64-apple-darwin
151        - name: Windows x86_64 MSVC stable
152          os: windows-latest
153          rust: stable-msvc
154          other: i686-pc-windows-msvc
155        - name: Windows x86_64 MSVC nightly
156          os: windows-latest
157          rust: nightly-msvc
158          other: i686-pc-windows-msvc
159        - name: Windows aarch64 MSVC stable
160          os: windows-11-arm
161          rust: stable-msvc
162          other: i686-pc-windows-msvc
163        - name: Windows aarch64 MSVC nightly
164          os: windows-11-arm
165          rust: nightly-msvc
166          other: i686-pc-windows-msvc
167        - name: Windows x86_64 gnu nightly # runs out of space while trying to link the test suite
168          os: windows-latest
169          rust: nightly-gnu
170          other: i686-pc-windows-gnu
171    name: Tests ${{ matrix.name }}
172    steps:
173    - uses: actions/checkout@v5
174    - name: Dump Environment
175      run: ci/dump-environment.sh
176    # Some tests require stable. Make sure it is set to the most recent stable
177    # so that we can predictably handle updates if necessary (and not randomly
178    # when GitHub updates its image).
179    - run: rustup update --no-self-update stable
180    - run: rustup update --no-self-update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
181    - run: rustup target add ${{ matrix.other }}
182      if: matrix.os != 'ubuntu-24.04-arm' # cross-compile tests are disabled on ARM machines
183    - run: rustup target add wasm32-unknown-unknown
184    - run: rustup target add aarch64-unknown-none # need this for build-std mock tests
185      if: startsWith(matrix.rust, 'nightly')
186    - run: rustup component add rustc-dev llvm-tools-preview rust-docs
187      if: startsWith(matrix.rust, 'nightly')
188    - run: sudo apt update -y && sudo apt install lldb gcc-multilib libsecret-1-0 libsecret-1-dev -y
189      if: matrix.os == 'ubuntu-latest'
190    - run: rustup component add rustfmt || echo "rustfmt not available"
191    - name: Add Windows debuggers bin to PATH
192      shell: pwsh
193      run: Add-Content $env:GITHUB_PATH "C:\Program Files (x86)\Windows Kits\10\Debuggers\x64"
194      if: matrix.os == 'windows-latest'
195    - name: Add Windows debuggers bin to PATH
196      shell: pwsh
197      run: Add-Content $env:GITHUB_PATH "C:\Program Files (x86)\Windows Kits\10\Debuggers\arm64"
198      if: matrix.os == 'windows-11-arm'
199    - name: Configure extra test environment
200      run: echo CARGO_CONTAINER_TESTS=1 >> $GITHUB_ENV
201      if: matrix.os == 'ubuntu-latest'
202    - run: cargo test -p cargo
203    - name: Clear intermediate test output
204      run: ci/clean-test-output.sh
205
206    - name: gitoxide tests (all git-related tests)
207      run: cargo test -p cargo git
208      env:
209        __CARGO_USE_GITOXIDE_INSTEAD_OF_GIT2: 1
210      # The testsuite generates a huge amount of data, and fetch-smoke-test was
211    # running out of disk space.
212    - name: Clear test output
213      run: ci/clean-test-output.sh
214
215    # This only tests `cargo fix` because fix-proxy-mode is one of the most
216    # complicated subprocess management in Cargo.
217    - name: Check operability of rustc invocation with argfile
218      run: 'cargo test -p cargo --test testsuite -- fix::'
219      env:
220        __CARGO_TEST_FORCE_ARGFILE: 1
221    - run: cargo test --workspace --exclude cargo --exclude benchsuite --exclude resolver-tests
222    - name: Check benchmarks
223      run: |
224        # This only tests one benchmark since it can take over 10 minutes to
225        # download all workspaces.
226        cargo test -p benchsuite --all-targets -- cargo
227        cargo check -p capture
228    # The testsuite generates a huge amount of data, and fetch-smoke-test was
229    # running out of disk space.
230    - name: Clear benchmark output
231      run: ci/clean-test-output.sh
232
233    - name: Fetch smoke test
234      run: ci/fetch-smoke-test.sh
235
236  schema:
237    runs-on: ubuntu-latest
238    steps:
239    - uses: actions/checkout@v5
240    - run: rustup update stable && rustup default stable
241    - run: cargo test -p cargo-util-schemas -F unstable-schema
242
243  resolver:
244    runs-on: ubuntu-latest
245    steps:
246    - uses: actions/checkout@v5
247    - run: rustup update stable && rustup default stable
248    - run: cargo test -p resolver-tests
249
250  test_gitoxide:
251    runs-on: ubuntu-latest
252    steps:
253      - uses: actions/checkout@v5
254      - run: rustup update --no-self-update stable && rustup default stable
255      - run: rustup target add i686-unknown-linux-gnu
256      - run: rustup target add wasm32-unknown-unknown
257      - run: sudo apt update -y && sudo apt install gcc-multilib libsecret-1-0 libsecret-1-dev -y
258      - run: rustup component add rustfmt || echo "rustfmt not available"
259      - run: cargo test -p cargo
260        env:
261          __CARGO_USE_GITOXIDE_INSTEAD_OF_GIT2: 1
262
263  build_std:
264    runs-on: ubuntu-latest
265    steps:
266    - uses: actions/checkout@v5
267    - run: rustup update nightly && rustup default nightly
268    - run: rustup component add rust-src
269    - run: cargo build
270    - run: cargo test -p cargo --test build-std
271      env:
272        CARGO_RUN_BUILD_STD_TESTS: 1
273  docs:
274    runs-on: ubuntu-latest
275    steps:
276    - uses: actions/checkout@v5
277    - run: rustup update nightly && rustup default nightly
278    - run: rustup update stable
279    - run: rustup component add rust-docs
280    - run: rustup component add rustfmt --toolchain stable
281    - run: ci/validate-man.sh
282    # This requires rustfmt, use stable.
283    - name: Run semver-check
284      run: cargo +stable run -p semver-check
285    - name: Ensure intradoc links are valid
286      run: cargo doc --workspace --document-private-items --no-deps
287      env:
288        RUSTDOCFLAGS: -D warnings
289    - name: Install mdbook
290      run: |
291        mkdir mdbook
292        curl -Lf https://github.com/rust-lang/mdBook/releases/download/v0.4.52/mdbook-v0.4.52-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook
293        echo `pwd`/mdbook >> $GITHUB_PATH
294    - run: cd src/doc && mdbook build --dest-dir ../../target/doc
295    - name: Run linkchecker.sh
296      run: |
297        cd target
298        curl -sSLO https://raw.githubusercontent.com/rust-lang/rust/master/src/tools/linkchecker/linkcheck.sh
299        sh linkcheck.sh --all --path ../src/doc cargo
300
301  msrv:
302    runs-on: ubuntu-latest
303    steps:
304    - uses: actions/checkout@v5
305    - uses: taiki-e/install-action@cargo-hack
306    - run: cargo hack check --all-targets --rust-version --workspace --ignore-private --locked