Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: use pnpm cache in workflows #1401

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 33 additions & 17 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,32 +25,39 @@ jobs:
- os: windows-latest
abi: win32-x64-msvc
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
with:
version: 9.1.0

- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'pnpm'

- name: Install Dependencies
run: npm install -g pnpm@9.1.0 && pnpm i --frozen-lockfile
run: pnpm i --color --frozen-lockfile

- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
id: download
with:
name: ${{ github.sha }}-${{ matrix.settings.abi }}
path: ./packages/core/binding

- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
id: download-plugin-sass
with:
name: ${{ github.sha }}-${{ matrix.settings.abi }}-plugin-sass
path: ./rust-plugins/sass/npm/${{ matrix.settings.abi }}

- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
id: download-plugin-react
with:
name: ${{ github.sha }}-${{ matrix.settings.abi }}-plugin-react
path: ./rust-plugins/react/npm/${{ matrix.settings.abi }}

- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
id: download-create-farm-rust
with:
name: ${{ github.sha }}-${{ matrix.settings.abi }}
Expand Down Expand Up @@ -86,14 +93,19 @@ jobs:
name: Type Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v3
- uses: pnpm/action-setup@v4
with:
version: 9.1.0

- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'pnpm'
- name: Install Dependencies
run: npm install -g pnpm@9.1.0 && pnpm i --frozen-lockfile
run: pnpm i --color --frozen-lockfile
- name: Build CLI and Core
run: pnpm --filter @farmfe/cli run build
- name: Type Check With Tsc
Expand All @@ -120,15 +132,19 @@ jobs:
- os: windows-latest
abi: win32-x64-msvc
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9.1.0
- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'pnpm'
- name: Install Dependencies
run: npm install -g pnpm@9.1.0 && pnpm i --frozen-lockfile
run: pnpm i --color --frozen-lockfile
- name: Build CLI and Core
run: pnpm --filter @farmfe/cli run build
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
id: download
with:
name: ${{ github.sha }}-${{ matrix.settings.abi }}
Expand All @@ -146,7 +162,7 @@ jobs:
runs-on: ubuntu-latest
needs: call-rust-build
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
path: /tmp/artifacts
- name: Check
Expand All @@ -161,7 +177,7 @@ jobs:
runs-on: ubuntu-latest
needs: call-rust-build
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
path: /tmp/artifacts
- name: Check
Expand All @@ -183,7 +199,7 @@ jobs:
- name: plugin-sass
- name: plugin-react
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
path: /tmp/artifacts
- name: Check
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/code-spell-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@ jobs:
name: Spell
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-node@v3
- uses: pnpm/action-setup@v4
with:
node-version: '18'
- name: Install pnpm
run: npm install -g [email protected]
version: 9.1.0

- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'pnpm'
- name: pnpm install
run: pnpm install
run: pnpm i --color
- name: Run Spell Check
shell: bash
run: npx cspell "**" --gitignore
12 changes: 8 additions & 4 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
name: Rust Code Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Rust
uses: oxidecomputer/actions-rs_toolchain@oxide/master
- name: Cache rust artifacts
Expand All @@ -26,11 +26,15 @@ jobs:
name: TS Code Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9.1.0
- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'pnpm'
- name: Install Dependencies
run: npm install -g pnpm@9.1.0 && pnpm i --frozen-lockfile
run: pnpm i --color --frozen-lockfile
- name: Run lint
run: npx biome check --no-errors-on-unmatched --files-ignore-unknown=true
14 changes: 10 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9.1.0

- name: Setup Node.js 18.x
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: 'pnpm'

# batch download artifacts
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
path: /tmp/artifacts
- name: Copy Farm Core Binary
Expand All @@ -45,7 +51,7 @@ jobs:
done

- name: Install Dependencies
run: npm install -g pnpm@9.1.0 && pnpm i --frozen-lockfile
run: pnpm i --color --frozen-lockfile
- name: Build Plugin Tools
run: pnpm --filter @farmfe/plugin-tools run build

Expand Down
19 changes: 12 additions & 7 deletions .github/workflows/rust-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,21 @@ jobs:
# osxcross: true
# zig: true
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Cache rust artifacts
uses: Swatinem/rust-cache@v2
with:
shared-key: rust-build-${{ matrix.settings.abi }}
- uses: actions/setup-node@v3
- uses: pnpm/action-setup@v4
with:
version: 9.1.0

- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'pnpm'
- name: Install Dependencies
run: npm install -g pnpm@9.1.0 && pnpm i --frozen-lockfile
run: pnpm i --color --frozen-lockfile
- name: Build Plugin Tools
run: pnpm --filter @farmfe/plugin-tools run build
- run: rustup target add ${{ matrix.settings.target }}
Expand Down Expand Up @@ -134,22 +139,22 @@ jobs:
run: ${{ matrix.settings.build }}
shell: bash
- name: Upload Core
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ github.sha }}-${{ matrix.settings.abi }}
path: ./packages/core/binding/farm.${{ matrix.settings.abi }}.node
- name: Upload Create Farm Rust
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ github.sha }}-${{ matrix.settings.abi }}-create-farm
path: ./packages/create-farm/create-farm.${{ matrix.settings.abi }}.node
- name: Upload Plugin React
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ github.sha }}-${{ matrix.settings.abi }}-plugin-react
path: rust-plugins/react/npm/${{ matrix.settings.abi }}/index.farm
- name: Upload Plugin Sass
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ github.sha }}-${{ matrix.settings.abi }}-plugin-sass
path: rust-plugins/sass/npm/${{ matrix.settings.abi }}/index.farm
13 changes: 9 additions & 4 deletions .github/workflows/rust-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Rust
uses: oxidecomputer/actions-rs_toolchain@oxide/master
- name: Cache rust artifacts
Expand All @@ -34,7 +34,7 @@ jobs:
- macos-latest
- windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Rust
uses: oxidecomputer/actions-rs_toolchain@oxide/master
with:
Expand All @@ -44,11 +44,16 @@ jobs:
with:
shared-key: cargo-test-release-${{ matrix.os }}

- uses: actions/setup-node@v3
- uses: pnpm/action-setup@v4
with:
version: 9.1.0

- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'pnpm'
- name: Install Dependencies
run: npm install -g pnpm@9.1.0 && pnpm i --frozen-lockfile
run: pnpm i --color --frozen-lockfile

- uses: arduino/setup-protoc@v3
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,20 @@ jobs:
# osxcross: true
# zig: true
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Cache rust artifacts
uses: Swatinem/rust-cache@v2
with:
shared-key: rust-build-${{ matrix.settings.abi }}
- uses: actions/setup-node@v3
- uses: pnpm/action-setup@v4
with:
version: 9.1.0
- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'pnpm'
- name: Install Dependencies
run: npm install -g pnpm@9.1.0 && pnpm i --frozen-lockfile
run: pnpm i --color --frozen-lockfile
- run: rustup target add ${{ matrix.settings.target }}
if: ${{ matrix.settings.target }}
# Use the v1 of this action
Expand Down Expand Up @@ -106,7 +110,7 @@ jobs:
run: ${{ matrix.settings.build }}
shell: bash
- name: Upload Plugin
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ github.sha }}-${{ matrix.settings.abi }}-plugin
path: npm/${{ matrix.settings.abi }}/index.farm
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
needs: [call-rust-build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
# batch download artifacts
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
path: /tmp/artifacts
- name: Check Artifacts
Expand All @@ -26,11 +26,13 @@ jobs:

test -f ./npm/${abi}/index.farm
done
- uses: pnpm/action-setup@v4
with:
version: 9.1.0
- name: Setup Node.js 18.x
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18.x
- name: Install Dependencies
run: npm install -g [email protected]
cache: 'pnpm'
- name: Test Example
run: cd playground && pnpm i && pnpm build
run: cd playground && pnpm i --color && pnpm build
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,20 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
with:
version: 9.1.0

- name: Setup Node.js 18.x
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: 'pnpm'

# batch download artifacts
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
path: /tmp/artifacts
- name: Move Artifacts
Expand All @@ -37,7 +42,7 @@ jobs:
done

- name: Install Dependencies
run: npm install -g pnpm@9.1.0 && pnpm i --frozen-lockfile
run: pnpm i --color --frozen-lockfile

- name: Publish to npm
run: npm set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }} && npm publish
run: npm set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }} && npm publish
Loading