-
Notifications
You must be signed in to change notification settings - Fork 43
212 lines (184 loc) · 5.9 KB
/
Copy pathci.yml
File metadata and controls
212 lines (184 loc) · 5.9 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
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
name: CI
on:
push:
branches: [main, staging, develop, dev, hackathon]
pull_request:
branches: [main, staging, develop, dev, hackathon]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup Bun
uses: oven-sh/setup-bun@v2.2.0
with:
bun-version: 1.1.38
- name: Install dependencies
run: |
for i in 1 2 3 4 5; do
bun install --frozen-lockfile && break
echo "Attempt $i failed, retrying in $((i * 15))s..."
sleep $((i * 15))
done
- name: Run ESLint
run: bun run lint
test:
name: Test
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: hyperia
POSTGRES_PASSWORD: hyperia_test
POSTGRES_DB: hyperia_test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
submodules: recursive
- name: Install Tauri system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libgtk-3-dev \
libwebkit2gtk-4.1-dev \
libappindicator3-dev \
librsvg2-dev \
patchelf \
libglib2.0-dev
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Setup Bun
uses: oven-sh/setup-bun@v2.2.0
with:
bun-version: 1.1.38
- name: Cache Turbo
uses: actions/cache@v5
with:
path: .turbo
key: turbo-test-${{ runner.os }}-${{ github.sha }}
restore-keys: |
turbo-test-${{ runner.os }}-
- name: Install dependencies
run: |
for i in 1 2 3 4 5; do
bun install --frozen-lockfile && break
echo "Attempt $i failed, retrying in $((i * 15))s..."
sleep $((i * 15))
done
- name: Build packages in dependency order
run: |
cd packages/physx-js-webidl && bun run build
cd ../shared && bun run build
cd ../decimation && bun run build
cd ../impostors && bun run build
cd ../procgen && bun run build
cd ../plugin-hyperia && bun run build
cd ../server && bun run build
- name: Setup database schema
working-directory: packages/server
run: bunx drizzle-kit push
env:
DATABASE_URL: postgresql://hyperia:hyperia_test@localhost:5432/hyperia_test
- name: Run tests
run: bunx turbo run test --filter='!@hyperforge/app' --filter='!@hyperforge/contracts' --filter='!@playhyperia/duel-oracle-evm' --filter='!@hyperforge/impostor'
env:
DATABASE_URL: postgresql://hyperia:hyperia_test@localhost:5432/hyperia_test
NODE_ENV: test
PUBLIC_CDN_URL: https://assets.hyperia.club
build:
name: Build
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
submodules: recursive
- name: Install Tauri system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libgtk-3-dev \
libwebkit2gtk-4.1-dev \
libappindicator3-dev \
librsvg2-dev \
patchelf \
libglib2.0-dev
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Setup Bun
uses: oven-sh/setup-bun@v2.2.0
with:
bun-version: 1.1.38
- name: Cache Turbo
uses: actions/cache@v5
with:
path: .turbo
key: turbo-build-${{ runner.os }}-${{ github.sha }}
restore-keys: |
turbo-build-${{ runner.os }}-
- name: Install dependencies
run: |
for i in 1 2 3 4 5; do
bun install --frozen-lockfile && break
echo "Attempt $i failed, retrying in $((i * 15))s..."
sleep $((i * 15))
done
- name: Build all packages with Turbo
run: bunx turbo run build --filter=!@hyperforge/app
- name: Upload build artifacts
uses: actions/upload-artifact@v7
with:
name: build-artifacts
path: |
packages/shared/dist
packages/shared/build
packages/server/dist
packages/client/dist
packages/client/build
retention-days: 7
docker:
name: Docker Build
runs-on: ubuntu-latest
needs: [build]
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/hackathon')
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Determine environment
id: env
run: |
if [ "${{ github.ref_name }}" = "main" ]; then
echo "env_tag=production" >> $GITHUB_OUTPUT
elif [ "${{ github.ref_name }}" = "staging" ]; then
echo "env_tag=staging" >> $GITHUB_OUTPUT
else
echo "env_tag=development" >> $GITHUB_OUTPUT
fi
- name: Build Docker image
uses: docker/build-push-action@v7
with:
context: .
file: ./Dockerfile.server
push: false
tags: |
hyperia-server:${{ github.sha }}
hyperia-server:${{ steps.env.outputs.env_tag }}-${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max