Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small enchancements to CI/CD pipeline #10

Merged
merged 2 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 0 additions & 85 deletions .github/workflows/build.yml

This file was deleted.

109 changes: 109 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: CI

on:
push:
pull_request:
types: [opened, synchronize, reopened]
GwnDaan marked this conversation as resolved.
Show resolved Hide resolved

env:
CARGO_TERM_COLOR: always
NUM_JOBS: 2
RUSTFLAGS: -Dwarnings

jobs:
# Run Format, Lint, and Test in parallel. This way we can get feedback on all topics
# instead of (possibly) failing fast on the first one. It should also be faster.
Notgnoshi marked this conversation as resolved.
Show resolved Hide resolved
rustfmt:
name: Format
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
components: rustfmt

- name: Setup cache
uses: Swatinem/rust-cache@v2

- name: Check formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --check

lint:
name: Lint
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
components: clippy

- name: Setup cache
uses: Swatinem/rust-cache@v2

- name: Check linting
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets --all-features

test_coverage:
name: Test and coverage
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true

- name: Setup cache
uses: Swatinem/rust-cache@v2

- name: Setup tarpaulin
uses: taiki-e/install-action@v2
with:
tool: cargo-tarpaulin

- name: Test
uses: actions-rs/cargo@v1
with:
command: tarpaulin
args: --release --all-features --out xml
GwnDaan marked this conversation as resolved.
Show resolved Hide resolved

# TODO: Code coverage badge on README (codecov.io?)
GwnDaan marked this conversation as resolved.
Show resolved Hide resolved

- name: PR coverage report comment
Notgnoshi marked this conversation as resolved.
Show resolved Hide resolved
uses: 5monkeys/cobertura-action@v13
if: github.event_name == 'pull_request'
with:
path: 'cobertura.xml'
repo_token: ${{ secrets.GITHUB_TOKEN }}
only_changed_files: true
show_line: true
show_branch: true
skip_covered: false
# If we want to enforce a minimum coverage percentage, this is how.
minimum_coverage: 0
fail_below_threshold: false
13 changes: 9 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build
name: Docs
on: [push]

jobs:
Expand All @@ -9,13 +9,18 @@ jobs:
CARGO_TERM_COLOR: always
NUM_JOBS: 2
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
- name: Checkout sources
uses: actions/checkout@v3

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- uses: Swatinem/rust-cache@v2

- name: Setup cache
uses: Swatinem/rust-cache@v2

- name: Build documentation
uses: actions-rs/cargo@v1
Expand Down
Loading