-
-
Notifications
You must be signed in to change notification settings - Fork 26
224 lines (188 loc) · 6.31 KB
/
lint-test-build.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
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
224
name: Lint Test Build
on:
pull_request:
branches:
- main
- feature/**
push:
branches:
- main
- feature/**
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref || github.run_id }}
cancel-in-progress: true
jobs:
pre_job:
name: Pre Job
runs-on: ubuntu-latest
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v3.4.0
with:
skip_after_successful_duplicate: "true"
do_not_skip: '["workflow_dispatch", "schedule"]'
- name: Set output
run: echo "should_skip=${{ steps.skip_check.outputs.should_skip }}" >> $GITHUB_OUTPUT
lint:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
container: ghcr.io/scuffletv/ci/build:latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: pnpm install -r
- name: Fix git safe directory
run: git config --global --add safe.directory '*'
- name: Lint
run: mask lint
test:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
container: ghcr.io/scuffletv/ci/build:latest
services:
cockroach:
image: ghcr.io/scuffletv/ci/cockroach:latest
env:
ARGS: start-single-node --insecure --advertise-addr=0.0.0.0
ports:
- 26257:26257
- 8080:8080
nats:
image: ghcr.io/scuffletv/ci/nats:latest
env:
ARGS: -js
ports:
- 4222:4222
- 8222:8222
- 6222:6222
redis:
image: ghcr.io/scuffletv/ci/redis:latest
ports:
- 6379:6379
minio:
image: ghcr.io/scuffletv/ci/minio:latest
env:
ARGS: server /export --console-address ":9001"
MINIO_ACCESS_KEY: root
MINIO_SECRET_KEY: scuffle123
ports:
- 9000:9000
- 9001:9001
env:
PLATFORM_DATABASE_URL: postgres://root@cockroach:26257/scuffle_platform
VIDEO_DATABASE_URL: postgres://root@cockroach:26257/scuffle_video
PLATFORM_DATABASE_URL_TEST: postgres://root@cockroach:26257/scuffle_platform_test
VIDEO_DATABASE_URL_TEST: postgres://root@cockroach:26257/scuffle_video_test
NATS_ADDR: nats:4222
REDIS_ADDR: redis:6379
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: pnpm install -r
- name: Migrate database
run: mask dev migrate
- name: Install MinIO client
run: curl -sL https://dl.min.io/client/mc/release/linux-amd64/mc > /usr/local/bin/mc && chmod +x /usr/local/bin/mc
- name: Setup Minio
run: |
mc config host add myminio http://minio:9000 root scuffle123;
mc rb --force myminio/scuffle-video || true;
mc rb --force myminio/scuffle-image-processor || true;
mc rb --force myminio/scuffle-image-processor-public || true;
mc mb myminio/scuffle-video;
mc mb myminio/scuffle-image-processor;
mc mb myminio/scuffle-image-processor-public;
mc anonymous set download myminio/scuffle-video;
mc anonymous set download myminio/scuffle-image-processor-public;
- name: Test
run: mask test --ci
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
fail_ci_if_error: true
build:
needs: [pre_job, lint, test]
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
container: ghcr.io/scuffletv/ci/build:latest
steps:
- uses: actions/checkout@v4
# This is needed to prevent git from complaining about the
# `fatal: detected dubious ownership in repository at` error
# when trying to build the website.
- name: Configure git
run: |
git config --global --add safe.directory '*'
- name: Install dependencies
run: pnpm install -r
- name: Build Player Demo
run: pnpm -F="@scuffle/player" build
- name: Upload Artifact (Player Demo)
uses: actions/upload-artifact@v4
with:
name: video-player-demo
if-no-files-found: error
path: video/player/dist/*
- name: Build Website
run: pnpm -F="website" build
- name: Upload Artifact (Website)
uses: actions/upload-artifact@v4
with:
name: platform-website
if-no-files-found: error
path: platform/website/dist/*
- name: Build (release fat-lto)
if: github.ref == 'refs/heads/main'
run: cargo build --profile release-fat
- name: Build (release thin-lto)
if: github.ref != 'refs/heads/main'
run: cargo build --profile release
- name: Upload Artifact (platform-api)
uses: actions/upload-artifact@v4
with:
name: platform-api
if-no-files-found: error
path: target/release/platform-api
- name: Upload Artifact (platform-image-processor)
uses: actions/upload-artifact@v4
with:
name: image-processor
if-no-files-found: error
path: target/release/platform-image-processor
- name: Upload Artifact (video-api)
uses: actions/upload-artifact@v4
with:
name: video-api
if-no-files-found: error
path: target/release/video-api
- name: Upload Artifact (video-ingest)
uses: actions/upload-artifact@v4
with:
name: video-ingest
if-no-files-found: error
path: target/release/video-ingest
- name: Upload Artifact (video-transcoder)
uses: actions/upload-artifact@v4
with:
name: video-transcoder
if-no-files-found: error
path: target/release/video-transcoder
- name: Upload Artifact (video-edge)
uses: actions/upload-artifact@v4
with:
name: video-edge
if-no-files-found: error
path: target/release/video-edge
- name: Upload Artifact (video-cli)
uses: actions/upload-artifact@v4
with:
name: video-cli
if-no-files-found: error
path: target/release/video-cli