From 7614c3fac76abeb02c281c8a3dd15c8317152300 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Ernst?= Date: Mon, 3 Aug 2026 12:46:54 +0200 Subject: [PATCH 1/2] ci: skip integration tests for Dependabot --- .github/workflows/CI.yml | 7 ++++++- AGENTS.md | 9 ++++++++- .../java/com/relewise/client/ClientConstructionTest.java | 4 ++-- .../com/relewise/client/DateTimeSerializationTest.java | 4 ++-- src/src/test/java/com/relewise/client/TestBase.java | 3 +++ 5 files changed, 21 insertions(+), 6 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index fb3963cc..4870b5cb 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -33,14 +33,19 @@ jobs: run: mvn resources:resources --file src/pom.xml - name: Test + if: ${{ github.actor != 'dependabot[bot]' }} run: mvn --batch-mode -Dmaven.test.failure.ignore=true test --file src/pom.xml env: DATASET_ID: ${{secrets.INTEGRATIONTESTS_DATASET_ID}} API_KEY: ${{secrets.INTEGRATIONTESTS_API_KEY}} + - name: Unit tests + if: ${{ github.actor == 'dependabot[bot]' }} + run: mvn --batch-mode -DexcludedGroups=integration test --file src/pom.xml + - name: Report uses: dorny/test-reporter@v1 - if: always() + if: ${{ always() && github.actor != 'dependabot[bot]' }} with: name: Maven Tests path: src/target/surefire-reports/*.xml diff --git a/AGENTS.md b/AGENTS.md index 432b0fdd..f54040f2 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -76,9 +76,16 @@ Run tests: mvn --batch-mode test --file src/pom.xml ``` +Run tests that do not require integration credentials: + +```powershell +mvn --batch-mode -DexcludedGroups=integration test --file src/pom.xml +``` + ## Testing and Credentials -- Tests use `DATASET_ID` and `API_KEY` from environment (`TestBase`). +- Integration tests inherit the `integration` tag and use `DATASET_ID` and `API_KEY` from the environment (`TestBase`). - CI injects credentials from secrets. +- CI excludes integration tests when triggered by Dependabot. - If credentials are unavailable locally, explicitly report integration-style test coverage as not run. ## Validation Policy (CI-Aligned, Pragmatic) diff --git a/src/src/test/java/com/relewise/client/ClientConstructionTest.java b/src/src/test/java/com/relewise/client/ClientConstructionTest.java index 71bd4ab9..4981ac00 100644 --- a/src/src/test/java/com/relewise/client/ClientConstructionTest.java +++ b/src/src/test/java/com/relewise/client/ClientConstructionTest.java @@ -7,7 +7,7 @@ import static org.junit.jupiter.api.Assertions.*; -public class ClientConstructionTest extends TestBase { +public class ClientConstructionTest { @Test public void testApiKeyEmpty() { assertThrows(IllegalArgumentException.class, () -> new Tracker("00000000-0000-0000-0000-000000000001", "", "https://api.relewise.com/")); @@ -24,4 +24,4 @@ public void testApiKeyValid() { assertNotNull(tracker); } -} \ No newline at end of file +} diff --git a/src/src/test/java/com/relewise/client/DateTimeSerializationTest.java b/src/src/test/java/com/relewise/client/DateTimeSerializationTest.java index a983069a..405aa4c6 100644 --- a/src/src/test/java/com/relewise/client/DateTimeSerializationTest.java +++ b/src/src/test/java/com/relewise/client/DateTimeSerializationTest.java @@ -14,7 +14,7 @@ import static org.junit.jupiter.api.Assertions.*; -public class DateTimeSerializationTest extends TestBase { +public class DateTimeSerializationTest { @Test public void testSerializeOffsetDateTime() throws Exception { var objectMapper = JsonMapper.builder() @@ -42,4 +42,4 @@ public void testSerializeLocalDateTime() throws Exception { assertEquals("\"" + input + "\"", serialized); } -} \ No newline at end of file +} diff --git a/src/src/test/java/com/relewise/client/TestBase.java b/src/src/test/java/com/relewise/client/TestBase.java index 2825503f..d1774fb3 100644 --- a/src/src/test/java/com/relewise/client/TestBase.java +++ b/src/src/test/java/com/relewise/client/TestBase.java @@ -1,5 +1,8 @@ package com.relewise.client; +import org.junit.jupiter.api.Tag; + +@Tag("integration") public abstract class TestBase { public static String GetDatasetId() { From eeebc28473782bf0ef9f2cf86ef3380885829e5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Ernst?= Date: Mon, 3 Aug 2026 13:09:20 +0200 Subject: [PATCH 2/2] ci: upgrade Java workflow actions --- .github/workflows/CI.yml | 4 ++-- .github/workflows/generate-api-version.yml | 2 +- .github/workflows/publish.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 4870b5cb..dc3d6cfa 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -20,7 +20,7 @@ jobs: run: ./generate.sh - name: Set up JDK 17 - uses: actions/setup-java@v4 + uses: actions/setup-java@v5.6.0 with: java-version: '17' distribution: 'temurin' @@ -44,7 +44,7 @@ jobs: run: mvn --batch-mode -DexcludedGroups=integration test --file src/pom.xml - name: Report - uses: dorny/test-reporter@v1 + uses: dorny/test-reporter@v3 if: ${{ always() && github.actor != 'dependabot[bot]' }} with: name: Maven Tests diff --git a/.github/workflows/generate-api-version.yml b/.github/workflows/generate-api-version.yml index 1201c43a..ffa5a803 100644 --- a/.github/workflows/generate-api-version.yml +++ b/.github/workflows/generate-api-version.yml @@ -81,7 +81,7 @@ jobs: "Resolved Relewise.Client version $version." >> $env:GITHUB_STEP_SUMMARY - name: Set up JDK 17 - uses: actions/setup-java@v4 + uses: actions/setup-java@v5.6.0 with: java-version: '17' distribution: 'temurin' diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 38967d83..12f60c75 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -28,7 +28,7 @@ jobs: run: ./generate.sh - name: Set up JDK 17 and Maven Central auth - uses: actions/setup-java@v5 + uses: actions/setup-java@v5.6.0 with: distribution: 'temurin' java-version: '17'