From 6a5e899a11542ff43515abeee6d9dd28f2b2e2de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20H=C3=A5kansson?= Date: Sat, 17 Jun 2023 12:24:42 +0200 Subject: [PATCH] chore: Use Github actions for testing --- .github/workflows/test.yml | 58 ++++++++++++++++++++++++++++++++++++++ README.md | 2 +- azure-pipelines.yml | 34 ---------------------- ci/azure-install-rust.yml | 22 --------------- 4 files changed, 59 insertions(+), 57 deletions(-) create mode 100644 .github/workflows/test.yml delete mode 100644 azure-pipelines.yml delete mode 100644 ci/azure-install-rust.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..c78326e --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,58 @@ +name: Tests + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + test: + name: Test + + runs-on: ${{ matrix.os }} + strategy: + matrix: + build: [linux-stable, macos-stable, windows-stable] + include: + - build: linux-stable + os: ubuntu-latest + rust: stable + - build: macos-stable + os: macos-latest + rust: stable + - build: windows-stable + os: windows-latest + rust: stable + + steps: + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: ${{ matrix.rust }} + - name: Cache dependencies + uses: actions/cache@v3 + env: + cache-name: cache-dependencies + with: + path: | + ~/.cargo/.crates.toml + ~/.cargo/.crates2.json + ~/.cargo/bin + ~/.cargo/registry/index + ~/.cargo/registry/cache + target + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('Cargo.lock') }} + + - name: Run Tests + run: cargo test --all --locked + env: + RUST_BACKTRACE: 1 + + - name: Clippy + run: cargo clippy + + - name: Cargo fmt + run: cargo fmt --all -- --check diff --git a/README.md b/README.md index 93eb7c3..e01a084 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Install a binary from a path to a global cache. -[![Build Status](https://dev.azure.com/rustwasm/binary-install/_apis/build/status/rustwasm.binary-install?branchName=master)](https://dev.azure.com/rustwasm/binary-install/_build/latest?definitionId=1&branchName=master) +[![Build Status](https://github.com/rustwasm/binary-install/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/rustwasm/binary-install/actions/workflows/test.yml) [![crates.io](https://meritbadge.herokuapp.com/binary-install)](https://crates.io/crates/binary-install) [![API Documentation on docs.rs](https://docs.rs/binary-install/badge.svg)](https://docs.rs/binary-install) diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 766a3f7..0000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,34 +0,0 @@ -trigger: - branches: - include: - - refs/heads/master - - refs/tags/* - -jobs: - - job: test_binary_install - displayName: "Run binary-install crate tests (unix)" - pool: - vmImage: ubuntu-latest - steps: - - template: ci/azure-install-rust.yml - - script: cargo test - displayName: "binary-install test suite" - - - job: test_binary_install_windows - displayName: "Run binary-install crate tests (Windows)" - pool: - vmImage: windows-latest - steps: - - template: ci/azure-install-rust.yml - - script: cargo test - displayName: "binary-install test suite" - - - job: test_binary_install_nightly - displayName: "Run binary-install crate tests (nightly)" - pool: - vmImage: ubuntu-latest - steps: - - template: ci/azure-install-rust.yml - parameters: - toolchain: nightly - - script: cargo test diff --git a/ci/azure-install-rust.yml b/ci/azure-install-rust.yml deleted file mode 100644 index f3fd2bb..0000000 --- a/ci/azure-install-rust.yml +++ /dev/null @@ -1,22 +0,0 @@ -parameters: - toolchain: 'stable' - -steps: - - bash: | - curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $TOOLCHAIN - echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin" - displayName: Install rust - Unix - condition: ne( variables['Agent.OS'], 'Windows_NT' ) - env: - TOOLCHAIN: ${{ parameters.toolchain }} - - - bash: rustup update --no-self-update $TOOLCHAIN && rustup default $TOOLCHAIN - displayName: Install rust - Windows - condition: eq( variables['Agent.OS'], 'Windows_NT' ) - env: - TOOLCHAIN: ${{ parameters.toolchain }} - - - script: | - rustc -Vv - cargo -V - displayName: Query rust and cargo versions