From 9273fdd8f21437138bb0614488d293dc634300c7 Mon Sep 17 00:00:00 2001 From: tre Date: Mon, 4 Nov 2024 11:50:29 -0800 Subject: [PATCH] feat(ci): add ci checks --- .github/actions/setup/action.yaml | 22 ++++++++ .github/actions/supersim/action.yaml | 8 +++ .github/workflows/main.yaml | 84 ++++++++++++++++++++++++++++ package.json | 1 + 4 files changed, 115 insertions(+) create mode 100644 .github/actions/setup/action.yaml create mode 100644 .github/actions/supersim/action.yaml create mode 100644 .github/workflows/main.yaml diff --git a/.github/actions/setup/action.yaml b/.github/actions/setup/action.yaml new file mode 100644 index 0000000..0164f4b --- /dev/null +++ b/.github/actions/setup/action.yaml @@ -0,0 +1,22 @@ +name: Setup +runs: + using: composite + steps: + - uses: pnpm/action-setup@v2 + + - name: set nx base and head ref + uses: nrwl/nx-set-shas@v4 + + - name: log nx base and head ref + run: | + echo "BASE: ${{ env.NX_BASE }}" + echo "HEAD: ${{ env.NX_HEAD }}" + shell: bash + + - name: pnpm install node modules + run: pnpm i --frozen-lockfile + shell: bash + + - name: pnpm build + run: pnpm nx affected --base=$NX_BASE --head=$NX_HEAD --target=build + shell: bash diff --git a/.github/actions/supersim/action.yaml b/.github/actions/supersim/action.yaml new file mode 100644 index 0000000..7bbdbbf --- /dev/null +++ b/.github/actions/supersim/action.yaml @@ -0,0 +1,8 @@ +name: Supersim +runs: + using: composite + steps: + - name: Install Supersim + uses: jaxxstorm/action-install-gh-release@v1.10.0 + with: + repo: ethereum-optimism/supersim diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 0000000..7435799 --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,84 @@ +name: Unit Tests + +on: + workflow_dispatch: + push: + branches: + - main + pull_request: + branches: + - main + merge_group: + branches: + - main + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: 'read' + actions: 'read' + +jobs: + typecheck: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Setup + uses: ./.github/actions/setup + - name: Run TypeChecker + run: | + pnpm nx affected --base=$NX_BASE --head=$NX_HEAD --target=typecheck + + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Set up foundry + uses: foundry-rs/foundry-toolchain@v1 + - name: Setup + uses: ./.github/actions/setup + - name: Run Linters + run: | + pnpm nx affected --base=$NX_BASE --head=$NX_HEAD --target=lint + + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Set up foundry + uses: foundry-rs/foundry-toolchain@v1 + - name: Setup + uses: ./.github/actions/setup + - name: Supersim Setup + uses: ./.github/actions/supersim + - name: Run Tests + run: | + pnpm nx affected --base=$NX_BASE --head=$NX_HEAD --target=test + + e2e-tests: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Set up foundry + uses: foundry-rs/foundry-toolchain@v1 + - name: Setup + uses: ./.github/actions/setup + - name: Supersim Setup + uses: ./.github/actions/supersim + - name: Run E2E Tests + run: | + pnpm nx affected --base=$NX_BASE --head=$NX_HEAD --target=e2e-test diff --git a/package.json b/package.json index 02919dc..5d9a7e2 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,6 @@ { "name": "superchainerc20-starter", + "packageManager": "pnpm@9.0.2", "description": "", "scripts": { "dev": "mprocs",