diff --git a/.github/workflows/build_workflow.yml b/.github/workflows/build_workflow.yml index 049a74d5..37512117 100644 --- a/.github/workflows/build_workflow.yml +++ b/.github/workflows/build_workflow.yml @@ -8,6 +8,10 @@ on: branches: - main +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: checkstyle: name: Checkstyle @@ -21,6 +25,7 @@ jobs: with: java-version: 21 distribution: 'temurin' + cache: gradle - name: Checkstyle run: | @@ -56,6 +61,7 @@ jobs: with: java-version: 21 distribution: 'temurin' + cache: gradle - name: Spotbugs run: | @@ -93,6 +99,7 @@ jobs: with: java-version: 21 distribution: 'temurin' + cache: gradle - name: Execute Unit Tests run: ./gradlew test jacocoTestReport --parallel --build-cache @@ -128,6 +135,7 @@ jobs: with: java-version: 21 distribution: 'temurin' + cache: gradle - name: Start Docker Dependencies env: diff --git a/README.md b/README.md index 003c83e9..12fb15f4 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,13 @@ The adaptor does not perform a PDS lookup/trace. You must perform the PDS lookup * JDK 21 * Docker +## Directory Conventions + +- Run service build/test commands from `service/` +- Run mock service build/test commands from `gpcc-mocks/` +- Run Docker helper scripts from `docker/` +- Use the repo Gradle Wrapper (`./gradlew` or `.\\gradlew.bat`) instead of a locally installed `gradle`. + ## Configuration The adaptor reads its configuration from environment variables. The following sections describe the environment variables @@ -114,22 +121,22 @@ Edit `vars.local.sh` / `vars.public.sh` to add any missing values e.g. Spine cer For local environment to run against mocks: ```bash +cd docker ./start-local-environment-mocks.sh ``` For local environment to run against GP Demonstrator 1.6.0: ```bash +cd docker ./start-local-environment-public.sh ``` -You can also run the docker-compose commands directly. +You can also run the Docker Compose commands directly. ## How to Run Tests -**Warning**: Gradle uses a [Build Cache](https://docs.gradle.org/current/userguide/build_cache.html) to re-use compile and -test outputs for faster builds. To re-run passing tests without making any code changes you must first run -`./gradlew clean` to clear the build cache. Otherwise, gradle uses the cached outputs from a previous test execution to -pass the build. +Gradle can re-use previous task outputs. To force a full re-run of tests without changing source files, use +`--rerun-tasks` (or run `clean` before the test command). You must run all Gradle commands from the `service/` directory. @@ -147,7 +154,7 @@ tests and after making any changes to the mocks project. The JUnit tests use ```shell script cd docker/ -docker-compose build gpcc-mocks +docker compose build gpcc-mocks ``` Then run the integration tests from within the IDE or using Gradle: diff --git a/service/build.gradle b/service/build.gradle index 47e290ab..737c3cf3 100644 --- a/service/build.gradle +++ b/service/build.gradle @@ -40,10 +40,8 @@ dependencies { implementation "com.heroku.sdk:env-keystore:1.1.12" implementation "org.apache.commons:commons-lang3:3.19.0" - implementation 'org.jetbrains:annotations:26.0.2' + implementation "org.jetbrains:annotations:26.0.2-1" testImplementation "io.projectreactor:reactor-test" - implementation ("org.apache.commons:commons-lang3:3.19.0") - implementation 'org.jetbrains:annotations:26.0.2-1' implementation 'com.github.spullara.mustache.java:compiler:0.9.14' spotbugs 'com.github.spotbugs:spotbugs:4.9.8' @@ -98,13 +96,11 @@ configurations { } tasks.register('integrationTest', Test) { - useJUnitPlatform() { - description = "Runs integration tests." - group = "verification" - - testClassesDirs = sourceSets.integrationTest.output.classesDirs - classpath = sourceSets.integrationTest.runtimeClasspath - } + description = "Runs integration tests." + group = "verification" + useJUnitPlatform() + testClassesDirs = sourceSets.integrationTest.output.classesDirs + classpath = sourceSets.integrationTest.runtimeClasspath shouldRunAfter test }