chore: release v1.7.0 #544
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: CI | |
on: | |
push: | |
branches: | |
- main | |
tags-ignore: | |
- 'v*' | |
pull_request: | |
branches: | |
- main | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
- name: oxLint | |
run: pnpm dlx oxlint@latest | |
- name: Set node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
cache: pnpm | |
- name: Setup | |
run: npm i -g @antfu/ni | |
- name: Install | |
run: nci | |
- name: Lint | |
run: nr lint | |
- name: Typecheck | |
run: nr typecheck | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
node: [18.x, 20.x] | |
os: [ubuntu-latest, 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 | |
- uses: actions/cache/save@v4 | |
id: cache | |
with: | |
path: 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: 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 | |
- if: ${{ (contains(env.FEATURE_FLAGS, '-')) }} | |
name: 创建多参数项目 | |
working-directory: ../ | |
run: node ./create-uni/dist/outfile.cjs sample-project ${{ env.FEATURE_FLAGS }} | |
- if: ${{ !(contains(env.FEATURE_FLAGS, '-')) }} | |
name: 创建基础项目 | |
working-directory: ../ | |
run: node ./create-uni/dist/outfile.cjs sample-project | |
- name: 安装项目依赖 | |
working-directory: ../sample-project | |
run: pnpm install | |
- 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/dist/outfile.cjs --info all |