fork/cargo

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

Ed Pagechore(deps): update cargo-semver-checks to v0.41.0 (#15446)0865ee859

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