fork/cargo

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

Ed Page[beta-1.91] chore: Disabled reserved_windows_name test temporaily (#16050)785a383cf

0.92.0
10.6 KiB305 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@v4
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@v4
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@v4
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@v4
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@v4
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    env:
95      BASE_SHA: ${{ github.event.pull_request.base.sha }}
96      HEAD_SHA: ${{ github.event.pull_request.head.sha != '' && github.event.pull_request.head.sha || github.sha  }}
97    steps:
98      - uses: actions/checkout@v4
99        with:
100          fetch-depth: 0
101      - run: rustup update stable && rustup default stable
102      - name: Install cargo-semver-checks
103        run: |
104          mkdir installed-bins
105          curl -Lf https://github.com/obi1kenobi/cargo-semver-checks/releases/download/v0.43.0/cargo-semver-checks-x86_64-unknown-linux-gnu.tar.gz \
106            | tar -xz --directory=./installed-bins
107          echo `pwd`/installed-bins >> $GITHUB_PATH
108      - run: ci/validate-version-bump.sh
109
110  test:
111    runs-on: ${{ matrix.os }}
112    env:
113      CARGO_PROFILE_DEV_DEBUG: 1
114      CARGO_PROFILE_TEST_DEBUG: 1
115      CARGO_INCREMENTAL: 0
116      CARGO_PUBLIC_NETWORK_TESTS: 1
117      # Workaround for https://github.com/rust-lang/rustup/issues/3036
118      RUSTUP_WINDOWS_PATH_ADD_BIN: 0
119    strategy:
120      matrix:
121        include:
122        - name: Linux x86_64 stable
123          os: ubuntu-latest
124          rust: stable
125          other: i686-unknown-linux-gnu
126        - name: Linux x86_64 beta
127          os: ubuntu-latest
128          rust: beta
129          other: i686-unknown-linux-gnu
130        - name: Linux x86_64 nightly
131          os: ubuntu-latest
132          rust: nightly
133          other: i686-unknown-linux-gnu
134        - name: Linux aarch64 stable
135          os: ubuntu-24.04-arm
136          rust: stable
137          other: TODO # cross-compile tests are disabled, this shouldn't matter.
138        - name: Linux aarch64 nightly
139          os: ubuntu-24.04-arm
140          rust: nightly
141          other: TODO # cross-compile tests are disabled, this shouldn't matter.
142        - name: macOS aarch64 stable
143          os: macos-14
144          rust: stable
145          other: x86_64-apple-darwin
146        - name: macOS aarch64 nightly
147          os: macos-14
148          rust: nightly
149          other: x86_64-apple-darwin
150        - name: Windows x86_64 MSVC stable
151          os: windows-latest
152          rust: stable-msvc
153          other: i686-pc-windows-msvc
154        - name: Windows x86_64 MSVC nightly
155          os: windows-latest
156          rust: nightly-msvc
157          other: i686-pc-windows-msvc
158        - name: Windows aarch64 MSVC stable
159          os: windows-11-arm
160          rust: stable-msvc
161          other: i686-pc-windows-msvc
162        - name: Windows aarch64 MSVC nightly
163          os: windows-11-arm
164          rust: nightly-msvc
165          other: i686-pc-windows-msvc
166        - name: Windows x86_64 gnu nightly # runs out of space while trying to link the test suite
167          os: windows-latest
168          rust: nightly-gnu
169          other: i686-pc-windows-gnu
170    name: Tests ${{ matrix.name }}
171    steps:
172    - uses: actions/checkout@v4
173    - name: Dump Environment
174      run: ci/dump-environment.sh
175    # Some tests require stable. Make sure it is set to the most recent stable
176    # so that we can predictably handle updates if necessary (and not randomly
177    # when GitHub updates its image).
178    - run: rustup update --no-self-update stable
179    - run: rustup update --no-self-update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
180    - run: rustup target add ${{ matrix.other }}
181      if: matrix.os != 'ubuntu-24.04-arm' # cross-compile tests are disabled on ARM machines
182    - run: rustup target add wasm32-unknown-unknown
183    - run: rustup target add aarch64-unknown-none # need this for build-std mock tests
184      if: startsWith(matrix.rust, 'nightly')
185    - run: rustup component add rustc-dev llvm-tools-preview rust-docs
186      if: startsWith(matrix.rust, 'nightly')
187    - run: sudo apt update -y && sudo apt install lldb gcc-multilib libsecret-1-0 libsecret-1-dev -y
188      if: matrix.os == 'ubuntu-latest'
189    - run: rustup component add rustfmt || echo "rustfmt not available"
190    - name: Add Windows debuggers bin to PATH
191      shell: pwsh
192      run: Add-Content $env:GITHUB_PATH "C:\Program Files (x86)\Windows Kits\10\Debuggers\x64"
193      if: matrix.os == 'windows-latest'
194    - name: Add Windows debuggers bin to PATH
195      shell: pwsh
196      run: Add-Content $env:GITHUB_PATH "C:\Program Files (x86)\Windows Kits\10\Debuggers\arm64"
197      if: matrix.os == 'windows-11-arm'
198    - name: Configure extra test environment
199      run: echo CARGO_CONTAINER_TESTS=1 >> $GITHUB_ENV
200      if: matrix.os == 'ubuntu-latest'
201    - run: cargo test -p cargo
202    - name: Clear intermediate test output
203      run: ci/clean-test-output.sh
204
205    - name: gitoxide tests (all git-related tests)
206      run: cargo test -p cargo git
207      env:
208        __CARGO_USE_GITOXIDE_INSTEAD_OF_GIT2: 1
209      # The testsuite generates a huge amount of data, and fetch-smoke-test was
210    # running out of disk space.
211    - name: Clear test output
212      run: ci/clean-test-output.sh
213
214    # This only tests `cargo fix` because fix-proxy-mode is one of the most
215    # complicated subprocess management in Cargo.
216    - name: Check operability of rustc invocation with argfile
217      run: 'cargo test -p cargo --test testsuite -- fix::'
218      env:
219        __CARGO_TEST_FORCE_ARGFILE: 1
220    - run: cargo test --workspace --exclude cargo --exclude benchsuite --exclude resolver-tests
221    - name: Check benchmarks
222      run: |
223        # This only tests one benchmark since it can take over 10 minutes to
224        # download all workspaces.
225        cargo test -p benchsuite --all-targets -- cargo
226        cargo check -p capture
227    # The testsuite generates a huge amount of data, and fetch-smoke-test was
228    # running out of disk space.
229    - name: Clear benchmark output
230      run: ci/clean-test-output.sh
231
232    - name: Fetch smoke test
233      run: ci/fetch-smoke-test.sh
234
235  schema:
236    runs-on: ubuntu-latest
237    steps:
238    - uses: actions/checkout@v4
239    - run: rustup update stable && rustup default stable
240    - run: cargo test -p cargo-util-schemas -F unstable-schema
241
242  resolver:
243    runs-on: ubuntu-latest
244    steps:
245    - uses: actions/checkout@v4
246    - run: rustup update stable && rustup default stable
247    - run: cargo test -p resolver-tests
248
249  test_gitoxide:
250    runs-on: ubuntu-latest
251    steps:
252      - uses: actions/checkout@v4
253      - run: rustup update --no-self-update stable && rustup default stable
254      - run: rustup target add i686-unknown-linux-gnu
255      - run: rustup target add wasm32-unknown-unknown
256      - run: sudo apt update -y && sudo apt install gcc-multilib libsecret-1-0 libsecret-1-dev -y
257      - run: rustup component add rustfmt || echo "rustfmt not available"
258      - run: cargo test -p cargo
259        env:
260          __CARGO_USE_GITOXIDE_INSTEAD_OF_GIT2: 1
261
262  build_std:
263    runs-on: ubuntu-latest
264    steps:
265    - uses: actions/checkout@v4
266    - run: rustup update nightly && rustup default nightly
267    - run: rustup component add rust-src
268    - run: cargo build
269    - run: cargo test -p cargo --test build-std
270      env:
271        CARGO_RUN_BUILD_STD_TESTS: 1
272  docs:
273    runs-on: ubuntu-latest
274    steps:
275    - uses: actions/checkout@v4
276    - run: rustup update nightly && rustup default nightly
277    - run: rustup update stable
278    - run: rustup component add rust-docs
279    - run: rustup component add rustfmt --toolchain stable
280    - run: ci/validate-man.sh
281    # This requires rustfmt, use stable.
282    - name: Run semver-check
283      run: cargo +stable run -p semver-check
284    - name: Ensure intradoc links are valid
285      run: cargo doc --workspace --document-private-items --no-deps
286      env:
287        RUSTDOCFLAGS: -D warnings
288    - name: Install mdbook
289      run: |
290        mkdir mdbook
291        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
292        echo `pwd`/mdbook >> $GITHUB_PATH
293    - run: cd src/doc && mdbook build --dest-dir ../../target/doc
294    - name: Run linkchecker.sh
295      run: |
296        cd target
297        curl -sSLO https://raw.githubusercontent.com/rust-lang/rust/master/src/tools/linkchecker/linkcheck.sh
298        sh linkcheck.sh --all --path ../src/doc cargo
299
300  msrv:
301    runs-on: ubuntu-latest
302    steps:
303    - uses: actions/checkout@v4
304    - uses: taiki-e/install-action@cargo-hack
305    - run: cargo hack check --all-targets --rust-version --workspace --ignore-private --locked