From 10048396854818c624e84de9dd0a2f4483217434 Mon Sep 17 00:00:00 2001 From: 0xtekgrinder <0xtekgrinder@protonmail.com> Date: Thu, 28 Mar 2024 09:57:59 -0400 Subject: [PATCH] chore: update CI to install sdk --- .github/actions/setup-repo/action.yml | 35 +++++++++++++++++++++++++++ .github/workflows/ci-deep.yml | 15 ++++++++++-- .github/workflows/ci.yml | 20 +++++++++++++-- 3 files changed, 66 insertions(+), 4 deletions(-) create mode 100644 .github/actions/setup-repo/action.yml diff --git a/.github/actions/setup-repo/action.yml b/.github/actions/setup-repo/action.yml new file mode 100644 index 0000000..3c5cc7d --- /dev/null +++ b/.github/actions/setup-repo/action.yml @@ -0,0 +1,35 @@ +name: Setup repo +description: Runs all steps to setup the repo (install node_modules, build, etc...) +inputs: + registry-token: + description: 'PAT to access registries' +runs: + using: 'composite' + steps: + - name: Get yarn cache directory path + id: yarn-cache-dir-path + shell: bash + run: | + echo "::set-output name=dir::$(yarn cache dir)" + echo "::set-output name=version::$(yarn -v)" + + - uses: actions/setup-node@v3 + with: + node-version: '20' + + - uses: actions/cache@v2 + id: yarn-cache + with: + path: | + **/node_modules + ${{ steps.yarn-cache-dir-path.outputs.dir }} + + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Install dependencies + shell: bash + run: echo "//npm.pkg.github.com/:_authToken=$GH_REGISTRY_ACCESS_TOKEN" >> .npmrc && yarn install --frozen-lockfile --verbose && rm -f .npmrc + env: + GH_REGISTRY_ACCESS_TOKEN: ${{ inputs.registry-token }} \ No newline at end of file diff --git a/.github/workflows/ci-deep.yml b/.github/workflows/ci-deep.yml index d2134ff..84c1779 100644 --- a/.github/workflows/ci-deep.yml +++ b/.github/workflows/ci-deep.yml @@ -32,8 +32,10 @@ jobs: node-version: 18 cache: "yarn" - - name: Install dependencies - run: yarn install + - name: Setup repo + uses: ./.github/actions/setup-repo + with: + registry-token: ${{ secrets.GH_REGISTRY_ACCESS_TOKEN }} - name: Run solhint run: yarn lint:check @@ -58,6 +60,11 @@ jobs: - name: Compile foundry run: yarn compile + - name: Setup repo + uses: ./.github/actions/setup-repo + with: + registry-token: ${{ secrets.GH_REGISTRY_ACCESS_TOKEN }} + - name: "Cache the build so that it can be re-used by the other jobs" uses: "actions/cache/save@v3" with: @@ -65,6 +72,7 @@ jobs: path: | cache-forge out + node_modules - name: "Add build summary" run: | @@ -85,6 +93,7 @@ jobs: path: | cache-forge out + node_modules key: "build-${{ github.sha }}" - name: Install Foundry @@ -126,6 +135,7 @@ jobs: path: | cache-forge out + node_modules key: "build-${{ github.sha }}" - name: Install Foundry @@ -169,6 +179,7 @@ jobs: path: | cache-forge out + node_modules key: "build-${{ github.sha }}" - name: Install Foundry diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 94742c7..520d3c3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,8 +21,10 @@ jobs: node-version: 18 cache: "yarn" - - name: Install dependencies - run: yarn install + - name: Setup repo + uses: ./.github/actions/setup-repo + with: + registry-token: ${{ secrets.GH_REGISTRY_ACCESS_TOKEN }} - name: Run solhint run: yarn lint:check @@ -44,6 +46,11 @@ jobs: with: version: nightly + - name: Setup repo + uses: ./.github/actions/setup-repo + with: + registry-token: ${{ secrets.GH_REGISTRY_ACCESS_TOKEN }} + - name: Compile foundry run: yarn compile @@ -54,6 +61,7 @@ jobs: path: | cache-forge out + node_modules - name: "Add build summary" run: | @@ -74,6 +82,7 @@ jobs: path: | cache-forge out + node_modules key: "build-${{ github.sha }}" - name: Install Foundry @@ -115,6 +124,7 @@ jobs: path: | cache-forge out + node_modules key: "build-${{ github.sha }}" - name: Install Foundry @@ -158,6 +168,7 @@ jobs: path: | cache-forge out + node_modules key: "build-${{ github.sha }}" - name: Install Foundry @@ -197,6 +208,11 @@ jobs: - name: "Install Foundry" uses: "foundry-rs/foundry-toolchain@v1" + - name: Setup repo + uses: ./.github/actions/setup-repo + with: + registry-token: ${{ secrets.GH_REGISTRY_ACCESS_TOKEN }} + - uses: actions/setup-python@v5 with: python-version: '3.8'