Skip to content

Commit

Permalink
fixed mutants config
Browse files Browse the repository at this point in the history
Signed-off-by: Sienna Lloyd <sienna@linux.com>
  • Loading branch information
siennathesane committed Sep 12, 2024
1 parent 50dfe58 commit 33221bf
Show file tree
Hide file tree
Showing 14 changed files with 748 additions and 620 deletions.
2 changes: 2 additions & 0 deletions .actrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-P ubuntu-latest=ghcr.io/catthehacker/ubuntu:rust-latest
--artifact-server-path artifacts
8 changes: 7 additions & 1 deletion .github/codecov.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ coverage:
project:
default:
informational: true
target: 80%
threshold: 1%
patch:
default:
target: 0%
target: 80%
threshold: 1%
comment:
layout: " diff, flags, files"
behavior: default
77 changes: 0 additions & 77 deletions .github/workflows/codeql.yml

This file was deleted.

88 changes: 76 additions & 12 deletions .github/workflows/pull_requests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ jobs:
run: |
rustup toolchain install nightly
rustup default nightly
- name: install clang
if: github.actor == 'nektos/act'
run: |
apt-get update
apt-get install -y clang
- name: build
run: cargo build
test:
Expand All @@ -34,42 +39,69 @@ jobs:
run: |
rustup toolchain install nightly
rustup default nightly
- name: install clang
if: github.actor == 'nektos/act'
run: |
apt-get update
apt-get install -y clang
- uses: taiki-e/install-action@v2
with:
tool: cargo-nextest
- name: install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: test
run: cargo llvm-cov nextest --ignore-filename-regex nova-api --all --lcov --output-path lcov.info
run: cargo llvm-cov nextest --ignore-filename-regex nova-api --all --benches --lcov --output-path lcov.info
- name: upload code coverage
uses: codecov/codecov-action@v4
with:
files: lcov.info
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
test-incremental-mutants:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 0
- name: install clang
if: github.actor == 'nektos/act'
run: |
apt-get update
apt-get install -y clang
- uses: taiki-e/install-action@v2
with:
tool: cargo-mutants,cargo-nextest
- name: generate diff
if: github.actor != 'nektos/act'
continue-on-error: true
run: |
git branch -av
git diff origin/${{ github.base_ref }}.. | tee git.diff
- run: cargo mutants --test-tool=nextest -vV --in-place --in-diff git.dff
git diff origin/${{ github.base_ref }}.. > git.diff
- name: generate local diff
if: github.actor == 'nektos/act'
continue-on-error: true
run: |
git branch -av
git diff mainline > git.diff
- run: cargo mutants --test-tool=nextest -vV --in-diff git.diff
- uses: actions/upload-artifact@v4
if: always()
with:
name: mutants-out
path: mutants.out
name: mutants
overwrite: true
bench:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: install clang
if: github.actor == 'nektos/act'
run: |
apt-get update
apt-get install -y clang
- name: setup rust
run: |
rustup toolchain install nightly
Expand All @@ -80,14 +112,46 @@ jobs:
uses: actions/upload-artifact@v4
with:
path: bench.txt
name: benchmarks
overwrite: true
update-pr:
if: always()
needs:
- test-incremental-mutants
- bench
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: download artifacts
uses: actions/download-artifact@v4
with:
path: build/
merge-multiple: true
- name: list artifacts
run: ls -R
- name: prep benchmark comment
run: |
echo "## Benchmark Results" > prepped-bench.txt
echo "```sh" >> prepped-bench.txt
cat bench.txt >> prepped-bench.txt
echo "```" >> prepped-bench.txt
- name: add bench to pr
echo "## Benchmark Results" > results.txt
echo '```sh' >> results.txt
cat build/bench.txt >> results.txt
echo '```' >> results.txt
echo "## Possible Bugs" >> results.txt
echo '```' >> results.txt
cat build/missed.txt >> results.txt
echo '```' >> results.txt
- name: save results locally
if: github.actor == 'nektos/act'
uses: actions/upload-artifact@v4
with:
path: results.txt
name: results
- name: update pr comment
if: github.actor != 'nektos/act'
uses: thollander/actions-comment-pull-request@v2
with:
filePath: prepped-bench.txt
filePath: results.txt
comment_tag: execution
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@ Cargo.lock
# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb
lcov.info
mutants.out/
mutants*/
artifacts/
39 changes: 37 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,43 @@
# Contributing

## Tools

* [Rust](https://www.rust-lang.org/)
* [clang](https://clang.llvm.org/)
* [nextest](https://nexte.st/)
* Optional
* [llvm-cov](https://github.com/taiki-e/cargo-llvm-cov)
* [act](https://github.com/nektos/act) (requires Docker or compatible)

## Pull Request Process

* Open a ticket to make sure the feature is needed
* Fork the repository
* Create a branch with a descriptive name that starts with the type of change
* Use `feat/` for new features (or anything that adds functionality)
* Use `bug/` for bug fixes
* Use `refactor/` for refactors
* Use `doc/` for documentation changes
* Use `test/` for test changes
* Make your changes
* Write tests
* Format your code with `cargo fmt`
* Commit your changes
* Optionally: validate your changes ahead of time with `act pull_request`

Validating your changes ahead of time is both faster and more resource intensive than waiting for the GHA runners. While it's faster (GHA jobs take nearly 20m), it's also more resource intensive. It's recommended the Docker host have at least 4 cores and 8GB of RAM or it won't be much faster than GHA runners.

## Coding Style

### General

* Use `cargo fmt` to format your code

### Hot Paths

For hot paths, we use the following rules:
* never use `String`, `str`, or other heap-allocated types
For hot paths, I have the following rules:
* Never use heap-allocated types

### Workflows

When possible, it's best to ensure that your workflows will work locally with `act`. You can separate local vs GHA steps via `if: github.actor == 'nektos/act'` for local steps and `if: github.actor != 'nektos/act'` for GHA steps.
Loading

0 comments on commit 33221bf

Please sign in to comment.