Skip to content

Commit d7ffb91

Browse files
committed
Switch from Travis -> Github Actions
Mostly copied from slog-rs Changes: 1. We have a different MSRV 2. We error if 'clippy' fails (we encounter any of its "correctness" lints)
1 parent 970bc4c commit d7ffb91

File tree

4 files changed

+118
-25
lines changed

4 files changed

+118
-25
lines changed

.github/workflows/clippy.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# This is the clippy workflow, seperate from the main 'Rust' workflow
2+
#
3+
# This will fail if clippy fails (if we encounter any of its "correctness" lints)
4+
#
5+
# Clippy warnings won't fail the build. They may or may not turn into Github warnings.
6+
on: [push, pull_request]
7+
name: Clippy
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
# has a history of occasional bugs (especially on old versions)
12+
#
13+
# the ci is free so we might as well use it ;)
14+
CARGO_INCREMENTAL: 0
15+
16+
17+
jobs:
18+
clippy:
19+
# Only run on PRs if the source branch is on someone else's repo
20+
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
21+
runs-on: ubuntu-latest
22+
strategy:
23+
matrix:
24+
rust:
25+
- stable
26+
steps:
27+
- uses: actions/checkout@v2
28+
- uses: actions-rs/toolchain@v1
29+
with:
30+
profile: minimal
31+
toolchain: ${{ matrix.rust }}
32+
override: true
33+
components: clippy
34+
- shell: bash
35+
run: |
36+
cargo clippy

.github/workflows/rustfmt.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# The file is the workflow for rustfmt
2+
#
3+
# It runs `cargo fmt --check`
4+
#
5+
# It will fail if there are formatting problems.
6+
on: [push, pull_request]
7+
name: rustfmt
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
rustfmt:
14+
# Only run on PRs if the source branch is on someone else's repo
15+
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
16+
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
rust:
20+
- stable
21+
steps:
22+
- uses: actions/checkout@v2
23+
- uses: actions-rs/toolchain@v1
24+
with:
25+
profile: minimal
26+
toolchain: ${{ matrix.rust }}
27+
override: true
28+
components: rustfmt
29+
- shell: bash
30+
run: |
31+
cargo fmt -- --check

.github/workflows/test.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# We use `actions-rs` for most of our actions
2+
#
3+
# This file is for the main tests. clippy & rustfmt are seperate workflows
4+
#
5+
# It is mostly copied from slog-rs/slog
6+
on: [push, pull_request]
7+
name: Cargo Test
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
# has a history of occasional bugs (especially on old versions)
12+
#
13+
# the ci is free so we might as well use it ;)
14+
CARGO_INCREMENTAL: 0
15+
16+
17+
# Tested versions:
18+
# 1. stable
19+
# 2. nightly
20+
# 3. Minimum Supported Rust Version (MSRV)
21+
22+
jobs:
23+
test:
24+
# Only run on PRs if the source branch is on someone else's repo
25+
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
26+
27+
runs-on: ubuntu-latest
28+
strategy:
29+
fail-fast: false # Even if one job fails we still want to see the other ones
30+
matrix:
31+
# 1.53 is MSRV. Keep in sync with Cargo.toml
32+
rust: [1.53, stable, nightly]
33+
# NOTE: Features to test must be specified manually. They are applied to all versions seperately.
34+
#
35+
# This has the advantage of being more flexibile and thorough
36+
# This has the disadvantage of being more vebrose
37+
#
38+
# Specific feature combos can be overriden per-version with 'include' and 'exclude'
39+
features: ["", "nested-values", "dynamic-keys", "nested-values dynamic-keys"]
40+
41+
steps:
42+
- uses: actions/checkout@v2
43+
- uses: actions-rs/toolchain@v1
44+
with:
45+
toolchain: ${{ matrix.rust }}
46+
override: true
47+
# NOTE: We only run `cargo test`. No need for a seperate `cargo check`
48+
- name: Test
49+
run: |
50+
cargo test --verbose --features "${{ matrix.features }}"
51+

.travis.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)