]> git.proxmox.com Git - cargo.git/blob - .github/workflows/main.yml
67502ba88fdcd2ab837f959ee52757eab4375325
[cargo.git] / .github / workflows / main.yml
1 name: CI
2 on:
3 push:
4 branches-ignore: [master]
5 pull_request:
6 branches: ['*']
7
8 defaults:
9 run:
10 shell: bash
11
12 jobs:
13 # Check Code style quickly by running `rustfmt` over all code
14 rustfmt:
15 runs-on: ubuntu-latest
16 steps:
17 - uses: actions/checkout@v3
18 - run: rustup update stable && rustup default stable
19 - run: rustup component add rustfmt
20 - run: cargo fmt --all --check
21 - run: |
22 for manifest in `find crates benches/benchsuite benches/capture -name Cargo.toml`
23 do
24 echo check fmt for $manifest
25 cargo fmt --all --manifest-path $manifest --check
26 done
27
28 test:
29 runs-on: ${{ matrix.os }}
30 env:
31 CARGO_PROFILE_DEV_DEBUG: 1
32 CARGO_PROFILE_TEST_DEBUG: 1
33 CARGO_INCREMENTAL: 0
34 strategy:
35 matrix:
36 include:
37 - os: ubuntu-latest
38 rust: stable
39 other: i686-unknown-linux-gnu
40 - os: ubuntu-latest
41 rust: beta
42 other: i686-unknown-linux-gnu
43 - os: ubuntu-latest
44 rust: nightly
45 other: i686-unknown-linux-gnu
46 - os: macos-latest
47 rust: stable
48 other: x86_64-apple-ios
49 - os: windows-latest
50 rust: stable-msvc
51 other: i686-pc-windows-msvc
52 - os: windows-latest
53 rust: nightly-gnu
54 other: i686-pc-windows-gnu
55 steps:
56 - uses: actions/checkout@v3
57 - name: Dump Environment
58 run: ci/dump-environment.sh
59 - name: Update Rustup (temporary workaround)
60 run: rustup self update
61 shell: bash
62 if: startsWith(matrix.os, 'windows')
63 - run: rustup update --no-self-update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
64 - run: rustup target add ${{ matrix.other }}
65 - run: rustup component add rustc-dev llvm-tools-preview rust-docs
66 if: startsWith(matrix.rust, 'nightly')
67 - run: sudo apt update -y && sudo apt install gcc-multilib libsecret-1-0 libsecret-1-dev -y
68 if: matrix.os == 'ubuntu-latest'
69 - run: rustup component add rustfmt || echo "rustfmt not available"
70
71 # Deny warnings on CI to avoid warnings getting into the codebase.
72 - run: cargo test --features 'deny-warnings'
73 - name: Check operability of rustc invocation with argfile
74 env:
75 __CARGO_TEST_FORCE_ARGFILE: 1
76 run: |
77 # This only tests `cargo fix` because fix-proxy-mode is one of the most
78 # complicated subprocess management in Cargo.
79 cargo test --test testsuite --features 'deny-warnings' -- fix::
80 - run: cargo test --features 'deny-warnings' --manifest-path crates/cargo-test-support/Cargo.toml
81 env:
82 CARGO_TARGET_DIR: target
83 - run: cargo test -p cargo-platform
84 - run: cargo test -p cargo-util
85 - run: cargo test --manifest-path crates/mdman/Cargo.toml
86 - run: cargo build --manifest-path crates/credential/cargo-credential-1password/Cargo.toml
87 - run: cargo build --manifest-path crates/credential/cargo-credential-gnome-secret/Cargo.toml
88 if: matrix.os == 'ubuntu-latest'
89 - run: cargo build --manifest-path crates/credential/cargo-credential-macos-keychain/Cargo.toml
90 if: matrix.os == 'macos-latest'
91 - run: cargo build --manifest-path crates/credential/cargo-credential-wincred/Cargo.toml
92 if: matrix.os == 'windows-latest'
93 - name: Check benchmarks
94 env:
95 # Share the target dir to try to cache a few build-time deps.
96 CARGO_TARGET_DIR: target
97 run: |
98 # This only tests one benchmark since it can take over 10 minutes to
99 # download all workspaces.
100 cargo test --manifest-path benches/benchsuite/Cargo.toml --all-targets -- cargo
101 cargo check --manifest-path benches/capture/Cargo.toml
102 # The testsuite generates a huge amount of data, and fetch-smoke-test was
103 # running out of disk space.
104 - name: Clear test output
105 run: |
106 df -h
107 rm -rf target/tmp
108 df -h
109 - name: Fetch smoke test
110 run: ci/fetch-smoke-test.sh
111
112 resolver:
113 runs-on: ubuntu-latest
114 steps:
115 - uses: actions/checkout@v3
116 - run: rustup update stable && rustup default stable
117 - run: cargo test --manifest-path crates/resolver-tests/Cargo.toml
118
119 build_std:
120 runs-on: ubuntu-latest
121 steps:
122 - uses: actions/checkout@v3
123 - run: rustup update nightly && rustup default nightly
124 - run: rustup component add rust-src
125 - run: cargo build
126 - run: cargo test --test build-std
127 env:
128 CARGO_RUN_BUILD_STD_TESTS: 1
129 docs:
130 runs-on: ubuntu-latest
131 steps:
132 - uses: actions/checkout@v3
133 - run: rustup update nightly && rustup default nightly
134 - run: rustup update stable
135 - run: rustup component add rust-docs
136 - run: ci/validate-man.sh
137 # This requires rustfmt, use stable.
138 - run: cd src/doc/semver-check && cargo +stable run
139 - run: |
140 mkdir mdbook
141 curl -Lf https://github.com/rust-lang/mdBook/releases/download/v0.4.5/mdbook-v0.4.5-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook
142 echo `pwd`/mdbook >> $GITHUB_PATH
143 - run: cargo doc --no-deps
144 - run: cd src/doc && mdbook build --dest-dir ../../target/doc
145 - run: |
146 cd src/doc
147 curl -sSLo linkcheck.sh \
148 https://raw.githubusercontent.com/rust-lang/rust/master/src/tools/linkchecker/linkcheck.sh
149 sh linkcheck.sh --all cargo
150
151 success:
152 name: bors build finished
153 needs: [docs, rustfmt, test, resolver, build_std]
154 runs-on: ubuntu-latest
155 if: "success() && github.event_name == 'push' && github.ref == 'refs/heads/auto-cargo'"
156 steps:
157 - run: echo ok
158 failure:
159 name: bors build finished
160 needs: [docs, rustfmt, test, resolver, build_std]
161 runs-on: ubuntu-latest
162 if: "!success() && github.event_name == 'push' && github.ref == 'refs/heads/auto-cargo'"
163 steps:
164 - run: exit 1