From 0c6e283567b174eb660ae8de23067e019512a5ad Mon Sep 17 00:00:00 2001 From: Luigi Ruocco Date: Thu, 16 Oct 2025 14:20:48 +0200 Subject: [PATCH 1/3] feat: conditionally perform platform tests --- .github/workflows/pr-build-test.yaml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-build-test.yaml b/.github/workflows/pr-build-test.yaml index 163c926..80d9849 100644 --- a/.github/workflows/pr-build-test.yaml +++ b/.github/workflows/pr-build-test.yaml @@ -17,6 +17,18 @@ jobs: with: fetch-depth: 0 + # We want platform tests but some repos that we migrate may not have unit tests or have only standalone-actors + - name: Check if we have tests folder + run: | + if [ -d "code/test/platform" ]; then + echo "TEST_DIR=./code" >> $GITHUB_ENV + elif [ -d "test/platform" ]; then + echo "TEST_DIR=." >> $GITHUB_ENV + else + echo "Test folder not found at /test or /code/test. Skipping tests." + exit 0 + fi + - uses: oNaiPs/secrets-to-env-action@b64e0192bc4bd2ec0682dee8696470d4866577fa with: secrets: ${{ toJSON(secrets) }} @@ -42,7 +54,7 @@ jobs: run: | export ACTOR_BUILDS='${{ steps.build.outputs.actor_builds }}' export RUN_PLATFORM_TESTS=1 - npx vitest ./test/platform --run + npx vitest ./${{ env.TEST_DIR }} --run # NOTE: we want to cache the latest commit only if the tests are successfull - name: Cache latest commit From 256ba17d8b7d6e247d46ba0af1a0be93f12797f9 Mon Sep 17 00:00:00 2001 From: Luigi Ruocco Date: Thu, 16 Oct 2025 14:40:39 +0200 Subject: [PATCH 2/3] fix: use working-directory --- .github/workflows/pr-build-test.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-build-test.yaml b/.github/workflows/pr-build-test.yaml index 80d9849..7bbdb8d 100644 --- a/.github/workflows/pr-build-test.yaml +++ b/.github/workflows/pr-build-test.yaml @@ -54,7 +54,8 @@ jobs: run: | export ACTOR_BUILDS='${{ steps.build.outputs.actor_builds }}' export RUN_PLATFORM_TESTS=1 - npx vitest ./${{ env.TEST_DIR }} --run + npx vitest ./test/platform --run + working-directory: ${{ env.TEST_DIR }} # NOTE: we want to cache the latest commit only if the tests are successfull - name: Cache latest commit From e580c8c90c6b1dd2a41e69736ee2891255681f78 Mon Sep 17 00:00:00 2001 From: Luigi Ruocco Date: Thu, 16 Oct 2025 14:44:33 +0200 Subject: [PATCH 3/3] fix: use working-directory on all steps --- .github/workflows/pr-build-test.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pr-build-test.yaml b/.github/workflows/pr-build-test.yaml index 7bbdb8d..b7950cf 100644 --- a/.github/workflows/pr-build-test.yaml +++ b/.github/workflows/pr-build-test.yaml @@ -42,6 +42,7 @@ jobs: - name: Install dependencies run: npm install + working-directory: ${{ env.TEST_DIR }} - name: Build id: build @@ -49,6 +50,7 @@ jobs: export base_commit=$(cat base_commit.txt) actor_builds=$(npx apify-test-tools build --source-branch "origin/${{ github.head_ref }}" --target-branch "origin/${{ github.base_ref }}" $(test $base_commit && echo "--base-commit $base_commit" || echo "")) echo "actor_builds=$actor_builds" | tee -a $GITHUB_OUTPUT + working-directory: ${{ env.TEST_DIR }} - name: Test run: |