-
Notifications
You must be signed in to change notification settings - Fork 7
223 lines (183 loc) · 6.43 KB
/
ci.yaml
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
name: CI
on:
push:
branches: ['main']
tags: ['**']
pull_request:
workflow_dispatch:
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1'
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- job_name: eslint
run_script: yarn run eslint:lint
- job_name: build
run_script: yarn run build
- job_name: test
run_script: yarn run test
- job_name: api-exporter
run_script: |
yarn run ts:build
yarn run ae:test
- job_name: lint-imports
run_script: yarn tsx ./scripts/lint/module-import-linter.ts
- job_name: dedupe
run_script: yarn dedupe --check
container: node:20-alpine
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Get yarn cache directory path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
id: yarn-cache-dir-path
- name: Install GNU tar
run: apk add --no-cache tar
- name: Set up yarn cache
uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install yarn deps
run: |
yarn --version
yarn install --immutable
- name: Run ${{ matrix.job_name }}
run: ${{ matrix.run_script }}
playwright:
if: false
needs: [ test ]
runs-on: ubuntu-latest
container: mcr.microsoft.com/playwright:v1.40.1-focal
services:
postgres:
image: postgres:13-alpine
env:
POSTGRES_PASSWORD: 'contember'
POSTGRES_USER: 'contember'
POSTGRES_DB: 'contember'
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
contember-engine:
image: contember/engine:1.4.0-beta.1
env:
NODE_ENV: 'development'
CONTEMBER_PORT: '4000'
CONTEMBER_ROOT_EMAIL: 'superadmin@localhost'
CONTEMBER_ROOT_PASSWORD: 'superadmin@localhost'
CONTEMBER_ROOT_TOKEN: '0000000000000000000000000000000000000000'
CONTEMBER_LOGIN_TOKEN: '1111111111111111111111111111111111111111'
CONTEMBER_ENCRYPTION_KEY: '0000000000000000000000000000000000000000000000000000000000000000'
DEFAULT_DB_HOST: 'postgres'
DEFAULT_DB_PORT: '5432'
DEFAULT_DB_USER: 'contember'
DEFAULT_DB_PASSWORD: 'contember'
TENANT_DB_NAME: 'contember'
DEFAULT_S3_ENDPOINT: 'http://minio:9000'
DEFAULT_S3_PROVIDER: 'minio'
DEFAULT_S3_REGION: ''
DEFAULT_S3_BUCKET: 'contember'
DEFAULT_S3_PREFIX: 'data'
DEFAULT_S3_KEY: 'contember'
DEFAULT_S3_SECRET: 'contember'
minio:
image: bitnami/minio
env:
MINIO_ROOT_USER: 'contember'
MINIO_ROOT_PASSWORD: 'contember'
MINIO_DEFAULT_BUCKETS: 'contember:download'
env:
VITE_CONTEMBER_ADMIN_API_BASE_URL: 'http://contember-engine:4000'
VITE_CONTEMBER_ADMIN_SESSION_TOKEN: '0000000000000000000000000000000000000000'
HOME: '/root'
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- name: Set up yarn cache
uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install yarn deps
run: |
yarn --version
yarn install --immutable
- name: Prepare for playwright tests
run: |
yarn run admin:pw:build
- name: Run playwright tests
run: yarn run admin:pw:test --forbid-only
- uses: jakejarvis/s3-sync-action@master
if: always()
with:
args: --acl public-read
env:
AWS_S3_BUCKET: 'contember-admin'
AWS_ACCESS_KEY_ID: ${{ secrets.PLAYWRIGHT_S3_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.PLAYWRIGHT_S3_SECRET }}
AWS_S3_ENDPOINT: 'https://fra1.digitaloceanspaces.com'
SOURCE_DIR: 'packages/admin/tests/playwright/report'
DEST_DIR: ${{ github.sha }}
- uses: phulsechinmay/[email protected]
if: always() && github.event_name == 'pull_request'
with:
message: '[Playwright Test Report](https://contember-admin.fra1.digitaloceanspaces.com/${{ github.sha }}/index.html)'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-npm:
if: github.event_name == 'push' && github.ref_type == 'tag'
needs: [test]
runs-on: ubuntu-latest
container: node:20-alpine
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- name: Install GNU tar
run: apk add --no-cache tar
- name: Set up yarn cache
uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Extract version from tag
run: echo "PACKAGE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
- name: Install yarn deps
run: |
yarn --version
yarn install --immutable
- name: Build
run: yarn run build
- name: Publish
run: |
yarn config set npmAuthToken "$NPM_TOKEN"
yarn workspaces foreach -t version "${GITHUB_REF:11}"
# Extract the npm-tag from package.json
NPM_TAG=$(sed -n 's/.*"npm-tag": "\(.*\)",/\1/p' package.json)
if [ -z "$NPM_TAG" ]; then
echo "npm-tag not found in package.json"
exit 1
fi
# Use the extracted npm-tag in the npm publish command
yarn workspaces foreach -pt --no-private npm publish --tag $NPM_TAG --access public