From 3d965788345083f7b0368f3c8baa352ead6dbd01 Mon Sep 17 00:00:00 2001 From: Alejandro Date: Sat, 24 Feb 2024 08:50:36 -0300 Subject: [PATCH] Tweak ci --- .github/workflows/ci.yml | 60 +++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 31 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 11a23856..61f727dc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,34 +7,11 @@ on: branches: [main] jobs: - setup: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Setup Node.js - uses: actions/setup-node@v2 - with: - node-version: 20.x - cache: 'npm' - - name: Install Dependencies - run: npm ci - - run: npm run build --if-present - - run: npm run compile --if-present - - name: Start local chain - run: npm run chain & sleep 10 - - name: Cache node modules - uses: actions/cache@v2 - with: - path: '**/node_modules' - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node- - - test: - needs: setup + prepare-and-test: runs-on: ubuntu-latest strategy: matrix: + node-version: [20.x] package: [ common, @@ -46,15 +23,36 @@ jobs: ethernaut-ui, ] fail-fast: false + env: + ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }} + ALCHEMY_API_KEY: ${{ secrets.ALCHEMY_API_KEY }} + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + steps: - uses: actions/checkout@v2 - name: Setup Node.js uses: actions/setup-node@v2 with: - node-version: 20.x + node-version: ${{ matrix.node-version }} cache: 'npm' - - name: Restore Dependencies from Cache - uses: actions/cache@v2 - with: - path: '**/node_modules' - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + + - name: Install Dependencies + run: npm ci + + - name: Build + run: npm run build --if-present + + - name: Compile + run: npm run compile --if-present + + - name: Start local chain + run: | + npm run chain & + sleep 10 + + # Dynamically navigate to package directory and run tests + - name: Run Tests in ${{ matrix.package }} + run: | + cd packages/${{ matrix.package }} + npm ci + npm t