diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000000..19c08182b67 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,124 @@ +name: CI +on: + push: + branches-ignore: [master] + pull_request: + branches: ['*'] + +defaults: + run: + shell: bash + +jobs: + # Check Code style quickly by running `rustfmt` over all code + rustfmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: rustup update stable && rustup default stable + - run: rustup component add rustfmt + - run: cargo fmt --all -- --check + - run: cd crates/cargo-test-macro && cargo fmt --all -- --check + - run: cd crates/cargo-test-support && cargo fmt --all -- --check + - run: cd crates/crates-io && cargo fmt --all -- --check + - run: cd crates/resolver-tests && cargo fmt --all -- --check + - run: cd crates/cargo-platform && cargo fmt --all -- --check + + test: + runs-on: ${{ matrix.os }} + env: + CARGO_PROFILE_DEV_DEBUG: 1 + CARGO_PROFILE_TEST_DEBUG: 1 + CARGO_INCREMENTAL: 0 + strategy: + matrix: + include: + - os: ubuntu-latest + rust: stable + other: i686-unknown-linux-gnu + - os: ubuntu-latest + rust: beta + other: i686-unknown-linux-gnu + - os: ubuntu-latest + rust: nightly + other: i686-unknown-linux-gnu + - os: macos-latest + rust: stable + other: x86_64-apple-ios + - os: windows-latest + rust: stable-msvc + other: i686-pc-windows-msvc + - os: windows-latest + rust: nightly-gnu + other: i686-pc-windows-gnu + steps: + - uses: actions/checkout@v2 + - run: rustup update --no-self-update ${{ matrix.rust }} && rustup default ${{ matrix.rust }} + - run: rustup target add ${{ matrix.other }} + - run: rustup component add rustc-dev llvm-tools-preview rust-docs + if: startsWith(matrix.rust, 'nightly') + - run: sudo apt update -y && sudo apt install gcc-multilib -y + if: matrix.os == 'ubuntu-latest' + - run: rustup component add rustfmt || echo "rustfmt not available" + + # Deny warnings on CI to avoid warnings getting into the codebase, and note + # the `force-system-lib-on-osx` which is intended to fix compile issues on + # OSX where compiling curl from source on OSX yields linker errors on Azure. + # + # Note that the curl issue is traced back to alexcrichton/curl-rust#279 + # where it looks like the OSX version we're actually running on is such that + # a symbol is emitted that's never worked. For now force the system library + # to be used to fix the link errors. + - run: cargo test --features 'deny-warnings curl/force-system-lib-on-osx' + - run: cargo test -p cargo-test-support + - run: cargo test -p cargo-platform + + resolver: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: rustup update stable && rustup default stable + - run: cargo test --manifest-path crates/resolver-tests/Cargo.toml + + build_std: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: rustup update nightly && rustup default nightly + - run: rustup component add rust-src + - run: cargo build + - run: cargo test --test build-std + env: + CARGO_RUN_BUILD_STD_TESTS: 1 + docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: rustup update nightly && rustup default nightly + - run: rustup component add rust-docs + - run: | + mkdir mdbook + 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 + echo ::add-path::`pwd`/mdbook + - run: cargo doc --no-deps + - run: cd src/doc && mdbook build --dest-dir ../../target/doc + - run: | + cd src/doc + curl -sSLo linkcheck.sh \ + https://raw.githubusercontent.com/rust-lang/rust/master/src/tools/linkchecker/linkcheck.sh + sh linkcheck.sh --all cargo + + success: + name: bors build finished + needs: [docs, rustfmt, test, resolver, build_std] + runs-on: ubuntu-latest + if: "success() && github.event_name == 'push' && github.ref == 'refs/heads/auto-cargo'" + steps: + - run: echo ok + failure: + name: bors build finished + needs: [docs, rustfmt, test, resolver, build_std] + runs-on: ubuntu-latest + if: "!success() && github.event_name == 'push' && github.ref == 'refs/heads/auto-cargo'" + steps: + - run: exit 1 diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index fdd3141b5f3..00000000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,118 +0,0 @@ -trigger: - branches: - include: - - '*' - exclude: - - master - -jobs: -- job: Linux - pool: - vmImage: ubuntu-16.04 - steps: - - template: ci/azure-test-all.yml - strategy: - matrix: - stable: - TOOLCHAIN: stable - beta: - TOOLCHAIN: beta - nightly: - TOOLCHAIN: nightly - variables: - OTHER_TARGET: i686-unknown-linux-gnu - -- job: macOS - pool: - vmImage: macos-10.15 - steps: - - template: ci/azure-test-all.yml - variables: - TOOLCHAIN: stable - OTHER_TARGET: x86_64-apple-ios - -- job: Windows - pool: - vmImage: windows-2019 - steps: - - template: ci/azure-test-all.yml - strategy: - matrix: - x86_64-msvc: - TOOLCHAIN: stable-x86_64-pc-windows-msvc - OTHER_TARGET: i686-pc-windows-msvc - x86_64-gnu: - TOOLCHAIN: nightly-x86_64-pc-windows-gnu - OTHER_TARGET: i686-pc-windows-gnu - -- job: rustfmt - pool: - vmImage: ubuntu-16.04 - steps: - - template: ci/azure-install-rust.yml - - bash: rustup component add rustfmt - displayName: "Install rustfmt" - - bash: cargo fmt --all -- --check - displayName: "Check rustfmt (cargo)" - - bash: cd crates/cargo-test-macro && cargo fmt --all -- --check - displayName: "Check rustfmt (cargo-test-macro)" - - bash: cd crates/cargo-test-support && cargo fmt --all -- --check - displayName: "Check rustfmt (cargo-test-support)" - - bash: cd crates/crates-io && cargo fmt --all -- --check - displayName: "Check rustfmt (crates-io)" - - bash: cd crates/resolver-tests && cargo fmt --all -- --check - displayName: "Check rustfmt (resolver-tests)" - - bash: cd crates/cargo-platform && cargo fmt --all -- --check - displayName: "Check rustfmt (cargo-platform)" - variables: - TOOLCHAIN: stable - -- job: resolver - pool: - vmImage: ubuntu-16.04 - steps: - - template: ci/azure-install-rust.yml - - bash: cargo test --manifest-path crates/resolver-tests/Cargo.toml - displayName: "Resolver tests" - variables: - TOOLCHAIN: stable - -- job: build_std - pool: - vmImage: ubuntu-16.04 - steps: - - template: ci/azure-install-rust.yml - - bash: rustup component add rust-src - displayName: "Install rust-src" - - bash: cargo build - - bash: cargo test --test build-std - displayName: "tests" - variables: - TOOLCHAIN: nightly - CARGO_RUN_BUILD_STD_TESTS: 1 - -- job: docs - pool: - vmImage: ubuntu-16.04 - variables: - TOOLCHAIN: nightly - steps: - - template: ci/azure-install-rust.yml - - bash: | - set -e - mkdir mdbook - 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 - echo "##vso[task.prependpath]`pwd`/mdbook" - displayName: "Install mdbook" - - bash: cargo doc --no-deps - displayName: "Build documentation" - - bash: cd src/doc && mdbook build --dest-dir ../../target/doc - displayName: "Build mdbook documentation" - - bash: | - set -e - rustup component add rust-docs - cd src/doc - curl -sSLo linkcheck.sh \ - https://raw.githubusercontent.com/rust-lang/rust/master/src/tools/linkchecker/linkcheck.sh - sh linkcheck.sh --all cargo - displayName: "Check for broken links" diff --git a/ci/azure-install-rust.yml b/ci/azure-install-rust.yml deleted file mode 100644 index 6f26e42f4d9..00000000000 --- a/ci/azure-install-rust.yml +++ /dev/null @@ -1,18 +0,0 @@ -steps: - - bash: | - set -e - rustup set profile minimal - rustup component remove --toolchain=$TOOLCHAIN rust-docs || echo "already removed" - rustup update --no-self-update $TOOLCHAIN - if [[ "$TOOLCHAIN" == "nightly"* ]]; then - rustup component add --toolchain=$TOOLCHAIN rustc-dev llvm-tools-preview rust-docs - fi - rustup default $TOOLCHAIN - displayName: Install rust - - - bash: | - set -ex - rustup -V - rustc -Vv - cargo -V - displayName: Query rust and cargo versions diff --git a/ci/azure-test-all.yml b/ci/azure-test-all.yml deleted file mode 100644 index feb945ca215..00000000000 --- a/ci/azure-test-all.yml +++ /dev/null @@ -1,33 +0,0 @@ -steps: -- checkout: self - fetchDepth: 1 - -- template: azure-install-rust.yml - -- bash: rustup target add $OTHER_TARGET - displayName: "Install cross-compile target" - -- bash: sudo apt update -y && sudo apt install gcc-multilib -y - displayName: "Install gcc-multilib (linux)" - condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux')) - -# Some tests also rely on rustfmt -- bash: rustup component add rustfmt || echo "rustfmt not available" - displayName: "Install rustfmt (maybe)" - -# Deny warnings on CI to avoid warnings getting into the codebase, and note the -# `force-system-lib-on-osx` which is intended to fix compile issues on OSX where -# compiling curl from source on OSX yields linker errors on Azure. -# -# Note that the curl issue is traced back to alexcrichton/curl-rust#279 where it -# looks like the OSX version we're actually running on is such that a symbol is -# emitted that's never worked. For now force the system library to be used to -# fix the link errors. -- bash: cargo test --features 'deny-warnings curl/force-system-lib-on-osx' - displayName: "cargo test" - -- bash: cargo test -p cargo-test-support - displayName: "cargo test -p cargo-test-support" - -- bash: cargo test -p cargo-platform - displayName: "cargo test -p cargo-platform"