Skip to content

Commit

Permalink
build: improved CI and cleanup (#254)
Browse files Browse the repository at this point in the history
Signed-off-by: blu3beri <[email protected]>
  • Loading branch information
berendsliedrecht committed Mar 31, 2023
1 parent 42b7669 commit 49d6869
Show file tree
Hide file tree
Showing 37 changed files with 1,040 additions and 518 deletions.
15 changes: 15 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# -D: deny anything that goes wrong within this lint
# -W: warn the user what went wrong, but allow to build
# -A: allow the user to do "incorrect" behaviour
[build]
rustflags = ["-D", "clippy::all",
"-D", "clippy::pedantic",
"-D", "clippy::correctness",
"-D", "clippy::suspicious",
"-D", "clippy::style",
"-D", "clippy::complexity",
"-D", "clippy::perf",
"-D", "clippy::missing_docs_in_private_items",
"-A", "clippy::only_used_in_recursion",
"-A", "clippy::struct_excessive_bools",
"-A", "clippy::module_name_repetitions"]
20 changes: 20 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
coverage:
# Hold ourselves to a high bar
range: 85..100
round: down
precision: 1
status:
# ref: https://docs.codecov.com/docs/commit-status
project:
default:
# Avoid false negatives
threshold: 1%

# Test files aren't important for coverage
ignore:
- 'tests'

# Make comments less noisy
comment:
layout: 'files'
require_changes: true
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily
- package-ecosystem: cargo
directory: /
schedule:
interval: daily
ignore:
- dependency-name: '*'
# patch and minor updates don't matter for libraries
update-types:
- 'version-update:semver-patch'
- 'version-update:semver-minor'
88 changes: 88 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Check

permissions:
contents: read

on:
pull_request:
push:
branches:
- main

jobs:
format:
runs-on: ubuntu-latest
name: Format
steps:
- uses: actions/checkout@v3
- name: Install stable
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt

- name: Cache cargo resources
uses: Swatinem/rust-cache@v2
with:
shared-key: deps
cache-on-failure: true

- run: cargo fmt --all -- --check

clippy:
runs-on: ubuntu-latest
name: Clippy
permissions:
contents: read
checks: write
steps:
- uses: actions/checkout@v3
- name: Install stable
uses: dtolnay/rust-toolchain@stable
with:
components: clippy

- name: Cache cargo resources
uses: Swatinem/rust-cache@v2
with:
shared-key: deps
cache-on-failure: true

- run: cargo clippy

audit:
runs-on: ubuntu-latest
name: Audit
permissions:
contents: read
checks: write
steps:
- uses: actions/checkout@v3
- name: Install stable
uses: dtolnay/rust-toolchain@stable

- name: Cache cargo resources
uses: Swatinem/rust-cache@v2
with:
shared-key: deps
cache-on-failure: true

- run: cargo audit

check:
runs-on: ubuntu-latest
name: Check
permissions:
contents: read
checks: write
steps:
- uses: actions/checkout@v3
- name: Install stable
uses: dtolnay/rust-toolchain@stable

- name: Cache cargo resources
uses: Swatinem/rust-cache@v2
with:
shared-key: deps
cache-on-failure: true

- run: cargo check --workspace
38 changes: 0 additions & 38 deletions .github/workflows/code-coverage.yml

This file was deleted.

46 changes: 46 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Coverage

permissions:
contents: read

on:
pull_request:
push:
branches:
- main

jobs:
coverage:
runs-on: ubuntu-latest
name: Coverage
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install stable
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- name: cargo install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: cargo generate-lockfile
if: hashFiles('Cargo.lock') == ''
run: cargo generate-lockfile
- name: Cache cargo resources
uses: Swatinem/rust-cache@v2
with:
shared-key: deps
cache-on-failure: true
- name: Start acapy
run: docker-compose -f ./docker/docker-compose.acapy.min.yml up -d
- name: cargo llvm-cov clean
run: cargo llvm-cov clean --workspace
- name: cargo llvm-cov
run: cargo llvm-cov --locked --all-features --no-report --release
- name: cargo llvm-cov report
run: cargo llvm-cov report --release --lcov --output-path lcov.info
- name: Upload to codecov.io
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
17 changes: 10 additions & 7 deletions .github/workflows/e2e-tests.yml → .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@ on:
jobs:
e2e_test:
runs-on: ubuntu-latest
name: E2E Test
steps:
- run: sudo apt-get update
- run: sudo apt-get install libxcb-shape0-dev libxcb-xfixes0-dev
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install stable
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo resources
uses: Swatinem/rust-cache@v2
with:
shared-key: deps
cache-on-failure: true
- name: Start acapy
run: docker-compose -f ./docker/docker-compose.acapy.min.yml up -d
- name: Build siera
uses: actions-rs/cargo@v1
with:
command: build
- name: E2E tests
run: make e2e-test
- run: cargo test e2e_tests
22 changes: 0 additions & 22 deletions .github/workflows/lint.yml

This file was deleted.

32 changes: 32 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Test

permissions:
contents: read

on:
pull_request:
push:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest
name: Test
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt

- name: Cache cargo resources
uses: Swatinem/rust-cache@v2
with:
shared-key: deps
cache-on-failure: true

- name: Tests
run: cargo test --workspace --exclude=e2e-tests
Loading

0 comments on commit 49d6869

Please sign in to comment.