From abc2ada63f2ea59fc0cec469e17edc480215f495 Mon Sep 17 00:00:00 2001 From: Pavan Kumar Sunkara Date: Mon, 20 Apr 2020 23:16:33 +0200 Subject: [PATCH] Use github actions for windows --- .azure-pipelines.yml | 15 ---- .github/workflows/benchmark.yml | 2 - .github/workflows/ci.yml | 132 ++++++++++++++++++++++++++++++++ .github/workflows/linux.yml | 40 ---------- .travis.yml | 3 - Cargo.toml | 3 - bors.toml | 2 + 7 files changed, 134 insertions(+), 63 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/linux.yml diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index 08587e2e..19227b44 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -17,12 +17,6 @@ stages: rust: 1.40.0 strategy: matrix: - MSVC 32-bit: - image: vs2017-win2016 - target: i686-pc-windows-msvc - MSVC 64-bit: - image: vs2017-win2016 - target: x86_64-pc-windows-msvc MinGW 32-bit: image: vs2017-win2016 target: i686-pc-windows-gnu @@ -36,18 +30,9 @@ stages: fetchDepth: 1 path: clap displayName: Checkout repository - - task: Cache@2 - inputs: - key: cargo | "$(rust)" | $(target) | Cargo.toml - path: C:\Rust\.cargo - displayName: Cache cargo - script: rustup default $(rust)-$(target) displayName: Install rust - script: cargo test --no-default-features --features "std cargo" -p clap:3.0.0-beta.1 displayName: Test with almost no features - script: cargo test --features "yaml unstable" displayName: Test with most features - - script: | - rmdir /Q /S C:\Rust\.cargo\registry\src - displayName: Cleanup cache - continueOnError: true diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 677caea8..7b45ee8d 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -46,8 +46,6 @@ jobs: external-data-json-path: ./benchmark-data.json github-token: ${{ github.token }} annotate-always: true - - name: temporary - run: rm ~/.cargo/bin/cargo-cache - name: Install cargo-cache uses: actions-rs/install@v0.1 if: steps.cache.outputs.cache-hit != 'true' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..39bc6563 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,132 @@ +name: CI +on: + push: + branches: [staging, trying] + pull_request: + branches: [master] + types: [opened, reopened, synchronize] +jobs: + test: + name: Tests + strategy: + fail-fast: false + matrix: + os: [windows-latest, macos-latest, ubuntu-latest] + rust: [1.40.0] + target: + - i686-pc-windows-msvc + - x86_64-pc-windows-msvc + # - i686-pc-windows-gnu + # - x86_64-pc-windows-gnu + # - i686-unknown-linux-gnu + - x86_64-unknown-linux-gnu + - x86_64-apple-darwin + features: [all, none] + exclude: + - os: windows-latest + target: x86_64-apple-darwin + # - os: windows-latest + # target: i686-unknown-linux-gnu + - os: windows-latest + target: x86_64-unknown-linux-gnu + - os: macos-latest + target: i686-pc-windows-msvc + - os: macos-latest + target: x86_64-pc-windows-msvc + # - os: macos-latest + # target: i686-pc-windows-gnu + # - os: macos-latest + # target: x86_64-pc-windows-gnu + # - os: macos-latest + # target: i686-unknown-linux-gnu + - os: macos-latest + target: x86_64-unknown-linux-gnu + - os: ubuntu-latest + target: i686-pc-windows-msvc + - os: ubuntu-latest + target: x86_64-pc-windows-msvc + # - os: ubuntu-latest + # target: i686-pc-windows-gnu + # - os: ubuntu-latest + # target: x86_64-pc-windows-gnu + - os: ubuntu-latest + target: x86_64-apple-darwin + runs-on: ${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Install rust + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + target: ${{ matrix.target }} + override: true + - name: Ready cache + if: matrix.os == 'ubuntu-latest' + run: sudo chown -R $(whoami):$(id -ng) ~/.cargo/ + - name: Cache cargo + uses: actions/cache@v1 + id: cache + with: + path: ~/.cargo + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} + - name: Test almost no features + uses: actions-rs/cargo@v1 + if: matrix.features == 'none' + with: + command: test + args: --target ${{ matrix.target }} --no-default-features --features "std cargo" -p clap:3.0.0-beta.1 + - name: Test all features + uses: actions-rs/cargo@v1 + if: matrix.features == 'all' + with: + command: test + args: --target ${{ matrix.target }} --features "yaml unstable" + - name: Install cargo-cache + uses: actions-rs/install@v0.1 + if: steps.cache.outputs.cache-hit != 'true' + with: + crate: cargo-cache + use-tool-cache: true + - name: Cleanup cache + if: steps.cache.outputs.cache-hit != 'true' + run: cargo cache -a + # https://github.com/rust-lang/rust/issues/29497 + - name: Cleanup windows cache + if: steps.cache.outputs.cache-hit != 'true' && matrix.os == 'windows-latest' + shell: bash + run: | + rm -rf ~/.cargo/git/checkouts + rm -rf ~/.cargo/registry/index + test-release: + name: Release Profile Tests + runs-on: ubuntu-latest + steps: + - name: Install rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + - name: Checkout + uses: actions/checkout@v2 + - name: Ready cache + run: sudo chown -R $(whoami):$(id -ng) ~/.cargo/ + - name: Cache cargo + uses: actions/cache@v1 + id: cache + with: + path: ~/.cargo + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} + - name: Test + uses: actions-rs/cargo@v1 + with: + command: test + args: --release --features "yaml unstable" + - name: Install cargo-cache + uses: actions-rs/install@v0.1 + if: steps.cache.outputs.cache-hit != 'true' + with: + crate: cargo-cache + use-tool-cache: true + - name: Cleanup cache + if: steps.cache.outputs.cache-hit != 'true' + run: cargo cache -a diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml deleted file mode 100644 index f3fc9e8d..00000000 --- a/.github/workflows/linux.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Linux -on: - push: - branches: [staging, trying] - pull_request: - branches: [master] - types: [opened, reopened, synchronize] -jobs: - test-release: - name: Release Profile Tests - runs-on: ubuntu-latest - steps: - - name: Install rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - - name: Checkout - uses: actions/checkout@v2 - - name: Ready cache - run: sudo chown -R $(whoami):$(id -ng) ~/.cargo/ - - name: Cache cargo - uses: actions/cache@v1 - id: cache - with: - path: ~/.cargo - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} - - name: Test - uses: actions-rs/cargo@v1 - with: - command: test - args: --release --features "yaml unstable" - - name: Install cargo-cache - uses: actions-rs/install@v0.1 - if: steps.cache.outputs.cache-hit != 'true' - with: - crate: cargo-cache - use-tool-cache: true - - name: Cleanup cache - if: steps.cache.outputs.cache-hit != 'true' - run: cargo cache -a diff --git a/.travis.yml b/.travis.yml index 67dc48d7..246eabdd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,9 +28,6 @@ jobs: - rust: nightly fast_finish: true include: - - os: osx - rust: 1.40.0 - - rust: 1.40.0 - {} - rust: beta - rust: nightly diff --git a/Cargo.toml b/Cargo.toml index 1a3c09e5..e1942beb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -54,9 +54,6 @@ harness = false name = "06_rustup" [badges] -travis-ci = { repository = "clap-rs/clap", branch = "master" } -azure-devops = { project = "clap-rs/clap", pipeline = "clap-rs.clap" } -coveralls = { repository = "clap-rs/clap", branch = "master" } is-it-maintained-issue-resolution = { repository = "clap-rs/clap" } is-it-maintained-open-issues = { repository = "clap-rs/clap" } maintenance = {status = "actively-developed"} diff --git a/bors.toml b/bors.toml index 6205d35e..aebf8ebd 100644 --- a/bors.toml +++ b/bors.toml @@ -1,11 +1,13 @@ status = [ "continuous-integration/travis-ci/push", "clap-rs.clap", + "Tests", "Release Profile Tests", ] pr_status = [ "continuous-integration/travis-ci/pr", "clap-rs.clap", + "Tests", "Release Profile Tests", ] timeout_sec = 7200