From 6c4749e8f55d91e5b23cf8cac6b79e6d322fd147 Mon Sep 17 00:00:00 2001 From: Nathaniel Brough Date: Mon, 23 Jan 2023 09:07:57 -0800 Subject: [PATCH 1/2] fix(fuzz): Fixes broken Cargo.toml for fuzz tests Fixes broken Cargo.toml for fuzz tests and adds building of fuzz tests to the CI. --- .github/workflows/fuzz.yml | 43 +++++++++++++++++++++++++++++++++++ crates/syntax/fuzz/Cargo.toml | 12 ++++------ 2 files changed, 47 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/fuzz.yml diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml new file mode 100644 index 0000000000..95bc386abc --- /dev/null +++ b/.github/workflows/fuzz.yml @@ -0,0 +1,43 @@ +name: Fuzz +on: + schedule: + # Once a week + - cron: '0 0 * * 0' + push: + paths: + - '.github/workflows/fuzz.yml' + # Allow manual trigger + workflow_dispatch: + +env: + CARGO_INCREMENTAL: 0 + CARGO_NET_RETRY: 10 + CI: 1 + RUST_BACKTRACE: short + RUSTFLAGS: "-D warnings -W unreachable-pub -W bare-trait-objects" + RUSTUP_MAX_RETRIES: 10 + +jobs: + rust: + if: ${{ (github.repository == 'rust-lang/rust-analyzer') || (github.event.action == 'workflow_dispatch') }} + name: Rust + runs-on: ubuntu-latest + env: + CC: deny_c + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 1 + + - name: Install Rust toolchain + run: | + rustup install --profile minimal nightly + + - name: Build fuzzers + run: | + cargo install cargo-fuzz + cd crates/syntax + cargo +nightly fuzz build diff --git a/crates/syntax/fuzz/Cargo.toml b/crates/syntax/fuzz/Cargo.toml index 802141e591..6070222f1f 100644 --- a/crates/syntax/fuzz/Cargo.toml +++ b/crates/syntax/fuzz/Cargo.toml @@ -1,21 +1,17 @@ - [package] name = "syntax-fuzz" version = "0.0.1" publish = false - -authors.workspace = true -edition.workspace = true -license.workspace = true -rust-version.workspace = true +edition = "2021" +rust-version = "1.66.1" [package.metadata] cargo-fuzz = true [dependencies] syntax = { path = "..", version = "0.0.0" } -text_edit = { path = "../../text_edit", version = "0.0.0" } -libfuzzer-sys = { git = "https://github.com/rust-fuzz/libfuzzer-sys.git" } +text-edit = { path = "../../text-edit", version = "0.0.0" } +libfuzzer-sys = "0.4.5" # Prevent this from interfering with workspaces [workspace] From 05d7d33a0f1f4a96bbf0619f648e5343451fe0e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Fri, 3 Feb 2023 13:15:27 +0200 Subject: [PATCH 2/2] Update .github/workflows/fuzz.yml --- .github/workflows/fuzz.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml index 95bc386abc..5af8aa1f77 100644 --- a/.github/workflows/fuzz.yml +++ b/.github/workflows/fuzz.yml @@ -19,7 +19,7 @@ env: jobs: rust: - if: ${{ (github.repository == 'rust-lang/rust-analyzer') || (github.event.action == 'workflow_dispatch') }} + if: ${{ github.repository == 'rust-lang/rust-analyzer' || github.event.action == 'workflow_dispatch' }} name: Rust runs-on: ubuntu-latest env: