feat: format print info #384
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 | |
typecheck: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
- 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: Typecheck | |
run: nr typecheck | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
node: [16.x, 18.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] | |
flag-for-modulea: ['', -m pinia -m unocss, -m uniNetwork -m uniUse -m uniPromises] | |
flag-for-ui: ['', -u uni, -u ano] | |
node: [18.x] | |
os: [ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
env: | |
FEATURE_FLAGS: ${{ matrix.flag-for-ts }} ${{ matrix.flag-for-eslint }} ${{ matrix.flag-for-plugin }} ${{ matrix.flag-for-modulea }} ${{ 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: 打包项目 | |
working-directory: ../sample-project | |
run: pnpm build | |
test-template: | |
needs: build | |
strategy: | |
matrix: | |
flag-for-all: [--ts -e -p import -p pages -p layouts -p manifest -p filePlatform -p platformModifier -p middleware -m pinia -m unocss -m uniNetwork -m uniUse -m uniPromises -u uni] | |
flag-for-template: ['', -t vitesse] | |
node: [16.x, 18.x] | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
env: | |
FEATURE_FLAGS: ${{ matrix.flag-for-template }} ${{ matrix.flag-for-all }} | |
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, '-t vitesse')) }} | |
name: 创建多参数项目 | |
working-directory: ../ | |
run: node ./create-uni/dist/outfile.cjs sample-project ${{ matrix.flag-for-all}} | |
- if: ${{ (contains(env.FEATURE_FLAGS, '-t vitesse')) }} | |
name: 创建模版项目 | |
working-directory: ../ | |
run: node ./create-uni/dist/outfile.cjs sample-project ${{matrix.flag-for-template}} | |
- name: 安装项目依赖 | |
working-directory: ../sample-project | |
run: pnpm install | |
- name: 打包项目 | |
working-directory: ../sample-project | |
run: pnpm build |