Small CI flakiness fix and performance tweak (#3780)
* perf(ci): use Turbo to schedule both `lint` and `test` tasks at once * fix(ci): wait until service containers are initialized for tests This is achieved by adding a health check to the containers, and instructing the CI workflow to wait until the containers are healthy. Not doing this wait risks spurious CI failures due to DB migrations being applied before the DB even starts. * chore(turbo): use locally installed schema in new Turbo override file On the latest versions of Turbo, this ensures that the used schema is always in sync with what's available in the installed Turbo version, which is something that has already caused confusion to me before.
This commit is contained in:
parent
ab8e474339
commit
c9b98a6154
17
.github/workflows/turbo-ci.yml
vendored
17
.github/workflows/turbo-ci.yml
vendored
@ -25,12 +25,6 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 2
|
||||
|
||||
# This is required because Tauri depends on the frontend build directory to
|
||||
# exist, but it is not created until the frontend is built, which may happen
|
||||
# after the backend is built
|
||||
- name: 📁 Create Tauri frontend build directories
|
||||
run: mkdir -p apps/app-frontend/dist
|
||||
|
||||
- name: 🧰 Install build dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
@ -71,17 +65,14 @@ jobs:
|
||||
- name: 🧰 Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: 🔍 Lint
|
||||
run: pnpm lint
|
||||
|
||||
- name: ⚙️ Start services
|
||||
run: docker compose up -d
|
||||
run: docker compose up --wait
|
||||
|
||||
- name: ⚙️ Setup Labrinth environment and database
|
||||
working-directory: apps/labrinth
|
||||
run: |
|
||||
mv .env.local .env
|
||||
cp .env.local .env
|
||||
sqlx database setup
|
||||
|
||||
- name: ✔️ Test
|
||||
run: pnpm test
|
||||
- name: 🔍 Lint and test
|
||||
run: pnpm run ci
|
||||
|
||||
14
apps/app/turbo.jsonc
Normal file
14
apps/app/turbo.jsonc
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"$schema": "../../node_modules/turbo/schema.json",
|
||||
"extends": ["//"],
|
||||
"tasks": {
|
||||
// Running Clippy and tests on a Tauri application requires
|
||||
// the frontend to be built at least once first
|
||||
"lint": {
|
||||
"dependsOn": ["@modrinth/app-frontend#build"]
|
||||
},
|
||||
"test": {
|
||||
"dependsOn": ["@modrinth/app-frontend#build"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -9,6 +9,11 @@ services:
|
||||
POSTGRES_USER: labrinth
|
||||
POSTGRES_PASSWORD: labrinth
|
||||
POSTGRES_HOST_AUTH_METHOD: trust
|
||||
healthcheck:
|
||||
test: ['CMD', 'pg_isready']
|
||||
interval: 3s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
meilisearch:
|
||||
image: getmeili/meilisearch:v1.12.0
|
||||
restart: on-failure
|
||||
@ -19,6 +24,11 @@ services:
|
||||
environment:
|
||||
MEILI_MASTER_KEY: modrinth
|
||||
MEILI_HTTP_PAYLOAD_SIZE_LIMIT: 107374182400
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '--fail', 'http://localhost:7700/health']
|
||||
interval: 3s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
redis:
|
||||
image: redis:alpine
|
||||
restart: on-failure
|
||||
@ -26,6 +36,11 @@ services:
|
||||
- '6379:6379'
|
||||
volumes:
|
||||
- redis-data:/data
|
||||
healthcheck:
|
||||
test: ['CMD', 'redis-cli', 'PING']
|
||||
interval: 3s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
clickhouse:
|
||||
image: clickhouse/clickhouse-server
|
||||
ports:
|
||||
@ -33,6 +48,11 @@ services:
|
||||
environment:
|
||||
CLICKHOUSE_USER: default
|
||||
CLICKHOUSE_PASSWORD: default
|
||||
healthcheck:
|
||||
test: ['CMD', 'clickhouse-client', '--query', 'SELECT 1']
|
||||
interval: 3s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
volumes:
|
||||
meilisearch-data:
|
||||
db-data:
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
"lint": "turbo run lint --continue",
|
||||
"test": "turbo run test --continue",
|
||||
"fix": "turbo run fix --continue",
|
||||
"ci": "turbo run lint test --continue",
|
||||
"intl:extract": "pnpm ui:intl:extract && pnpm web:intl:extract && pnpm app:intl:extract"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@ -45,15 +45,8 @@
|
||||
"cache": false,
|
||||
"persistent": true,
|
||||
"inputs": ["$TURBO_DEFAULT$", ".env*"],
|
||||
"env": [
|
||||
"DISPLAY",
|
||||
"WEBKIT_DISABLE_DMABUF_RENDERER",
|
||||
"CARGO_*",
|
||||
"RUST_*",
|
||||
"RUSTFLAGS",
|
||||
"FORCE_COLOR",
|
||||
"NEXTEST_*"
|
||||
]
|
||||
"env": ["CARGO_*", "RUST_*", "RUSTFLAGS", "FORCE_COLOR", "NEXTEST_*"],
|
||||
"passThroughEnv": ["DISPLAY", "WEBKIT_DISABLE_DMABUF_RENDERER"]
|
||||
},
|
||||
"test": {
|
||||
"env": [
|
||||
Loading…
x
Reference in New Issue
Block a user