forked from solana-labs/rbpf
-
Notifications
You must be signed in to change notification settings - Fork 1
129 lines (124 loc) · 4.24 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: sbpf
on:
push:
branches:
- main
tags:
- v*.*.*
pull_request:
branches:
- main
jobs:
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
rust: [stable, beta, nightly]
steps:
- uses: actions/checkout@v1
- name: Setup Rust (rustup)
run: |
rustup update ${{ matrix.rust }} --no-self-update
rustup default ${{ matrix.rust }}
rustup component add clippy
rustup component add rustfmt
shell: bash
- name: Lint
run: |
cargo fmt --all -- --check
cargo clippy --all --tests -- --deny=warnings
if: matrix.rust == 'nightly'
shell: bash
- name: Build and test
run: |
export RUSTFLAGS="-D warnings"
cargo build --verbose
cargo build --features="shuttle-test"
cargo test --verbose
cargo test --test exercise_instructions --verbose
shell: bash
- name: CLI - Lint
run: |
cargo fmt --all --manifest-path cli/Cargo.toml -- --check
cargo clippy --all --tests --manifest-path cli/Cargo.toml -- --deny=warnings
if: matrix.rust == 'nightly'
shell: bash
- name: CLI - Build and test
run: |
export RUSTFLAGS="-D warnings"
cargo build --manifest-path cli/Cargo.toml --verbose
cargo test --manifest-path cli/Cargo.toml --verbose
shell: bash
- name: Check fuzz
run: |
export RUSTFLAGS="-D warnings"
cargo install cargo-fuzz
cargo fuzz build
if: matrix.rust == 'nightly' && matrix.os != 'windows-latest'
shell: bash
- name: Benchmark
run: RUSTFLAGS="-D warnings" cargo bench -- --nocapture
if: matrix.rust == 'nightly' && matrix.os != 'windows-latest'
shell: bash
- name: (Continuous Fuzzing) Get commit hash
id: get-commit-hash
shell: bash
run: echo "commit_hash=$(git rev-parse HEAD 2>/dev/null)" >> $GITHUB_OUTPUT
if: matrix.rust == 'nightly' && matrix.os == 'ubuntu-latest'
- name: (Continuous Fuzzing) Upload fuzzers as GitHub Artifact
uses: actions/upload-artifact@v4
id: zip-upload-sbpf-fuzzers
with:
path: ./fuzz/target/x86_64-unknown-linux-gnu/release/
name: "artifact-rbpf-${{ matrix.os }}-${{github.run_id}}"
retention-days: 2
if: matrix.rust == 'nightly' && matrix.os == 'ubuntu-latest'
- name: (Continuous Fuzzing) Ping Fuzz Infrastructure
run: |
curl -L \
-X POST \
https://api.github.com/repos/asymmetric-research/FuzzCorp-bundler/dispatches \
-H 'Accept: application/vnd.github.everest-preview+json' \
-H "Authorization: Bearer ${{ secrets.PAT }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
--data '{"event_type": "rbpf_main", "client_payload":{"artifact_id": "${{steps.zip-upload-sbpf-fuzzers.outputs.artifact-id }}", "bundle_type": "${{ matrix.os }}", "hash":"${{ steps.get-commit-hash.outputs.commit_hash }}", "run_id":"${{ github.run_id}}", "name":"artifact-rbpf-${{ matrix.os }}-${{github.run_id}}"}}'
if: matrix.rust == 'nightly' && matrix.os == 'ubuntu-latest'
coverage:
name: Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Setup Rust (rustup)
run: |
rustup update nightly --no-self-update
rustup default nightly
rustup component add llvm-tools-preview
shell: bash
- name: Install cargo-llvm-cov
run: cargo install cargo-llvm-cov
shell: bash
- name: Generate test coverage
run: |
cargo llvm-cov --lcov --output-path coverage.info
shell: bash
- name: Upload test coverage
run: bash <(curl -s https://codecov.io/bash) -f coverage.info || echo "Codecov did not collect coverage reports"
shell: bash
release:
name: Release
needs: test
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
steps:
- uses: actions/checkout@v1
- name: Doc and package
run: |
cargo doc
cargo package
shell: bash
- name: Publish
env:
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
run: cargo publish --token "$CRATES_IO_TOKEN"