fork/cargo

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

Ed Pagechore(deps): update cargo-semver-checks to v0.42.0 (#15730)1743cb890

0.91.0
10.2 KiB296 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.42.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 x86_64 nightly
147          os: macos-13
148          rust: nightly
149          other: x86_64-apple-ios
150        - name: macOS aarch64 nightly
151          os: macos-14
152          rust: nightly
153          other: x86_64-apple-darwin
154        - name: Windows x86_64 MSVC stable
155          os: windows-latest
156          rust: stable-msvc
157          other: i686-pc-windows-msvc
158        - name: Windows x86_64 MSVC nightly
159          os: windows-latest
160          rust: nightly-msvc
161          other: i686-pc-windows-msvc
162        - name: Windows x86_64 gnu nightly # runs out of space while trying to link the test suite
163          os: windows-latest
164          rust: nightly-gnu
165          other: i686-pc-windows-gnu
166    name: Tests ${{ matrix.name }}
167    steps:
168    - uses: actions/checkout@v4
169    - name: Dump Environment
170      run: ci/dump-environment.sh
171    # Some tests require stable. Make sure it is set to the most recent stable
172    # so that we can predictably handle updates if necessary (and not randomly
173    # when GitHub updates its image).
174    - run: rustup update --no-self-update stable
175    - run: rustup update --no-self-update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
176    - run: rustup target add ${{ matrix.other }}
177      if: matrix.os != 'ubuntu-24.04-arm' # cross-compile tests are disabled on ARM machines
178    - run: rustup target add wasm32-unknown-unknown
179    - run: rustup target add aarch64-unknown-none # need this for build-std mock tests
180      if: startsWith(matrix.rust, 'nightly')
181    - run: rustup component add rustc-dev llvm-tools-preview rust-docs
182      if: startsWith(matrix.rust, 'nightly')
183    - run: sudo apt update -y && sudo apt install lldb gcc-multilib libsecret-1-0 libsecret-1-dev -y
184      if: matrix.os == 'ubuntu-latest'
185    - run: rustup component add rustfmt || echo "rustfmt not available"
186    - name: Add Windows debuggers bin to PATH
187      shell: pwsh
188      run: Add-Content $env:GITHUB_PATH "C:\Program Files (x86)\Windows Kits\10\Debuggers\x64"
189      if: matrix.os == 'windows-latest'
190    - name: Configure extra test environment
191      run: echo CARGO_CONTAINER_TESTS=1 >> $GITHUB_ENV
192      if: matrix.os == 'ubuntu-latest'
193    - run: cargo test -p cargo
194    - name: Clear intermediate test output
195      run: ci/clean-test-output.sh
196
197    - name: gitoxide tests (all git-related tests)
198      run: cargo test -p cargo git
199      env:
200        __CARGO_USE_GITOXIDE_INSTEAD_OF_GIT2: 1
201      # The testsuite generates a huge amount of data, and fetch-smoke-test was
202    # running out of disk space.
203    - name: Clear test output
204      run: ci/clean-test-output.sh
205
206    # This only tests `cargo fix` because fix-proxy-mode is one of the most
207    # complicated subprocess management in Cargo.
208    - name: Check operability of rustc invocation with argfile
209      run: 'cargo test -p cargo --test testsuite -- fix::'
210      env:
211        __CARGO_TEST_FORCE_ARGFILE: 1
212    - run: cargo test --workspace --exclude cargo --exclude benchsuite --exclude resolver-tests
213    - name: Check benchmarks
214      run: |
215        # This only tests one benchmark since it can take over 10 minutes to
216        # download all workspaces.
217        cargo test -p benchsuite --all-targets -- cargo
218        cargo check -p capture
219    # The testsuite generates a huge amount of data, and fetch-smoke-test was
220    # running out of disk space.
221    - name: Clear benchmark output
222      run: ci/clean-test-output.sh
223
224    - name: Fetch smoke test
225      run: ci/fetch-smoke-test.sh
226
227  schema:
228    runs-on: ubuntu-latest
229    steps:
230    - uses: actions/checkout@v4
231    - run: rustup update stable && rustup default stable
232    - run: cargo test -p cargo-util-schemas -F unstable-schema
233
234  resolver:
235    runs-on: ubuntu-latest
236    steps:
237    - uses: actions/checkout@v4
238    - run: rustup update stable && rustup default stable
239    - run: cargo test -p resolver-tests
240
241  test_gitoxide:
242    runs-on: ubuntu-latest
243    steps:
244      - uses: actions/checkout@v4
245      - run: rustup update --no-self-update stable && rustup default stable
246      - run: rustup target add i686-unknown-linux-gnu
247      - run: rustup target add wasm32-unknown-unknown
248      - run: sudo apt update -y && sudo apt install gcc-multilib libsecret-1-0 libsecret-1-dev -y
249      - run: rustup component add rustfmt || echo "rustfmt not available"
250      - run: cargo test -p cargo
251        env:
252          __CARGO_USE_GITOXIDE_INSTEAD_OF_GIT2: 1
253
254  build_std:
255    runs-on: ubuntu-latest
256    steps:
257    - uses: actions/checkout@v4
258    - run: rustup update nightly && rustup default nightly
259    - run: rustup component add rust-src
260    - run: cargo build
261    - run: cargo test -p cargo --test build-std
262      env:
263        CARGO_RUN_BUILD_STD_TESTS: 1
264  docs:
265    runs-on: ubuntu-latest
266    steps:
267    - uses: actions/checkout@v4
268    - run: rustup update nightly && rustup default nightly
269    - run: rustup update stable
270    - run: rustup component add rust-docs
271    - run: ci/validate-man.sh
272    # This requires rustfmt, use stable.
273    - name: Run semver-check
274      run: cargo +stable run -p semver-check
275    - name: Ensure intradoc links are valid
276      run: cargo doc --workspace --document-private-items --no-deps
277      env:
278        RUSTDOCFLAGS: -D warnings
279    - name: Install mdbook
280      run: |
281        mkdir mdbook
282        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
283        echo `pwd`/mdbook >> $GITHUB_PATH
284    - run: cd src/doc && mdbook build --dest-dir ../../target/doc
285    - name: Run linkchecker.sh
286      run: |
287        cd target
288        curl -sSLO https://raw.githubusercontent.com/rust-lang/rust/master/src/tools/linkchecker/linkcheck.sh
289        sh linkcheck.sh --all --path ../src/doc cargo
290
291  msrv:
292    runs-on: ubuntu-latest
293    steps:
294    - uses: actions/checkout@v4
295    - uses: taiki-e/install-action@cargo-hack
296    - run: cargo hack check --all-targets --rust-version --workspace --ignore-private --locked