Skip to content

Commit

Permalink
Migrate from Travis CI to Github Actions
Browse files Browse the repository at this point in the history
This commit is based on the Github Actions config
in slog-term :)
  • Loading branch information
Techcable committed Mar 23, 2022
1 parent 17d94eb commit 5d67e39
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 26 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
@@ -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
31 changes: 31 additions & 0 deletions .github/workflows/rustfmt.yml
Original file line number Diff line number Diff line change
@@ -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
51 changes: 51 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -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 }}"
26 changes: 0 additions & 26 deletions .travis.yml

This file was deleted.

0 comments on commit 5d67e39

Please sign in to comment.