Skip to content

Commit

Permalink
chore: update CI to install sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
0xtekgrinder committed Mar 28, 2024
1 parent 391856c commit 1004839
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 4 deletions.
35 changes: 35 additions & 0 deletions .github/actions/setup-repo/action.yml
Original file line number Diff line number Diff line change
@@ -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 }}
15 changes: 13 additions & 2 deletions .github/workflows/ci-deep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -58,13 +60,19 @@ 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:
key: "build-${{ github.sha }}"
path: |
cache-forge
out
node_modules
- name: "Add build summary"
run: |
Expand All @@ -85,6 +93,7 @@ jobs:
path: |
cache-forge
out
node_modules
key: "build-${{ github.sha }}"

- name: Install Foundry
Expand Down Expand Up @@ -126,6 +135,7 @@ jobs:
path: |
cache-forge
out
node_modules
key: "build-${{ github.sha }}"

- name: Install Foundry
Expand Down Expand Up @@ -169,6 +179,7 @@ jobs:
path: |
cache-forge
out
node_modules
key: "build-${{ github.sha }}"

- name: Install Foundry
Expand Down
20 changes: 18 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -54,6 +61,7 @@ jobs:
path: |
cache-forge
out
node_modules
- name: "Add build summary"
run: |
Expand All @@ -74,6 +82,7 @@ jobs:
path: |
cache-forge
out
node_modules
key: "build-${{ github.sha }}"

- name: Install Foundry
Expand Down Expand Up @@ -115,6 +124,7 @@ jobs:
path: |
cache-forge
out
node_modules
key: "build-${{ github.sha }}"

- name: Install Foundry
Expand Down Expand Up @@ -158,6 +168,7 @@ jobs:
path: |
cache-forge
out
node_modules
key: "build-${{ github.sha }}"

- name: Install Foundry
Expand Down Expand Up @@ -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'
Expand Down

0 comments on commit 1004839

Please sign in to comment.