Skip to content

Commit

Permalink
ci: update ci to use reusable workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
andreivladbrg committed Jan 9, 2025
1 parent f0494ae commit bd172de
Showing 1 changed file with 18 additions and 81 deletions.
99 changes: 18 additions & 81 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,97 +1,34 @@
name: "CI"

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

on:
workflow_dispatch:
pull_request:
push:
branches:
- "main"
- "staging"

jobs:
lint:
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: "actions/checkout@v4"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Install Bun"
uses: "oven-sh/setup-bun@v1"

- name: "Install the Node.js dependencies"
run: "bun install"
uses: "sablier-labs/reusable-workflows/.github/workflows/forge-lint.yml@main"

- name: "Lint the code"
run: "bun run lint"

- name: "Add lint summary"
run: |
echo "## Lint result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
bulloak:
needs: ["lint"]
uses: "sablier-labs/reusable-workflows/.github/workflows/bulloak-check.yml@main"
with:
skip-modifiers: true
tree-path: "tests"

build:
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: "actions/checkout@v4"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Install Bun"
uses: "oven-sh/setup-bun@v1"

- name: "Install the Node.js dependencies"
run: "bun install"
uses: "sablier-labs/reusable-workflows/.github/workflows/forge-build.yml@main"

- name: "Build the contracts and print their size"
run: "forge build --sizes"

- name: "Add build summary"
run: |
echo "## Build result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
- name: "Cache the build and the node modules so that they can be re-used by the other jobs"
uses: "actions/cache/save@v3"
with:
key: "build-and-modules-${{ github.sha }}"
path: |
cache
node_modules
out
out-optimized
test:
test-unit:
needs: ["lint", "build"]
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: "actions/checkout@v4"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Install Bun"
uses: "oven-sh/setup-bun@v1"

- name: "Restore the cached build and the node modules"
uses: "actions/cache/restore@v3"
with:
fail-on-cache-miss: true
key: "build-and-modules-${{ github.sha }}"
path: |
cache
node_modules
out
out-optimized
- name: "Run the tests"
run: "forge test"

- name: "Add test summary"
run: |
echo "## Tests result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
uses: "sablier-labs/reusable-workflows/.github/workflows/forge-test.yml@main"
with:
match-path: "tests/**/*.sol"
name: "Unit tests"

0 comments on commit bd172de

Please sign in to comment.