Implement initial version of fuzzing in CI (#7316)

* Implement initial version of fuzzing

* try nix config

* try rustup

* rustup run

* Fix syntax

* wip

* specific nightly

* wip

* specific nightly with+

* install

* locked
This commit is contained in:
Joshua Warner 2024-12-11 03:57:24 -08:00 committed by GitHub
parent d746e2a041
commit a5bcf55d08
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 40 additions and 10 deletions

View file

@ -2,7 +2,7 @@ on:
#pull_request:
workflow_dispatch:
schedule:
- cron: '0 9 * * *'
- cron: "0 9 * * *"
name: Nightly Release Linux x86_64
@ -29,7 +29,7 @@ jobs:
# target-cpu=x86-64 -> For maximal compatibility for all CPU's. This was also faster in our tests: https://roc.zulipchat.com/#narrow/stream/231635-compiler-development/topic/.2Ecargo.2Fconfig.2Etoml/near/325726299
- name: get commit SHA
run: echo "SHA=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV
run: echo "SHA=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV
- name: get date
run: echo "DATE=$(date "+%Y-%m-%d")" >> $GITHUB_ENV
@ -40,14 +40,14 @@ jobs:
- name: Upload wasm repl tar. Actually uploading to github releases has to be done manually.
uses: actions/upload-artifact@v4
with:
name: roc_repl_wasm.tar.gz
path: roc_repl_wasm.tar.gz
retention-days: 4
name: roc_repl_wasm.tar.gz
path: roc_repl_wasm.tar.gz
retention-days: 4
- name: build file name
env:
DATE: ${{ env.DATE }}
SHA: ${{ env.SHA }}
DATE: ${{ env.DATE }}
SHA: ${{ env.SHA }}
run: echo "RELEASE_FOLDER_NAME=roc_nightly-linux_x86_64-$DATE-$SHA" >> $GITHUB_ENV
# this makes the roc binary a lot smaller
@ -60,6 +60,6 @@ jobs:
- name: Upload roc nightly tar. Actually uploading to github releases has to be done manually.
uses: actions/upload-artifact@v4
with:
name: ${{ env.RELEASE_FOLDER_NAME }}.tar.gz
path: ${{ env.RELEASE_FOLDER_NAME }}.tar.gz
retention-days: 4
name: ${{ env.RELEASE_FOLDER_NAME }}.tar.gz
path: ${{ env.RELEASE_FOLDER_NAME }}.tar.gz
retention-days: 4

View file

@ -29,6 +29,11 @@ jobs:
- name: roc format check on builtins
run: cargo run --locked --release format --check crates/compiler/builtins/roc
- name: run fuzz tests
run: |
cargo +nightly-2024-02-03 install --locked cargo-fuzz
cd crates/compiler/test_syntax/fuzz && cargo +nightly-2024-02-03 fuzz run -j4 fuzz_expr --sanitizer=none -- -dict=dict.txt -max_total_time=60
- name: ensure there are no unused dependencies
run: cargo +nightly-2024-02-03 udeps --all-targets

View file

@ -0,0 +1,25 @@
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
buildInputs = [
(pkgs.rustup.override {
targets = ["x86_64-unknown-linux-gnu"]; # Adjust for your desired target
})
];
shellHook = ''
# Ensure rustup is initialized
export RUSTUP_HOME="$PWD/.rustup"
export CARGO_HOME="$PWD/.cargo"
mkdir -p $RUSTUP_HOME $CARGO_HOME
# Install Rust nightly
rustup install nightly
rustup default nightly
# Add rustup and cargo to PATH
export PATH="$CARGO_HOME/bin:$PATH"
echo "Rust nightly and Cargo are available on PATH."
'';
}