chore: release v2.0.2 #30
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: create-uni Test CI | |
on: | |
push: | |
branches: | |
- main | |
tags-ignore: | |
- '**' | |
paths: | |
- 'packages/core/**' | |
- .github/workflows/core_test.yml | |
pull_request: | |
branches: | |
- main | |
paths: | |
- 'packages/core/**' | |
- .github/workflows/core_test.yml | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
node: [18.x, 20.x] | |
os: [windows-latest, macos-latest] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
- name: Set node ${{ matrix.node }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
cache: pnpm | |
- name: Setup | |
run: npm i -g @antfu/ni | |
- name: Install | |
run: nci | |
- name: Build | |
run: nr build:core | |
- uses: actions/cache/save@v4 | |
id: cache | |
with: | |
path: packages/core/dist/outfile.cjs | |
key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ matrix.os }}-${{ matrix.node }} | |
test: | |
needs: build | |
strategy: | |
matrix: | |
flag-for-ts: ['', --ts] | |
flag-for-eslint: ['', -e] | |
flag-for-plugin: ['', -p import -p pages -p layouts -p manifest -p filePlatform -p platformModifier -p middleware -p root -m pinia -m unocss -m uniNetwork -m uniUse -m uniPromises] | |
flag-for-ui: ['', -u uni, -u ano, -u wot, -u nut, -u uv] | |
node: [18.x] | |
os: [windows-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
env: | |
FEATURE_FLAGS: ${{ matrix.flag-for-ts }} ${{ matrix.flag-for-eslint }} ${{ matrix.flag-for-plugin }} ${{ matrix.flag-for-ui }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
cache: pnpm | |
- uses: actions/cache/restore@v4 | |
id: cache-restore | |
with: | |
path: packages/core/dist/outfile.cjs | |
key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ matrix.os }}-${{ matrix.node }} | |
- name: 当没有缓存时,执行构建 | |
if: steps.cache-restore.outputs.cache-hit != 'true' | |
run: pnpm install && pnpm build:core | |
- if: ${{ (contains(env.FEATURE_FLAGS, '-')) }} | |
name: 创建多参数项目 | |
working-directory: ../ | |
run: node ./create-uni/packages/core/dist/outfile.cjs sample-project ${{ env.FEATURE_FLAGS }} | |
- if: ${{ !(contains(env.FEATURE_FLAGS, '-')) }} | |
name: 创建基础项目 | |
working-directory: ../ | |
run: node ./create-uni/packages/core/dist/outfile.cjs sample-project | |
- name: 使用npm安装项目依赖 | |
working-directory: ../sample-project | |
run: npm install --no-frozen-lockfile | |
- name: 移除node_modules | |
working-directory: ../sample-project | |
run: npx rimraf node_modules | |
- name: 使用pnpm安装项目依赖 | |
working-directory: ../sample-project | |
run: pnpm install --no-frozen-lockfile | |
- name: 打包H5项目 | |
working-directory: ../sample-project | |
run: pnpm build | |
- name: dev小程序项目 | |
working-directory: ../sample-project | |
run: node ./../create-uni/scripts/dev.cjs | |
- name: 打包小程序项目 | |
working-directory: ../sample-project | |
run: pnpm build:mp-weixin | |
# - name: 输出环境信息 | |
# working-directory: ../sample-project | |
# run: node ./../create-uni/packages/core/dist/outfile.cjs --info all |