Skip to content

Commit

Permalink
split jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
killroy192 committed Dec 28, 2023
1 parent 35ebbe7 commit bf1b67e
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 30 deletions.
10 changes: 7 additions & 3 deletions .github/actions/setup.yml → .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Setup
description: Install foundry and npm dependencies to reuse them in workflows and jobs

runs:
using: composite
Expand All @@ -9,13 +10,16 @@ runs:
node-version: 18.x
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- run: ls -alt
shell: bash
- uses: actions/cache@v3
id: cache
with:
path: |
'**/node_modules'
'**/lib/forge-std'
key: ${{ hashFiles('**/lib/forge-std/package.json') }}-${{ hashFiles('**/package-lock.json') }}
'./node_modules'
'./lib/forge-std'
key: ${{ runner.os }}-${{ hashFiles('./lib/forge-std/package.json') }}-${{ hashFiles('./package-lock.json') }}
- name: Install dependencies
shell: bash
run: make install-ci
if: steps.cache.outputs.cache-hit != 'true'
61 changes: 34 additions & 27 deletions .github/workflows/quality-gate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,43 @@ name: Quality Gate
on:
push:

concurrency: ${{ github.workflow }}-${{ github.ref }}
concurrency:
group: quality-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read
packages: read

jobs:
build_and_validate:
lint:
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
security-events: write
steps:
- uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup
- name: code quality
run: make lint
- name: Run harhat compilation
run: make compile
- name: Run unit tests
run: make test
- name: Run demo deployment
run: make deploy
- name: Run Slither
uses: crytic/[email protected]
id: slither
with:
target: 'src/'
sarif: results.sarif
fail-on: none
ignore-compile: true
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v2
- uses: ./.github/actions/setup
- run: make lint

check-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- run: make compile
- run: make deploy

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- run: make test

slither:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- run: rm foundry.toml
- uses: crytic/[email protected]
with:
sarif_file: ${{ steps.slither.outputs.sarif }}
node-version: 18.15

0 comments on commit bf1b67e

Please sign in to comment.