Skip to content

ci: fix path

ci: fix path #343

Workflow file for this run

name: CI
on:
push:
branches:
- main
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]
os: [ubuntu-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') }}
test:
needs: build
strategy:
matrix:
flag-for-ts: ['', --ts]
flag-for-eslint: ['', -e]
# flag-for-plugin-import: ['', -p import]
# flag-for-plugin-pages: ['', -p pages]
# flag-for-plugin-layouts: ['', -p layouts]
# flag-for-plugin-manifest: ['', -p manifest]
# flag-for-plugin-filePlatform: ['', -p filePlatform]
# flag-for-plugin-platformModifier: ['', -p platformModifier]
# flag-for-plugin-middleware: ['', -p middleware]
# flag-for-module-pinia: ['', -m pinia]
# flag-for-module-unocss: ['', -m unocss]
# flag-for-module-uniNetwork: ['', -m uniNetwork]
# flag-for-module-uniUse: ['', -m uniUse]
# flag-for-module-uniPromises: ['', -m uniPromises]
# flag-for-ui-uni: ['', -u uni]
# flag-for-ui-ano: ['', -u ano]
runs-on: ubuntu-latest
env:
FEATURE_FLAGS: ${{ matrix.flag-for-ts }} ${{ matrix.flag-for-eslint }}
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v4
with:
node-version: 18
cache: pnpm
- uses: actions/cache/save@v4
id: cache-restore
with:
path: dist/outfile.cjs
key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }}
- 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