diff --git a/.github/workflows/turbo-ci.yml b/.github/workflows/turbo-ci.yml index c5506c99b..b812cff92 100644 --- a/.github/workflows/turbo-ci.yml +++ b/.github/workflows/turbo-ci.yml @@ -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 diff --git a/apps/app/turbo.jsonc b/apps/app/turbo.jsonc new file mode 100644 index 000000000..7cdf6bd4b --- /dev/null +++ b/apps/app/turbo.jsonc @@ -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"] + } + } +} diff --git a/docker-compose.yml b/docker-compose.yml index 0dbcd1a31..21e8c266c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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: diff --git a/package.json b/package.json index dc435f3df..f5ac243e3 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/turbo.json b/turbo.jsonc similarity index 87% rename from turbo.json rename to turbo.jsonc index 114f515dd..77696a173 100644 --- a/turbo.json +++ b/turbo.jsonc @@ -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": [