Nuxt/.github/workflows/test.yml

344 lines
9.8 KiB
YAML
Raw Normal View History

name: test
on:
push:
branches:
- 2.x
pull_request:
branches:
- 2.x
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]
2023-05-03 09:19:58 +00:00
node: [16]
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
2020-03-03 13:05:52 +00:00
fetch-depth: 0 # All history
- run: corepack enable
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: ${{ matrix.node }}
cache: "yarn"
2020-03-03 13:05:52 +00:00
- 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@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
node_modules
packages/*/node_modules
distributions/*/node_modules
packages/*/dist
key: ${{ matrix.os }}-node-v${{ matrix.node }}-nuxt-${{ github.sha }}
lint:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
2023-05-03 09:19:58 +00:00
node: [16]
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- run: corepack enable
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: ${{ matrix.node }}
cache: "yarn"
- name: restore workspace cache
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
node_modules
packages/*/node_modules
distributions/*/node_modules
packages/*/dist
key: ${{ matrix.os }}-node-v${{ matrix.node }}-nuxt-${{ github.sha }}
- name: lint
run: yarn test:lint
2020-07-27 09:03:11 +00:00
- name: test types
run: yarn test:types
needs: setup
audit:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
2023-05-03 09:19:58 +00:00
node: [16]
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- run: corepack enable
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: ${{ matrix.node }}
cache: "yarn"
- name: restore workspace cache
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
node_modules
packages/*/node_modules
distributions/*/node_modules
packages/*/dist
key: ${{ matrix.os }}-node-v${{ matrix.node }}-nuxt-${{ github.sha }}
- name: audit
2020-01-14 22:15:45 +00:00
run: yarn run audit
needs: setup
test-unit:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest]
2023-05-03 09:19:58 +00:00
node: [16]
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- run: corepack enable
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: ${{ matrix.node }}
cache: "yarn"
- name: restore workspace cache
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
node_modules
packages/*/node_modules
distributions/*/node_modules
packages/*/dist
key: ${{ matrix.os }}-node-v${{ matrix.node }}-nuxt-${{ github.sha }}
- name: test unit
run: yarn test:unit --coverage
- name: codecov
uses: codecov/codecov-action@v3
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]
2023-05-03 09:19:58 +00:00
node: [16]
env:
NODE_OPTIONS: "--max_old_space_size=4096"
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- run: corepack enable
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: ${{ matrix.node }}
cache: "yarn"
- name: restore workspace cache
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
node_modules
packages/*/node_modules
distributions/*/node_modules
packages/*/dist
key: ${{ matrix.os }}-node-v${{ matrix.node }}-nuxt-${{ github.sha }}
- name: build
run: yarn test:fixtures -i
- name: Save fixtures
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: fixtures-${{ matrix.os }}-node-v${{ matrix.node }}
path: test/fixtures
needs: setup
lint-app:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
2023-05-03 09:19:58 +00:00
node: [16]
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- run: corepack enable
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: ${{ matrix.node }}
cache: "yarn"
- name: restore workspace cache
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
node_modules
packages/*/node_modules
distributions/*/node_modules
packages/*/dist
key: ${{ matrix.os }}-node-v${{ matrix.node }}-nuxt-${{ github.sha }}
- name: restore fixtures
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: fixtures-${{ matrix.os }}-node-v${{ matrix.node }}
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]
2023-05-03 09:19:58 +00:00
node: [16]
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- run: corepack enable
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: ${{ matrix.node }}
cache: "yarn"
- name: restore workspace cache
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
node_modules
packages/*/node_modules
distributions/*/node_modules
packages/*/dist
key: ${{ matrix.os }}-node-v${{ matrix.node }}-nuxt-${{ github.sha }}
- name: restore fixtures
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: fixtures-${{ matrix.os }}-node-v${{ matrix.node }}
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]
2023-05-03 09:19:58 +00:00
node: [16]
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- run: corepack enable
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: ${{ matrix.node }}
cache: "yarn"
- name: restore workspace cache
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
node_modules
packages/*/node_modules
distributions/*/node_modules
packages/*/dist
key: ${{ matrix.os }}-node-v${{ matrix.node }}-nuxt-${{ github.sha }}
- name: restore fixtures
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: fixtures-${{ matrix.os }}-node-v${{ matrix.node }}
path: test/fixtures
- name: test e2e
run: yarn test:e2e
needs: build
release-commit:
if: github.event_name == 'push' && contains(github.event.head_commit.message, '[release]')
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
2023-05-03 09:19:58 +00:00
node: [16]
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
2023-01-19 15:03:28 +00:00
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@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
node_modules
packages/*/node_modules
distributions/*/node_modules
packages/*/dist
key: ${{ matrix.os }}-node-v${{ matrix.node }}-nuxt-${{ github.sha }}
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: ${{ matrix.node }}
cache: "yarn"
2023-01-19 15:03:28 +00:00
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}}
needs: [lint-app, test-dev, test-unit, test-e2e]