CI Check Reports Debugging #1894
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: [push, pull_request, workflow_dispatch] | |
name: Aderyn | |
jobs: | |
check: | |
name: Check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v2 | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- name: Run cargo check | |
uses: actions-rs/cargo@v1 | |
with: | |
command: check | |
test: | |
name: Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: foundry-toolchain | |
uses: foundry-rs/foundry-toolchain@v1.2.0 | |
- name: Checkout sources | |
uses: actions/checkout@v2 | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- name: Run cargo test | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
reports: | |
name: Check Reports | |
runs-on: ubuntu-latest | |
steps: | |
- name: foundry-toolchain | |
uses: foundry-rs/foundry-toolchain@v1.2.0 | |
- name: Checkout sources | |
uses: actions/checkout@v2 | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
# Verify report.md | |
- name: Generate report-workflow.md | |
uses: actions-rs/cargo@v1 | |
with: | |
command: run | |
args: -- -o report-workflow.md ./tests/contract-playground/ --skip-update-check | |
- name: Check report.md vs report-workflow.md | |
run: | | |
cat report-workflow.md | |
diff report.md report-workflow.md | |
# Verify sample profile report | |
- name: Generate report.sample_profile.workflow.md | |
uses: actions-rs/cargo@v1 | |
env: | |
FOUNDRY_PROFILE: sample | |
with: | |
command: run | |
args: -- -o report.sample_profile.workflow.md ./tests/contract-playground/ --skip-update-check | |
- name: Check report.sample_profile.md vs report.sample_profile.workflow.md | |
run: | | |
cat report.sample_profile.workflow.md | |
diff report.sample_profile.md report.sample_profile.workflow.md | |
# Verify report-config.md | |
- name: Generate report-config-workflow.md | |
uses: actions-rs/cargo@v1 | |
with: | |
command: run | |
args: -- --config-file ./tests/aderyn.config.json -o report-config-workflow.md ./tests/contract-playground/ --skip-update-check | |
- name: Check report-config.md vs report-config-workflow.md | |
run: | | |
cat report-config-workflow.md | |
diff report-config.md report-config-workflow.md | |
# Verify report.json | |
- name: Generate report-workflow.json | |
uses: actions-rs/cargo@v1 | |
with: | |
command: run | |
args: -- -o report-workflow.json ./tests/contract-playground/ --skip-update-check | |
- name: Check report.json vs report-workflow.json | |
run: | | |
cat report-workflow.json | |
diff report.json report-workflow.json | |
# Verify report-config.json | |
- name: Generate report-config-workflow.json | |
uses: actions-rs/cargo@v1 | |
with: | |
command: run | |
args: -- --config-file ./tests/aderyn.config.json -o report-config-workflow.json ./tests/contract-playground/ --skip-update-check | |
- name: Check report-config.json vs report-config-workflow.json | |
run: | | |
cat report-config-workflow.json | |
diff report-config.json report-config-workflow.json | |
# Verify bots can report | |
- name: Generate report3.json | |
uses: actions-rs/cargo@v1 | |
with: | |
command: run | |
args: -- --config-file ./tests/aderyn.config.json -o report3.json ./tests/contract-playground/ --skip-update-check | |
- name: Check report-config.json vs report3.json | |
run: | | |
cat report3.json | |
diff report-config.json report3.json | |
- name: Generate report3.md | |
uses: actions-rs/cargo@v1 | |
with: | |
command: run | |
args: -- --config-file ./tests/aderyn.config.json -o report3.md ./tests/contract-playground/ --skip-update-check | |
- name: Check report-config.md vs report3.md | |
run: | | |
cat report3.md | |
diff report-config.md report3.md | |
judgeopsreports: | |
name: Check judge.md report creation | |
runs-on: ubuntu-latest | |
steps: | |
- name: foundry-toolchain | |
uses: foundry-rs/foundry-toolchain@v1.2.0 | |
- name: Checkout sources | |
uses: actions/checkout@v2 | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
# Verify report.judge.md | |
- name: Generate report-workflow.judge.md | |
uses: actions-rs/cargo@v1 | |
with: | |
command: run | |
args: -- -o judgeops/current/report-workflow.judge.md ./tests/contract-playground/ --skip-update-check | |
- name: Check report.judge.md vs report-workflow.judge.md | |
run: | | |
cat judgeops/current/report-workflow.judge.md | |
diff judgeops/current/report.judge.md judgeops/current/report-workflow.judge.md | |
# Verify report-config.judge.md | |
- name: Generate report-config-workflow.judge.md | |
uses: actions-rs/cargo@v1 | |
with: | |
command: run | |
args: -- --config-file ./tests/aderyn.config.json -o judgeops/current/report-config-workflow.judge.md ./tests/contract-playground/ --skip-update-check | |
- name: Check report-config.judge.md vs report-config-workflow.judge.md | |
run: | | |
cat judgeops/current/report-config-workflow.judge.md | |
diff judgeops/current/report-config.judge.md judgeops/current/report-config-workflow.judge.md | |
judgeops: | |
name: Check metrics changes with feedback consistently | |
runs-on: ubuntu-latest | |
steps: | |
- name: foundry-toolchain | |
uses: foundry-rs/foundry-toolchain@v1.2.0 | |
- name: Checkout sources | |
uses: actions/checkout@v2 | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- name: Rename sample_db.json to sample_db-workflow.json | |
run: | | |
mv judgeops/samples/sample_db.json judgeops/samples/sample_db-workflow.json | |
- name: Generate sample_db.json | |
run: | | |
cli/sample_metricsdbgen.sh judgeops/samples/sample_db.json | |
- name: Check sample_db.json vs sample_db-workflow.json | |
run: | | |
cat judgeops/samples/sample_db.json | |
diff judgeops/samples/sample_db.json judgeops/samples/sample_db-workflow.json | |
lints: | |
name: Lints | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v2 | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
components: rustfmt, clippy | |
- name: Run cargo fmt | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all -- --check | |
- name: Run cargo clippy | |
uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
args: -- -D warnings | |
build: | |
name: Build | |
env: | |
# The project name specified in your Cargo.toml | |
PROJECT_NAME: aderyn | |
# Set the job to run on the platform specified by the matrix below | |
runs-on: ${{ matrix.runner }} | |
# Define the build matrix for cross-compilation | |
strategy: | |
matrix: | |
include: | |
- name: linux-amd64 | |
runner: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
- name: win-amd64 | |
runner: windows-latest | |
target: x86_64-pc-windows-msvc | |
- name: macos-amd64 | |
runner: macos-latest | |
target: x86_64-apple-darwin | |
- name: macos-arm64 | |
runner: macos-latest | |
target: aarch64-apple-darwin | |
# The steps to run for each matrix item | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: "${{ matrix.target }}" | |
- name: Setup Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Build Binary | |
run: cargo build --verbose --locked --release --target ${{ matrix.target }} | |
- name: Release Binary | |
shell: bash | |
run: | | |
BIN_SUFFIX="" | |
if [[ "${{ matrix.runner }}" == "windows-latest" ]]; then | |
BIN_SUFFIX=".exe" | |
fi | |
# The built binary output location | |
BIN_OUTPUT="target/${{ matrix.target }}/release/${PROJECT_NAME}${BIN_SUFFIX}" | |
# Define a better name for the final binary | |
BIN_RELEASE="${PROJECT_NAME}-${{ matrix.name }}${BIN_SUFFIX}" | |
BIN_RELEASE_VERSIONED="${PROJECT_NAME}-${{ github.ref_name }}-${{ matrix.name }}${BIN_SUFFIX}" | |
# Move the built binary where you want it | |
ls -la | |
mv "${BIN_OUTPUT}" "./${BIN_RELEASE}" | |
# Export BIN_RELEASE to GITHUB_ENV | |
echo "BIN_RELEASE=${BIN_RELEASE}" >> $GITHUB_ENV | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ${{ env.BIN_RELEASE }} | |
path: ${{ env.BIN_RELEASE }} |