Skip to content

Commit

Permalink
feat: separate out ci requiring secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
xykota committed Sep 22, 2023
1 parent c080d12 commit 065dc5c
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 10 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/ci-safe-to-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: CI (safe to test)

on:
push:
pull_request_target:
types: [labeled]

permissions:
id-token: write
contents: write # Checkout

jobs:
build:
runs-on: ubuntu-latest

# See https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
if: |
github.event_name == 'push' ||
contains(github.event.pull_request.labels.*.name, 'safe to test') ||
(github.event_name == 'pull_request' && github.event.action != 'labeled')
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18

- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 8
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install

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

- name: Build
run: pnpm -C packages/hardhat build

- name: Test hardhat
env:
RPC_URL: ${{ secrets.MAINNET_RPC_URL }}
run: pnpm -C packages/hardhat test

- name: Foundry forge test
run: pnpm -C packages/hardhat forge-test
11 changes: 1 addition & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Node.js CI
name: CI

permissions:
id-token: write
Expand Down Expand Up @@ -67,18 +67,9 @@ jobs:
- name: Test
run: pnpm -filter '!@sifi/hardhat' packages/frontend test

- name: Test hardhat
env:
RPC_URL: ${{ secrets.MAINNET_RPC_URL }}
if: ${{ env.MAINNET_RPC_URL != null }}
run: pnpm -C packages/hardhat test

- name: Foundry forge build
run: pnpm -C packages/hardhat forge-build

- name: Foundry forge test
run: pnpm -C packages/hardhat forge-test

- name: Slither analyze
id: slither
continue-on-error: true
Expand Down

0 comments on commit 065dc5c

Please sign in to comment.