Skip to content

Commit

Permalink
encapsulate setups
Browse files Browse the repository at this point in the history
  • Loading branch information
rotorsoft committed May 11, 2024
1 parent 7d8e4b0 commit 13768f3
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 130 deletions.
148 changes: 18 additions & 130 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,8 @@ jobs:
- 6379:6379

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

- name: Cache dependencies
id: cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ matrix.node }}-${{ runner.os }}-modules-${{ hashFiles('**/pnpm.lock') }}
- name: Setup
uses: ./setup.yml

- name: Build CI
run: pnpm build-ci
Expand Down Expand Up @@ -137,20 +125,8 @@ jobs:
- 6379:6379

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

- name: Cache dependencies
id: cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ matrix.node }}-${{ runner.os }}-modules-${{ hashFiles('**/pnpm.lock') }}
- name: Setup
uses: ./setup.yml

- name: Build CI
run: pnpm build-ci
Expand Down Expand Up @@ -227,20 +203,8 @@ jobs:
- 6379:6379

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

- name: Cache dependencies
id: cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ matrix.node }}-${{ runner.os }}-modules-${{ hashFiles('**/pnpm.lock') }}
- name: Setup
uses: ./setup.yml

- name: Build CI
run: pnpm build-ci
Expand Down Expand Up @@ -279,28 +243,8 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

- name: Add node-gyp
run: pnpm add -g node-gyp

- name: Cache dependencies
id: cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ matrix.node }}-${{ runner.os }}-modules-${{ hashFiles('**/pnpm.lock') }}

- name: Install dependencies
run: pnpm i --ignore-engines
- name: Setup Deep
uses: ./setup-deep.yml

- name: Run linter
env:
Expand All @@ -316,33 +260,13 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

- name: Cache dependencies
id: cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ matrix.node }}-${{ runner.os }}-modules-${{ hashFiles('**/pnpm.lock') }}
- name: Setup Deep
uses: ./setup-deep.yml

- name: Add node-gyp
run: pnpm add -g node-gyp

- name: Install dependencies
run: pnpm --ignore-engines

- name: Assert pnpm.lock is correct
- name: Assert pnpm-lock.yaml is correct
run: |
if ! git diff --quiet; then
echo 'You need to update the pnpm.lock file (potentially after running: pnpm add -g node-gyp)'
echo 'You need to update the pnpm-lock.yaml file (potentially after running: pnpm add -g node-gyp)'
exit 1
fi
Expand Down Expand Up @@ -400,20 +324,8 @@ jobs:
- 15672:15672

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

- name: Cache d ependencies
id: cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ matrix.node }}-${{ runner.os }}-modules-${{ hashFiles('**/pnpm.lock') }}
- name: Setup
uses: ./setup.yml

- name: Build CI
run: NO_WEBPACK=true pnpm build-ci
Expand Down Expand Up @@ -459,24 +371,12 @@ jobs:
ports:
- 6379:6379
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Setup
uses: ./setup.yml

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

- name: Cache dependencies
id: cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ matrix.node }}-${{ runner.os }}-modules-${{ hashFiles('**/pnpm.lock') }}

- name: Build CI
run: pnpm add -g node-gyp && pnpm i --ignore-engines

Expand Down Expand Up @@ -527,20 +427,8 @@ jobs:
- 6379:6379

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

- name: Cache dependencies
id: cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ matrix.node }}-${{ runner.os }}-modules-${{ hashFiles('**/pnpm.lock') }}
- name: Setup
uses: ./setup.yml

- name: Build CI
run: NO_WEBPACK=true pnpm build-ci
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/setup-deep.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Checkout & Setup Node & Install pnpm & Add node-gyp & Install

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ matrix.node }}-${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ matrix.node }}-${{ runner.os }}-pnpm-store-
- name: Add node-gyp
run: pnpm add -g node-gyp

- name: Install dependencies
run: pnpm i --ignore-scripts




29 changes: 29 additions & 0 deletions .github/workflows/setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Checkout & Setup Node & Install pnpm

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ matrix.node }}-${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ matrix.node }}-${{ runner.os }}-pnpm-store-

0 comments on commit 13768f3

Please sign in to comment.