|
| 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@v2 |
| 18 | + - run: rustup update stable && rustup default stable |
| 19 | + - run: rustup component add rustfmt |
| 20 | + - run: cargo fmt --all -- --check |
| 21 | + - run: cd crates/cargo-test-macro && cargo fmt --all -- --check |
| 22 | + - run: cd crates/cargo-test-support && cargo fmt --all -- --check |
| 23 | + - run: cd crates/crates-io && cargo fmt --all -- --check |
| 24 | + - run: cd crates/resolver-tests && cargo fmt --all -- --check |
| 25 | + - run: cd crates/cargo-platform && cargo fmt --all -- --check |
| 26 | + |
| 27 | + test: |
| 28 | + runs-on: ${{ matrix.os }} |
| 29 | + env: |
| 30 | + CARGO_PROFILE_DEV_DEBUG: 1 |
| 31 | + CARGO_PROFILE_TEST_DEBUG: 1 |
| 32 | + CARGO_INCREMENTAL: 0 |
| 33 | + strategy: |
| 34 | + matrix: |
| 35 | + include: |
| 36 | + - os: ubuntu-latest |
| 37 | + rust: stable |
| 38 | + other: i686-unknown-linux-gnu |
| 39 | + - os: ubuntu-latest |
| 40 | + rust: beta |
| 41 | + other: i686-unknown-linux-gnu |
| 42 | + - os: ubuntu-latest |
| 43 | + rust: nightly |
| 44 | + other: i686-unknown-linux-gnu |
| 45 | + - os: macos-latest |
| 46 | + rust: stable |
| 47 | + other: x86_64-apple-ios |
| 48 | + - os: windows-latest |
| 49 | + rust: stable-msvc |
| 50 | + other: i686-pc-windows-msvc |
| 51 | + - os: windows-latest |
| 52 | + rust: nightly-gnu |
| 53 | + other: i686-pc-windows-gnu |
| 54 | + steps: |
| 55 | + - uses: actions/checkout@v2 |
| 56 | + - run: rustup update --no-self-update ${{ matrix.rust }} && rustup default ${{ matrix.rust }} |
| 57 | + - run: rustup target add ${{ matrix.other }} |
| 58 | + - run: rustup component add rustc-dev llvm-tools-preview rust-docs |
| 59 | + if: startsWith(matrix.rust, 'nightly') |
| 60 | + - run: sudo apt update -y && sudo apt install gcc-multilib -y |
| 61 | + if: matrix.os == 'ubuntu-latest' |
| 62 | + - run: rustup component add rustfmt || echo "rustfmt not available" |
| 63 | + |
| 64 | + # Deny warnings on CI to avoid warnings getting into the codebase, and note |
| 65 | + # the `force-system-lib-on-osx` which is intended to fix compile issues on |
| 66 | + # OSX where compiling curl from source on OSX yields linker errors on Azure. |
| 67 | + # |
| 68 | + # Note that the curl issue is traced back to alexcrichton/curl-rust#279 |
| 69 | + # where it looks like the OSX version we're actually running on is such that |
| 70 | + # a symbol is emitted that's never worked. For now force the system library |
| 71 | + # to be used to fix the link errors. |
| 72 | + - run: cargo test --features 'deny-warnings curl/force-system-lib-on-osx' |
| 73 | + - run: cargo test -p cargo-test-support |
| 74 | + - run: cargo test -p cargo-platform |
| 75 | + |
| 76 | + resolver: |
| 77 | + runs-on: ubuntu-latest |
| 78 | + steps: |
| 79 | + - uses: actions/checkout@v2 |
| 80 | + - run: rustup update stable && rustup default stable |
| 81 | + - run: cargo test --manifest-path crates/resolver-tests/Cargo.toml |
| 82 | + |
| 83 | + build_std: |
| 84 | + runs-on: ubuntu-latest |
| 85 | + steps: |
| 86 | + - uses: actions/checkout@v2 |
| 87 | + - run: rustup update nightly && rustup default nightly |
| 88 | + - run: rustup component add rust-src |
| 89 | + - run: cargo build |
| 90 | + - run: cargo test --test build-std |
| 91 | + env: |
| 92 | + CARGO_RUN_BUILD_STD_TESTS: 1 |
| 93 | + docs: |
| 94 | + runs-on: ubuntu-latest |
| 95 | + steps: |
| 96 | + - uses: actions/checkout@v2 |
| 97 | + - run: rustup update nightly && rustup default nightly |
| 98 | + - run: rustup component add rust-docs |
| 99 | + - run: | |
| 100 | + mkdir mdbook |
| 101 | + curl -Lf https://github.com/rust-lang/mdBook/releases/download/v0.3.7/mdbook-v0.3.7-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook |
| 102 | + echo ::add-path::`pwd`/mdbook |
| 103 | + - run: cargo doc --no-deps |
| 104 | + - run: cd src/doc && mdbook build --dest-dir ../../target/doc |
| 105 | + - run: | |
| 106 | + cd src/doc |
| 107 | + curl -sSLo linkcheck.sh \ |
| 108 | + https://raw.githubusercontent.com/rust-lang/rust/master/src/tools/linkchecker/linkcheck.sh |
| 109 | + sh linkcheck.sh --all cargo |
| 110 | +
|
| 111 | + success: |
| 112 | + name: bors build finished |
| 113 | + needs: [docs, rustfmt, test, resolver, build_std] |
| 114 | + runs-on: ubuntu-latest |
| 115 | + if: "success() && github.event_name == 'push' && github.ref == 'refs/heads/auto-cargo'" |
| 116 | + steps: |
| 117 | + - run: echo ok |
| 118 | + failure: |
| 119 | + name: bors build finished |
| 120 | + needs: [docs, rustfmt, test, resolver, build_std] |
| 121 | + runs-on: ubuntu-latest |
| 122 | + if: "!success() && github.event_name == 'push' && github.ref == 'refs/heads/auto-cargo'" |
| 123 | + steps: |
| 124 | + - run: exit 1 |
0 commit comments