From 5d67e390ee5c9ac4a2ee08791f6aabc080c81db5 Mon Sep 17 00:00:00 2001 From: Techcable Date: Tue, 22 Mar 2022 17:35:50 -0700 Subject: [PATCH] Migrate from Travis CI to Github Actions This commit is based on the Github Actions config in slog-term :) --- .github/workflows/clippy.yml | 39 +++++++++++++++++++++++++++ .github/workflows/rustfmt.yml | 31 +++++++++++++++++++++ .github/workflows/test.yml | 51 +++++++++++++++++++++++++++++++++++ .travis.yml | 26 ------------------ 4 files changed, 121 insertions(+), 26 deletions(-) create mode 100644 .github/workflows/clippy.yml create mode 100644 .github/workflows/rustfmt.yml create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml new file mode 100644 index 0000000..b1aa0ec --- /dev/null +++ b/.github/workflows/clippy.yml @@ -0,0 +1,39 @@ +# This is the clippy workflow, seperate from the main 'Rust' workflow +# +# This will fail if clippy fails (if we encounter any of its "correctness" lints) +# +# Clippy warnings won't fail the build. They may or may not turn into Github warnings. +# +# TODO: Test clippy with different feature combos? +# TODO: Should we fail on clippy warnings? +on: [push, pull_request] +name: Clippy + +env: + CARGO_TERM_COLOR: always + # has a history of occasional bugs (especially on old versions) + # + # the ci is free so we might as well use it ;) + CARGO_INCREMENTAL: 0 + + +jobs: + clippy: + # Only run on PRs if the source branch is on someone else's repo + if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }} + runs-on: ubuntu-latest + strategy: + matrix: + rust: + - stable + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.rust }} + override: true + components: clippy + - shell: bash + run: | + cargo clippy diff --git a/.github/workflows/rustfmt.yml b/.github/workflows/rustfmt.yml new file mode 100644 index 0000000..72659f5 --- /dev/null +++ b/.github/workflows/rustfmt.yml @@ -0,0 +1,31 @@ +# The file is the workflow for rustfmt +# +# It runs `cargo fmt --check` +# +# It will fail if there are formatting problems. +on: [push, pull_request] +name: rustfmt + +env: + CARGO_TERM_COLOR: always + +jobs: + rustfmt: + # Only run on PRs if the source branch is on someone else's repo + if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }} + runs-on: ubuntu-latest + strategy: + matrix: + rust: + - stable + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.rust }} + override: true + components: rustfmt + - shell: bash + run: | + cargo fmt -- --check diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..2d7bca6 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,51 @@ +# We use `actions-rs` for most of our actions +# +# This file is for the main tests. clippy & rustfmt are seperate workflows +# +# It is mostly copied from slog-rs/term +on: [push, pull_request] +name: Cargo Test + +env: + CARGO_TERM_COLOR: always + # has a history of occasional bugs (especially on old versions) + # + # the ci is free so we might as well use it ;) + CARGO_INCREMENTAL: 0 + + +# Tested versions: +# 1. stable +# 2. nightly +# 3. Minimum Supported Rust Version (MSRV) + +jobs: + test: + # Only run on PRs if the source branch is on someone else's repo + if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }} + + runs-on: ubuntu-latest + strategy: + fail-fast: false # Even if one job fails we still want to see the other ones + matrix: + # 1.39 is MSRV. Keep in sync with Cargo.toml + rust: [1.39, stable, nightly] + # NOTE: Features to test must be specified manually. They are applied to all versions seperately. + # + # This has the advantage of being more flexibile and thorough + # This has the disadvantage of being more vebrose + # + # Specific feature combos can be overriden per-version with 'include' and 'exclude' + features: ["", "kv_unstable"] + + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + override: true + # NOTE: We only run `cargo test`. No need for a seperate `cargo check` + - name: Test + run: | + cargo test --verbose --features "${{ matrix.features }}" + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 9be8a47..0000000 --- a/.travis.yml +++ /dev/null @@ -1,26 +0,0 @@ -language: rust -rust: - - stable - - beta - - nightly - -script: - - make all - - make travistest - - if [ "$TRAVIS_RUST_VERSION" == "nightly" ]; then make bench ; fi - - if [ "$TRAVIS_RUST_VERSION" == "nightly" ]; then cargo build --no-default-features; fi - -env: - global: - - RUST_BACKTRACE=1 - matrix: - - - - RELEASE=true - -notifications: - webhooks: - urls: - - https://webhooks.gitter.im/e/87a331e1a21456b6e2ad - on_success: change # options: [always|never|change] default: always - on_failure: change # options: [always|never|change] default: always - on_start: false # default: false