Skip to content

test: add filter integration tests #46

test: add filter integration tests

test: add filter integration tests #46

Workflow file for this run

---
name: CI
on:
pull_request:
branches:
- main
types: [opened, synchronize, reopened, ready_for_review]
# run concurrency group for the workflow
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
changed_files:
if: ${{ github.event.pull_request.draft == false }}
runs-on: ubuntu-latest
name: Test changed-files
outputs:
changed-rust-files: ${{ steps.changed-files-yaml.outputs.code_any_changed }}
changed-lockfile-files: ${{ steps.changed-files-yaml.outputs.lockfile_any_changed
}}
changed-docker-files: ${{ steps.changed-files-yaml.outputs.docker_any_changed
}}
changed-tests-files: ${{ steps.changed-files-yaml.outputs.tests_any_changed
}}
steps:
# Checkout the repository
- name: Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Get changed files
id: changed-files-yaml
uses: tj-actions/changed-files@d6e91a2266cdb9d62096cebf1e8546899c6aa18f # v45.0.6
with:
files_yaml: |
code:
- '**/*.rs'
- 'rustfmt.toml'
- 'rust-toolchain.toml'
lockfile:
- 'Cargo.lock'
- 'Cargo.toml'
docker:
- 'Dockerfile.development'
- 'Cargo.lock'
- 'Cargo.toml'
tests:
- '**/*.rs'
- tests/**/*.json
ci:
if: ${{ github.event.pull_request.draft == false && always() }}
permissions:
contents: none
name: CI
needs: [test, msrv, lockfile, rustfmt, clippy]
runs-on: ubuntu-latest
steps:
- name: Failed
run: exit 1
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
msrv:
if: ${{ github.event.pull_request.draft == false && (needs.changed_files.outputs.changed-rust-files
== 'true' || needs.changed_files.outputs.changed-lockfile-files == 'true') }}
runs-on: ubuntu-latest
needs: changed_files
steps:
# Checkout the repository
- name: Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Prepare
id: init
uses: ./.github/actions/prepare
# Get the output of the prepare composite action
- name: Get cache-hit output
run: 'echo "Cache hit >>>>>: ${{ steps.init.outputs.cache-hit }}"'
- name: Install cargo hack
uses: taiki-e/install-action@cargo-hack
# Check the minimum supported Rust version
- name: Default features
run: cargo hack check --feature-powerset --locked --rust-version --all-targets
lockfile:
if: ${{ github.event.pull_request.draft == false && needs.changed_files.outputs.changed-lockfile-files
== 'true' }}
needs: changed_files
runs-on: ubuntu-latest
steps:
# Checkout the repository
- name: Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Prepare
id: init
uses: ./.github/actions/prepare
# Get the output of the prepare composite action
- name: Get cache-hit output
run: 'echo "Cache hit >>>>>: ${{ steps.init.outputs.cache-hit }}"'
# Check the lockfile
- name: Validate lockfile updates
run: cargo update --locked
rustfmt:
if: ${{ github.event.pull_request.draft == false && needs.changed_files.outputs.changed-rust-files
== 'true' }}
needs: changed_files
runs-on: ubuntu-latest
steps:
# Checkout the repository
- name: Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Prepare
id: init
uses: ./.github/actions/prepare
# Get the output of the prepare composite action
- name: Get cache-hit output
run: 'echo "Cache hit >>>>>: ${{ steps.init.outputs.cache-hit }}"'
# Check the formatting of the code
- name: Check formatting
run: cargo fmt --all -- --check
clippy:
if: ${{ github.event.pull_request.draft == false && needs.changed_files.outputs.changed-rust-files
== 'true' }}
needs: changed_files
runs-on: ubuntu-latest
steps:
# Checkout the repository
- name: Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Prepare
id: init
uses: ./.github/actions/prepare
# Get the output of the prepare composite action
- name: Get cache-hit output
run: 'echo "Cache hit >>>>>: ${{ steps.init.outputs.cache-hit }}"'
- name: Install SARIF tools
run: cargo install clippy-sarif --locked
- name: Install SARIF tools
run: cargo install sarif-fmt --locked
- name: Check
run: >
cargo clippy --all-features --all-targets --message-format=json
| clippy-sarif
| tee clippy-results.sarif
| sarif-fmt
continue-on-error: true
- name: upload sarif artifact
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: clippy-results.sarif
path: clippy-results.sarif
retention-days: 1
# TODO: enable this when the repo is made public.
# - name: Upload
# uses: github/codeql-action/upload-sarif@dd196fa9ce80b6bacc74ca1c32bd5b0ba22efca7 # v3.28.3
# with:
# sarif_file: clippy-results.sarif
# wait-for-processing: true
# - name: Report status
# run: cargo clippy --all-features --all-targets -- -D warnings --allow deprecated
# --locked
test:
if: ${{ github.event.pull_request.draft == false && needs.changed_files.outputs.changed-tests-files
== 'true' }}
needs: changed_files
runs-on: ubuntu-latest
steps:
# Checkout the repository
- name: Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Prepare
id: init
uses: ./.github/actions/prepare
# Get the output of the prepare composite action
- name: Get cache-hit output
run: 'echo "Cache hit >>>>>: ${{ steps.init.outputs.cache-hit }}"'
- name: Install cargo hack
uses: taiki-e/install-action@cargo-hack
- name: Build
run: cargo test --no-run --locked
- name: Test
run: cargo hack test --feature-powerset --locked --all-targets
docker-scan:
runs-on: ubuntu-latest
needs: [changed_files, ci]
if: ${{ needs.changed_files.outputs.changed-docker-files == 'true' }}
steps:
# Checkout the repository
- name: Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0
- name: Build local container
uses: docker/build-push-action@67a2d409c0a876cbe6b11854e3e25193efe4e62d # v6.12.0
with:
tags: openzeppelin-monitor-dev:${{ github.sha }}
push: false
load: true
file: Dockerfile.development
platforms: linux/amd64
- name: Scan image
uses: anchore/scan-action@abae793926ec39a78ab18002bc7fc45bbbd94342 # v6.0.0
with:
image: openzeppelin-monitor-dev:${{ github.sha }}
fail-build: true
severity-cutoff: high
output-format: table