mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-15 02:14:44 +00:00
376 lines
10 KiB
YAML
376 lines
10 KiB
YAML
name: test
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- 2.x
|
|
pull_request:
|
|
branches:
|
|
- 2.x
|
|
- "!v[0-9]*"
|
|
|
|
# Remove default permissions of GITHUB_TOKEN for security
|
|
# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
|
|
permissions: {}
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
|
|
cancel-in-progress: ${{ github.event_name != 'push' }}
|
|
|
|
jobs:
|
|
setup:
|
|
runs-on: ${{ matrix.os }}
|
|
if: github.event_name == 'push' || !((github.base_ref == '2.x') && github.head_ref == 'dev')
|
|
|
|
strategy:
|
|
matrix:
|
|
# os: [ubuntu-latest, macos-latest, windows-latest]
|
|
os: [ubuntu-latest]
|
|
|
|
steps:
|
|
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
|
|
with:
|
|
fetch-depth: 0 # All history
|
|
- run: corepack enable
|
|
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
|
with:
|
|
node-version: 18
|
|
cache: "yarn"
|
|
|
|
- name: fetch tags
|
|
run: git fetch --depth=1 origin "+refs/tags/*:refs/tags/*"
|
|
|
|
- name: install
|
|
run: yarn --check-files --frozen-lockfile --non-interactive
|
|
|
|
- name: cache workspace
|
|
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
|
|
with:
|
|
path: |
|
|
node_modules
|
|
packages/*/node_modules
|
|
distributions/*/node_modules
|
|
packages/*/dist
|
|
key: ${{ matrix.os }}-node-v18-nuxt-${{ github.sha }}
|
|
|
|
lint:
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest]
|
|
|
|
steps:
|
|
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
|
|
- run: corepack enable
|
|
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
|
with:
|
|
node-version: 18
|
|
cache: "yarn"
|
|
|
|
- name: restore workspace cache
|
|
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
|
|
with:
|
|
path: |
|
|
node_modules
|
|
packages/*/node_modules
|
|
distributions/*/node_modules
|
|
packages/*/dist
|
|
key: ${{ matrix.os }}-node-v18-nuxt-${{ github.sha }}
|
|
|
|
- name: lint
|
|
run: yarn test:lint
|
|
needs: setup
|
|
|
|
typecheck:
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest]
|
|
|
|
steps:
|
|
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
|
|
- run: corepack enable
|
|
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
|
with:
|
|
node-version: 18
|
|
cache: "yarn"
|
|
|
|
- name: restore workspace cache
|
|
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
|
|
with:
|
|
path: |
|
|
node_modules
|
|
packages/*/node_modules
|
|
distributions/*/node_modules
|
|
packages/*/dist
|
|
key: ${{ matrix.os }}-node-v18-nuxt-${{ github.sha }}
|
|
|
|
- name: test types
|
|
run: yarn test:types
|
|
|
|
- name: test types with vue-tsc
|
|
run: yarn test:vue-types
|
|
needs: setup
|
|
|
|
audit:
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest]
|
|
|
|
steps:
|
|
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
|
|
- run: corepack enable
|
|
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
|
with:
|
|
node-version: 18
|
|
cache: "yarn"
|
|
|
|
- name: restore workspace cache
|
|
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
|
|
with:
|
|
path: |
|
|
node_modules
|
|
packages/*/node_modules
|
|
distributions/*/node_modules
|
|
packages/*/dist
|
|
key: ${{ matrix.os }}-node-v18-nuxt-${{ github.sha }}
|
|
|
|
- name: audit
|
|
run: yarn run audit
|
|
needs: setup
|
|
|
|
test-unit:
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
matrix:
|
|
# os: [ubuntu-latest, macos-latest, windows-latest]
|
|
os: [ubuntu-latest]
|
|
|
|
steps:
|
|
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
|
|
- run: corepack enable
|
|
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
|
with:
|
|
node-version: 18
|
|
cache: "yarn"
|
|
|
|
- name: restore workspace cache
|
|
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
|
|
with:
|
|
path: |
|
|
node_modules
|
|
packages/*/node_modules
|
|
distributions/*/node_modules
|
|
packages/*/dist
|
|
key: ${{ matrix.os }}-node-v18-nuxt-${{ github.sha }}
|
|
|
|
- name: test unit
|
|
run: yarn test:unit --coverage
|
|
|
|
- name: codecov
|
|
uses: codecov/codecov-action@v4
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
flags: unittests
|
|
needs: setup
|
|
|
|
build:
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
matrix:
|
|
# os: [ubuntu-latest, macos-latest, windows-latest]
|
|
os: [ubuntu-latest]
|
|
|
|
env:
|
|
NODE_OPTIONS: "--max_old_space_size=4096"
|
|
|
|
steps:
|
|
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
|
|
- run: corepack enable
|
|
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
|
with:
|
|
node-version: 18
|
|
cache: "yarn"
|
|
|
|
- name: restore workspace cache
|
|
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
|
|
with:
|
|
path: |
|
|
node_modules
|
|
packages/*/node_modules
|
|
distributions/*/node_modules
|
|
packages/*/dist
|
|
key: ${{ matrix.os }}-node-v18-nuxt-${{ github.sha }}
|
|
|
|
- name: build
|
|
run: yarn test:fixtures -i
|
|
|
|
- name: Save fixtures
|
|
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
|
|
with:
|
|
name: fixtures-${{ matrix.os }}-node-v18
|
|
path: test/fixtures
|
|
needs: setup
|
|
|
|
lint-app:
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest]
|
|
|
|
steps:
|
|
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
|
|
- run: corepack enable
|
|
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
|
with:
|
|
node-version: 18
|
|
cache: "yarn"
|
|
|
|
- name: restore workspace cache
|
|
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
|
|
with:
|
|
path: |
|
|
node_modules
|
|
packages/*/node_modules
|
|
distributions/*/node_modules
|
|
packages/*/dist
|
|
key: ${{ matrix.os }}-node-v18-nuxt-${{ github.sha }}
|
|
|
|
- name: restore fixtures
|
|
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
|
|
with:
|
|
name: fixtures-${{ matrix.os }}-node-v18
|
|
path: test/fixtures
|
|
|
|
- name: lint app
|
|
run: yarn lint:app
|
|
needs: build
|
|
|
|
test-dev:
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
matrix:
|
|
# os: [ubuntu-latest, macos-latest, windows-latest]
|
|
os: [ubuntu-latest]
|
|
|
|
steps:
|
|
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
|
|
- run: corepack enable
|
|
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
|
with:
|
|
node-version: 18
|
|
cache: "yarn"
|
|
|
|
- name: restore workspace cache
|
|
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
|
|
with:
|
|
path: |
|
|
node_modules
|
|
packages/*/node_modules
|
|
distributions/*/node_modules
|
|
packages/*/dist
|
|
key: ${{ matrix.os }}-node-v18-nuxt-${{ github.sha }}
|
|
|
|
- name: restore fixtures
|
|
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
|
|
with:
|
|
name: fixtures-${{ matrix.os }}-node-v18
|
|
path: test/fixtures
|
|
|
|
- name: test dev
|
|
run: yarn test:dev
|
|
needs: build
|
|
|
|
test-e2e:
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
matrix:
|
|
# os: [ubuntu-latest, macos-latest, windows-latest]
|
|
os: [ubuntu-latest]
|
|
|
|
steps:
|
|
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
|
|
- run: corepack enable
|
|
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
|
with:
|
|
node-version: 18
|
|
cache: "yarn"
|
|
|
|
- name: restore workspace cache
|
|
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
|
|
with:
|
|
path: |
|
|
node_modules
|
|
packages/*/node_modules
|
|
distributions/*/node_modules
|
|
packages/*/dist
|
|
key: ${{ matrix.os }}-node-v18-nuxt-${{ github.sha }}
|
|
|
|
- name: restore fixtures
|
|
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
|
|
with:
|
|
name: fixtures-${{ matrix.os }}-node-v18
|
|
path: test/fixtures
|
|
|
|
- name: test e2e
|
|
run: yarn test:e2e
|
|
needs: build
|
|
|
|
release-commit:
|
|
permissions:
|
|
id-token: write
|
|
if: github.event_name == 'push' && contains(github.event.head_commit.message, '[release]')
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest]
|
|
|
|
steps:
|
|
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
|
|
with:
|
|
ref: "refs/heads/dev"
|
|
fetch-depth: 0 # All history
|
|
|
|
- name: fetch tags
|
|
run: git fetch --depth=1 origin "+refs/tags/*:refs/tags/*"
|
|
|
|
- name: restore workspace cache
|
|
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
|
|
with:
|
|
path: |
|
|
node_modules
|
|
packages/*/node_modules
|
|
distributions/*/node_modules
|
|
packages/*/dist
|
|
key: ${{ matrix.os }}-node-v18-nuxt-${{ github.sha }}
|
|
|
|
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
|
with:
|
|
node-version: 18
|
|
cache: "yarn"
|
|
registry-url: "https://registry.npmjs.org"
|
|
|
|
- name: bump version
|
|
run: yarn lerna version --yes --no-changelog --no-git-tag-version --no-push --force-publish "*" --loglevel verbose
|
|
|
|
- name: build
|
|
run: PACKAGE_SUFFIX=edge yarn build
|
|
|
|
- name: publish
|
|
run: |
|
|
./scripts/workspace-run npm publish $tag -q
|
|
env:
|
|
ref: ${{ github.ref }}
|
|
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}}
|
|
NPM_CONFIG_PROVENANCE: true
|
|
needs: [lint-app, test-dev, test-unit, test-e2e]
|