-
Notifications
You must be signed in to change notification settings - Fork 26
145 lines (138 loc) · 4.67 KB
/
Copy pathjavascript.yml
File metadata and controls
145 lines (138 loc) · 4.67 KB
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
name: Test and build container
on:
push:
branches: [master]
tags: [v*]
pull_request: # we can use docker image in PR for testing
branches: [master]
env:
REGISTRY: ghcr.io
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20.19
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Code format check
run: pnpm run format:check
test:
runs-on: ubuntu-latest
steps:
- name: Set up SSH deploy key for fonts
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.SSH_DEPLOY_KEY_FONTS }}
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Install pnpm
uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20.19
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Setup submodules
run: bash scripts/build-deps.sh
- name: Install Playwright
run: pnpm exec playwright install chromium --with-deps
# use separate build step to avoid playwright timeout issue
- name: Build SvelteKit vite app
run: pnpm run build
# skip build in test step
- name: Run Tests
run: pnpm run test:no-build
- name: Upload Test Results
if: failure()
uses: actions/upload-artifact@v4
with:
name: playwright-test-results
path: |
test-results/
tests/integration/**/*-snapshots/
retention-days: 7
compression-level: 0 # Skip compression since PNGs are already compressed
build:
runs-on: ubuntu-latest
# 2023-02 disable because tests are too flaky and do not pass on CI at all
# needs: test
# Skip build on master push
if: github.event_name != 'push' || github.ref != 'refs/heads/master'
steps:
- name: Set up SSH deploy key for fonts
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.SSH_DEPLOY_KEY_FONTS }}
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Read metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}
- name: Log in to Github Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
ssh: |
default=${{ env.SSH_AUTH_SOCK }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# experimental: https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md#cache-backend-api
cache-from: type=gha
cache-to: type=gha,mode=max
upload-sourcemaps:
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Read metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}
flavor: latest=false
- name: Log in to Github Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Upload sourcemaps
id: upload-sourcemaps
continue-on-error: true
env:
SENTRY_ORG: ${{ vars.SENTRY_ORG }}
SENTRY_PROJECT: ${{ vars.SENTRY_PROJECT }}
SENTRY_URL: ${{ vars.SENTRY_URL }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_RELEASE: ${{ vars.SENTRY_PROJECT }}@${{ steps.meta.outputs.version }}
run: |
docker run --rm -e SENTRY_ORG -e SENTRY_PROJECT -e SENTRY_URL -e SENTRY_AUTH_TOKEN \
${{ steps.meta.outputs.tags }} \
npx sentry-cli sourcemaps upload -r $SENTRY_RELEASE build/client build/server/chunks
# GH action should still succeed even if sourcemaps upload failed
- name: Echo failure message
run: echo "Sourcemap upload failed"
if: steps.upload-sourcemaps.outcome == 'failure'