| 1 |
name: av1-grain-ubuntu |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: |
| 6 |
- main |
| 7 |
pull_request: |
| 8 |
branches: |
| 9 |
- main |
| 10 |
|
| 11 |
jobs: |
| 12 |
build-test: |
| 13 |
runs-on: ubuntu-latest |
| 14 |
|
| 15 |
steps: |
| 16 |
- uses: actions/checkout@v3 |
| 17 |
|
| 18 |
- name: Install Rust stable |
| 19 |
uses: actions-rs/toolchain@v1 |
| 20 |
with: |
| 21 |
profile: minimal |
| 22 |
toolchain: stable |
| 23 |
override: true |
| 24 |
components: rustfmt, clippy |
| 25 |
- uses: Swatinem/rust-cache@v2 |
| 26 |
|
| 27 |
- name: Run rustfmt |
| 28 |
uses: actions-rs/cargo@v1 |
| 29 |
with: |
| 30 |
command: fmt |
| 31 |
args: -- --check --verbose |
| 32 |
|
| 33 |
- name: Run cargo clippy |
| 34 |
uses: actions-rs/clippy-check@v1 |
| 35 |
with: |
| 36 |
token: ${{ secrets.GITHUB_TOKEN }} |
| 37 |
args: --all-targets --tests --benches -- -D warnings |
| 38 |
|
| 39 |
- name: Build |
| 40 |
run: cargo build --verbose --tests --benches |
| 41 |
|
| 42 |
- name: Run tests |
| 43 |
run: cargo test --verbose |
| 44 |
|
| 45 |
- name: Install cargo-msrv |
| 46 |
uses: taiki-e/install-action@v2 |
| 47 |
with: |
| 48 |
tool: cargo-msrv |
| 49 |
|
| 50 |
- name: Validate minimum Rust version |
| 51 |
run: | |
| 52 |
cargo msrv verify |
| 53 |
|
| 54 |
- name: Generate docs |
| 55 |
run: cargo doc --no-deps |
| 56 |
|
| 57 |
code-coverage: |
| 58 |
needs: [build-test] |
| 59 |
runs-on: ubuntu-latest |
| 60 |
|
| 61 |
steps: |
| 62 |
- uses: actions/checkout@v3 |
| 63 |
|
| 64 |
- name: Install cargo-llvm-cov |
| 65 |
uses: taiki-e/install-action@v2 |
| 66 |
with: |
| 67 |
tool: cargo-llvm-cov |
| 68 |
|
| 69 |
- name: Generate code coverage |
| 70 |
run: cargo llvm-cov --lcov --output-path lcov.log |
| 71 |
|
| 72 |
- name: Upload coverage to Codecov |
| 73 |
uses: codecov/codecov-action@v5 |
| 74 |
with: |
| 75 |
token: ${{ secrets.CODECOV_TOKEN }} |
| 76 |
files: lcov.log |
| 77 |
fail_ci_if_error: true |
| 78 |
|
| 79 |
memory-and-threads-dynamic-analysis: |
| 80 |
needs: [build-test] |
| 81 |
runs-on: ubuntu-latest |
| 82 |
|
| 83 |
steps: |
| 84 |
- uses: actions/checkout@v3 |
| 85 |
|
| 86 |
- name: Install Rust stable |
| 87 |
uses: actions-rs/toolchain@v1 |
| 88 |
with: |
| 89 |
toolchain: stable |
| 90 |
override: true |
| 91 |
|
| 92 |
- name: Install valgrind |
| 93 |
run: | |
| 94 |
sudo apt-get install valgrind |
| 95 |
|
| 96 |
# FIXME Use binaries |
| 97 |
- name: Install cargo-valgrind |
| 98 |
run: | |
| 99 |
cargo install cargo-valgrind |
| 100 |
|
| 101 |
# Usage of the `help` command as base command, please replace it |
| 102 |
# with the effective command that valgrind has to analyze |
| 103 |
- name: Run cargo-valgrind |
| 104 |
run: | |
| 105 |
cargo valgrind run -- --help |
| 106 |
|
| 107 |
undefined-behaviour-fuzzy-dynamic-analysis: |
| 108 |
needs: [build-test] |
| 109 |
runs-on: ubuntu-latest |
| 110 |
|
| 111 |
steps: |
| 112 |
- uses: actions/checkout@v3 |
| 113 |
|
| 114 |
- name: Cache produced data |
| 115 |
uses: actions/cache@v3 |
| 116 |
with: |
| 117 |
path: | |
| 118 |
~/.cargo/bin/ |
| 119 |
~/.cargo/registry/index/ |
| 120 |
~/.cargo/registry/cache/ |
| 121 |
~/.cargo/git/db/ |
| 122 |
target/ |
| 123 |
key: ${{ runner.os }}-cargo-ci-${{ hashFiles('**/Cargo.toml') }} |
| 124 |
|
| 125 |
- name: Install Rust nightly and miri |
| 126 |
uses: actions-rs/toolchain@v1 |
| 127 |
with: |
| 128 |
toolchain: nightly |
| 129 |
components: miri |
| 130 |
override: true |
| 131 |
|
| 132 |
# FIXME Use binaries |
| 133 |
- name: Install cargo-fuzz |
| 134 |
run: | |
| 135 |
cargo install cargo-fuzz --force |
| 136 |
|
| 137 |
- name: Run miri |
| 138 |
env: |
| 139 |
# -Zrandomize-layout makes sure not to rely on the layout of anything |
| 140 |
# that might change |
| 141 |
RUSTFLAGS: -Zrandomize-layout |
| 142 |
# -Zmiri-strict-provenance enables strict provenance checking in Miri. |
| 143 |
# This means that casting an integer to a pointer will stop execution |
| 144 |
# because the provenance of the pointer cannot be determined. |
| 145 |
# -Zmiri-symbolic-alignment-check makes the alignment check more strict. |
| 146 |
MIRIFLAGS: > |
| 147 |
-Zmiri-strict-provenance |
| 148 |
-Zmiri-symbolic-alignment-check |
| 149 |
run: cargo miri test |
| 150 |
|
| 151 |
# FIXME Create a template with a dummy series of fuzzy tests |
| 152 |
- name: Init cargo-fuzz |
| 153 |
run: cargo fuzz init |
| 154 |
|
| 155 |
- name: Run cargo-fuzz |
| 156 |
run: cargo fuzz build |
| 157 |
|
| 158 |
static-code-analysis: |
| 159 |
needs: [build-test] |
| 160 |
runs-on: ubuntu-latest |
| 161 |
|
| 162 |
steps: |
| 163 |
- uses: actions/checkout@v3 |
| 164 |
|
| 165 |
- name: Install rust-code-analysis |
| 166 |
env: |
| 167 |
RCA_LINK: https://github.com/mozilla/rust-code-analysis/releases/download |
| 168 |
RCA_VERSION: v0.0.23 |
| 169 |
run: | |
| 170 |
mkdir -p $HOME/.local/bin |
| 171 |
curl -L "$RCA_LINK/$RCA_VERSION/rust-code-analysis-linux-cli-x86_64.tar.gz" | |
| 172 |
tar xz -C $HOME/.local/bin |
| 173 |
echo "$HOME/.local/bin" >> $GITHUB_PATH |
| 174 |
|
| 175 |
- name: Run rust-code-analysis |
| 176 |
run: | |
| 177 |
mkdir $HOME/rca-json |
| 178 |
# FIXME: Update rca version to analyze the entire directory of a repo |
| 179 |
rust-code-analysis-cli --metrics -O json --pr -o "$HOME/rca-json" -p src/ |
| 180 |
|
| 181 |
- name: Upload rust-code-analysis json |
| 182 |
uses: actions/upload-artifact@v4 |
| 183 |
with: |
| 184 |
name: rca-json-ubuntu |
| 185 |
path: ~/rca-json |