From b7aad5cda1590f97080c5d8f3d7c3a49214ff45c Mon Sep 17 00:00:00 2001 From: "Calum H. (IMB11)" Date: Wed, 24 Dec 2025 21:49:37 +0000 Subject: [PATCH] devex: skip services + env + db steps in CI if not needed --- .github/workflows/turbo-ci.yml | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/turbo-ci.yml b/.github/workflows/turbo-ci.yml index ba62ac5a54..22b7f57dd6 100644 --- a/.github/workflows/turbo-ci.yml +++ b/.github/workflows/turbo-ci.yml @@ -70,19 +70,33 @@ jobs: - name: 🧰 Install dependencies run: pnpm install + - name: ⚙️ Set app environment + working-directory: packages/app-lib + run: cp .env.staging .env + + # check if labrinth tests will actually run (cache miss) + - name: 🔍 Check if labrinth tests need to run + id: check-labrinth + run: | + LABRINTH_TEST_STATUS=$(pnpm turbo run test --filter=@modrinth/labrinth --dry-run=json | jq -r '.tasks[] | select(.task == "test") | .cache.status') + echo "Labrinth test cache status: $LABRINTH_TEST_STATUS" + if [ "$LABRINTH_TEST_STATUS" = "HIT" ]; then + echo "needs_services=false" >> $GITHUB_OUTPUT + else + echo "needs_services=true" >> $GITHUB_OUTPUT + fi + - name: ⚙️ Start services + if: steps.check-labrinth.outputs.needs_services == 'true' run: docker compose up --wait - name: ⚙️ Setup labrinth environment and database + if: steps.check-labrinth.outputs.needs_services == 'true' working-directory: apps/labrinth run: | cp .env.local .env sqlx database setup - - name: ⚙️ Set app environment - working-directory: packages/app-lib - run: cp .env.staging .env - - name: 🔍 Lint and test run: pnpm run ci