-
Notifications
You must be signed in to change notification settings - Fork 2
161 lines (146 loc) · 4.26 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: ci
on:
push:
branches:
- 'nuxt3'
pull_request:
branches-ignore:
- main
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node: [lts/*,latest]
include:
- node: latest
coverage: true
lint: true
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Enable corepack and PNPM
run: |
corepack enable
corepack prepare pnpm@latest --activate
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
# cache: "pnpm"
# cache-dependency-path: ./package.json
- name: Install dependencies
run: pnpm install
- name: Prepare
run: pnpm run dev:prepare
- name: Lint
if: matrix.lint
run: pnpm run lint
- name: Build module
run: pnpm run dev:build
- name: Enable code coverage
if: matrix.coverage
run: echo "COVERAGE=1" >> $GITHUB_ENV
- name: Unit tests
run: |
mkdir -p coverage
if [ "$COVERAGE" = '1' ]; then
pnpm run test:coverage
else
pnpm run test
fi
env:
CI: true
- name: Upload test artifacts
if: matrix.coverage
uses: actions/upload-artifact@v4
with:
name: vitest-logs-unit${{ matrix.node }}
path: ./coverage
if-no-files-found: error
- name: Upload coverage results to Codecov
if: matrix.coverage
uses: codecov/codecov-action@v4
with:
name: vitest-node-${{ matrix.node }}
flags: vitest
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/coverage-final.json
- name: Audit
run: pnpm audit
deploy-next:
runs-on: ubuntu-latest
needs: [test]
# if: github.event_name == 'push' && !contains(github.event.head_commit.message, '[skip-release]')
if: github.ref == 'refs/heads/nuxt3' && github.event_name == 'push' && !contains(github.event.head_commit.message, '[skip-release]')
strategy:
matrix:
node: [ 20 ]
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: "pnpm"
- run: pnpm install
- run: pnpm dev:prepare
- run: pnpm build
- name: Release Edge
if: |
github.ref == 'refs/heads/nuxt3' &&
github.event_name == 'push' &&
!contains(github.event.head_commit.message, '[skip-release]')
run: ./scripts/release-edge.sh
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
NPM_CONFIG_PROVENANCE: true
# e2e:
# runs-on: ubuntu-latest
# strategy:
# matrix:
# node: [16]
# fail-fast: true
# container: cypress/included:10.11.0
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Install SASS dependencies
# run: |
# apt-get update
# apt-get install -y g++ build-essential
# - name: Use Node.js ${{ matrix.node }}
# uses: actions/setup-node@v4
# with:
# node-version: ${{ matrix.node }}
# - name: Cache Node.js modules
# uses: actions/cache@v3
# with:
# path: ~/.yarn
# key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}
# restore-keys: |
# ${{ runner.OS }}-node-
# ${{ runner.OS }}-
# - name: Install dependencies
# run: yarn --frozen-lockfile
# - name: Start API, Build and Start Demo Application
# env:
# API_PORT: 3100
# API_URL: http://localhost:3100
# NODE_TLS_REJECT_UNAUTHORIZED: 0
# DISABLE_HTTPS: true
# TESTING: true
# run: |
# yarn api &
# yarn run demo:build
# yarn run demo:start &
# npx wait-on 'http://localhost:3000'
# curl -XGET localhost:3000
# - name: Run E2E
# env:
# CYPRESS_BASE_URL: http://localhost:3000
# run: yarn e2e --record --key=${{secrets.CYPRESS_RECORD_KEY}}