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

build: improved CI and cleanup #254

Merged
merged 1 commit into from
Mar 31, 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
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why cahce the failed resources?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mainly taken this from a rust CI under Hyperlegder, but if we fetch 80% of deps and fail we still whould like to cache 80% of the deps. I actually will check later on if caching is setup properly inside the CI though.


- 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.


- 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting that this doesn't fail w/o this flag provided

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uploading coverage can fail if their site or anything is down which might make it annoying. I would like to be strict here and only pass if everything works. Not opposed to removing it though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I see your reasoning. I meant more as in I would've thought initially that if error occurs it fail w/o having to explicitly set this

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