Skip to content

Commit

Permalink
new actions setup
Browse files Browse the repository at this point in the history
  • Loading branch information
jofas committed Dec 15, 2022
1 parent 0fc998a commit 3c87a26
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 26 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Benchmark
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: write
jobs:
Benchmark:
runs-on: ubuntu-latest
container:
image: rust:latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Load cached dependencies
uses: Swatinem/rust-cache@v2
- name: Run benchmark
run: cargo bench -- --output-format bencher > bench.txt
- name: Load previous runs from cache
uses: actions/cache@v3
with:
path: cache/benchmarks
key: benchmark-${{ runner.os }}-${{ github.run_id }}
restore-keys: benchmark-${{ runner.os }}
- name: Save benchmark
uses: benchmark-action/github-action-benchmark@v1
with:
tool: 'cargo'
output-file-path: bench.txt
external-data-json-path: cache/benchmarks/benchmarks.json
github-token: ${{ secrets.GITHUB_TOKEN }}
save-data-file: ${{ github.event_name != 'pull_request' }}
comment-always: true
comment-on-alert: true
fail-on-alert: false
alert-threshold: '150%'
51 changes: 25 additions & 26 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,44 @@
name: Build
on: [push]
permissions:
contents: write
jobs:
Cleanup:
CleanupAndTest:
runs-on: ubuntu-latest
container:
image: rust:latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Add cargo features
run: rustup component add rustfmt clippy
- name: Clippy fix
run: cargo clippy --all-features --all-targets --fix
- name: Fmt
run: cargo fmt
- name: Checkout repository
uses: actions/checkout@v3
with:
path: repo
- name: Load cached dependencies
uses: Swatinem/rust-cache@v2
with:
key: clippy
- name: Fmt + clippy
run: |
cd repo
cargo clippy --all-features --all-targets --fix
cargo fmt
- name: Toc
run: |
curl https://raw.githubusercontent.com/ekalinin/github-markdown-toc/master/gh-md-toc -o gh-md-toc
chmod a+x gh-md-toc
./gh-md-toc --insert --no-backup --hide-footer --skip-header README.md
./gh-md-toc --insert --no-backup --hide-footer --skip-header repo/README.md
rm gh-md-toc
- name: Apply cleanup
uses: EndBug/add-and-commit@v9
with:
message: 'applying code formatting, lint fixes and toc creation'
Build:
runs-on: ubuntu-latest
container:
image: xd009642/tarpaulin:latest
options: --security-opt seccomp=unconfined
needs: Cleanup
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Add clippy
run: rustup component add clippy
cwd: repo
- name: Fail build if clippy finds any error or warning
run: cargo clippy --all-features --all-targets -- -D warnings
- name: Generate code coverage
run: cargo tarpaulin --verbose --all-features --workspace --timeout 120 --out Xml
- name: Upload to codecov.io
uses: codecov/codecov-action@v2
with:
fail_ci_if_error: true
run: |
cd repo
cargo clippy --all-features --all-targets -- -D warnings -D clippy::pedantic
- name: Run test suite
run: |
cd repo
cargo test
23 changes: 23 additions & 0 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Codecov
on: [push]
permissions:
contents: write
jobs:
Codecov:
runs-on: ubuntu-latest
container:
image: xd009642/tarpaulin:latest
options: --security-opt seccomp=unconfined
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Load cached dependencies
uses: Swatinem/rust-cache@v2
with:
key: tarpaulin
- name: Generate code coverage
run: cargo tarpaulin --verbose --all-features --workspace --timeout 120 --out Xml
- name: Upload to codecov.io
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true

0 comments on commit 3c87a26

Please sign in to comment.