Skip to content

Commit

Permalink
chore: update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
JeromeLin committed May 31, 2023
1 parent 2427c82 commit b028c17
Show file tree
Hide file tree
Showing 2 changed files with 191 additions and 6 deletions.
174 changes: 174 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
name: CI
on:
push:
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 7

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Lint
run: pnpm run lint

test-cli:
name: Testing @zarm-design/cli on Node.js
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 16, 14, 12, 10]
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 7

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Test
run: pnpm --filter @zarm-design/cli run test

compile-cli:
name: Compile @zarm-design/cli
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 7

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Cache
uses: actions/cache@v3
with:
path: packages/zarm-cli/dist
key: cli-${{ github.sha }}

- name: Compile
run: pnpm --filter @zarm-design/cli run build

compile-bem:
needs: [compile-cli]
name: Compile @zarm-design/bem
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 7

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Restore Cache from @zarm-design/cli
uses: actions/cache@v3
with:
path: packages/zarm-cli/dist
key: cli-${{ github.sha }}

- name: Cache
uses: actions/cache@v3
with:
path: packages/bem/lib
key: bem-${{ github.sha }}

- name: Compile
run: pnpm --filter @zarm-design/bem run build

compile-icons:
needs: [compile-bem]
name: Compile @zarm-design/icons
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 7

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Restore Cache from @zarm-design/cli
uses: actions/cache@v3
with:
path: packages/zarm-cli/dist
key: cli-${{ github.sha }}

- name: Restore Cache from @zarm-design/bem
uses: actions/cache@v3
with:
path: packages/zarm-bem/dist
key: bem-${{ github.sha }}

- name: Cache
uses: actions/cache@v3
with:
path: packages/icons/lib
key: icons-${{ github.sha }}

- name: Compile
run: pnpm --filter @zarm-design/icons run build
23 changes: 17 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@ jobs:
id: pnpm-install
with:
version: 7
run_install: true

- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'pnpm'

- name: install packages
run: pnpm i --frozen-lockfile
Expand Down Expand Up @@ -213,17 +211,30 @@ jobs:
- name: checkout
uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 16

- uses: pnpm/action-setup@v2
name: install pnpm
id: pnpm-install
with:
version: 7
run_install: true
run_install: false

- uses: actions/setup-node@v3
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
node-version: 16
cache: 'pnpm'
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: lint
run: pnpm lint
Expand Down

0 comments on commit b028c17

Please sign in to comment.