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 a568a96 commit 87c52c3
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 216 deletions.
258 changes: 43 additions & 215 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,66 +12,8 @@ permissions:
contents: read

jobs:
test-cli:
name: Test @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
setup:
name: Setup
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -88,116 +30,30 @@ jobs:
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/bem/lib
key: bem-${{ github.sha }}

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

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

compile:
needs: [compile-icons]
name: Compile zarm CJS/ESM
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'
path: |
node_modules
*/*/node_modules
packages/zarm-cli/dist
packages/bem/lib
packages/zarm-icons/lib
key: setup-${{ github.sha }}

- 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/bem/lib
key: bem-${{ github.sha }}

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

- name: Compile
run: |
pnpm --filter zarm run build:lib
pnpm --filter zarm run build:es
pnpm --filter @zarm-design/* run build
compile-umd:
needs: [compile-icons]
name: Compile zarm UMD
test-cli:
name: Test @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
Expand All @@ -216,37 +72,11 @@ jobs:
- 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/bem/lib
key: bem-${{ github.sha }}

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

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

- name: Compile
env:
NODE_OPTIONS: --max_old_space_size=4096
run: pnpm --filter zarm run build:umd
- name: Test
run: pnpm --filter @zarm-design/cli run test

lint:
needs: [compile-icons]
needs: [setup]
name: Lint
runs-on: ubuntu-latest
steps:
Expand All @@ -264,8 +94,16 @@ jobs:
node-version: 16
cache: 'pnpm'

- name: Install dependencies
run: pnpm install
- name: Restore Cache
uses: actions/cache@v3
with:
path: |
node_modules
*/*/node_modules
packages/zarm-cli/dist
packages/bem/lib
packages/zarm-icons/lib
key: setup-${{ github.sha }}

- name: Lint
run: pnpm run lint
Expand Down Expand Up @@ -295,8 +133,16 @@ jobs:
node-version: 16
cache: 'pnpm'

- name: Install dependencies
run: pnpm install
- name: Restore Cache
uses: actions/cache@v3
with:
path: |
node_modules
*/*/node_modules
packages/zarm-cli/dist
packages/bem/lib
packages/zarm-icons/lib
key: setup-${{ github.sha }}

- name: Install React v16
if: ${{ matrix.react == '16' }}
Expand All @@ -306,29 +152,11 @@ jobs:
if: ${{ matrix.react == '18' }}
run: pnpm --filter zarm run install-react-18

- 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/bem/lib
key: bem-${{ github.sha }}

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

- name: Restore Cache from zarm
uses: actions/cache@v3
with:
path: packages/zarm/dist
key: zarm-${{ github.sha }}
- name: Compile
if: ${{ matrix.module == 'dist' }}
env:
NODE_OPTIONS: --max_old_space_size=4096
run: pnpm --filter zarm run build:umd

- name: Check dist
if: ${{ matrix.module == 'dist' }}
Expand Down
1 change: 1 addition & 0 deletions packages/zarm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
"@types/react-dom": "^18.0.9",
"@types/react-transition-group": "^4.4.5",
"@zarm-design/cli": "workspace:*",
"chalk": "^4.1.1",
"dekko": "^0.2.1",
"react": "^17.0.1",
"react-dom": "^17.0.1",
Expand Down
4 changes: 3 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 87c52c3

Please sign in to comment.