diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c908bf2f5..ca86e44b6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,7 @@ name: CI env: - MAVEN_VERSION: '3.6.3' + MAVEN_VERSION: '3.9.9' # Cloud storage environment variables (available to all jobs that need them) AWS_S3_HOST: ${{ secrets.AWS_S3_HOST }} AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} @@ -15,7 +15,6 @@ env: GS_PROJECT_ID: ${{ secrets.GS_PROJECT_ID }} # Tokens SONARQ_TOKEN: ${{ secrets.SONARQ_TOKEN }} - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} BLACK_DUCK_TOKEN: ${{ secrets.BLACK_DUCK_TOKEN }} # Other DEPLOYMENT_USER: ${{ secrets.DEPLOYMENT_USER }} @@ -42,24 +41,108 @@ jobs: name: Build needs: requires-approval runs-on: ubuntu-latest - strategy: - matrix: - java-version: [ 17, 21 ] steps: - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@v4 + + - name: Set up Java 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: sapmachine + cache: maven + + - name: Set up Maven ${{ env.MAVEN_VERSION }} + uses: stCarolas/setup-maven@v5 + with: + maven-version: ${{ env.MAVEN_VERSION }} - name: Spotless check run: mvn spotless:check -Dspotless.check.skip=false - - name: Build - uses: ./.github/actions/build + # Build once with Java 17, upload artifacts + build: + name: Build & Mutation Testing + runs-on: ubuntu-latest + needs: quality-checks + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Java 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: sapmachine + cache: maven + + - name: Set up Maven ${{ env.MAVEN_VERSION }} + uses: stCarolas/setup-maven@v5 + with: + maven-version: ${{ env.MAVEN_VERSION }} + + - name: Build and install artifacts (skip tests) + run: | + mvn clean install -DskipTests \ + -pl cds-feature-attachments,storage-targets/cds-feature-attachments-fs,storage-targets/cds-feature-attachments-oss \ + -am + + - name: Mutation Testing + run: mvn org.pitest:pitest-maven:mutationCoverage -f cds-feature-attachments/pom.xml + + - name: Upload Maven local repository artifacts + uses: actions/upload-artifact@v4 + with: + name: maven-repository + path: ~/.m2/repository/com/sap/cds/ + retention-days: 1 + + - name: Upload build targets + uses: actions/upload-artifact@v4 + with: + name: build-targets + path: | + cds-feature-attachments/target/ + storage-targets/cds-feature-attachments-fs/target/ + storage-targets/cds-feature-attachments-oss/target/ + retention-days: 1 + + # Test with Java 17 and 21 + test-java-versions: + name: Test Java ${{ matrix.java-version }} + runs-on: ubuntu-latest + needs: build + strategy: + matrix: + java-version: [ 17, 21 ] + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Java ${{ matrix.java-version }} + uses: actions/setup-java@v4 with: java-version: ${{ matrix.java-version }} + distribution: sapmachine + cache: maven + + - name: Set up Maven ${{ env.MAVEN_VERSION }} + uses: stCarolas/setup-maven@v5 + with: maven-version: ${{ env.MAVEN_VERSION }} - integration-tests: - name: Integration Tests (Java ${{ matrix.java-version }}) + - name: Download Maven repository + uses: actions/download-artifact@v4 + with: + name: maven-repository + path: ~/.m2/repository/com/sap/cds/ + + - name: Run tests + run: mvn test -ntp -B -pl cds-feature-attachments,storage-targets/cds-feature-attachments-fs,storage-targets/cds-feature-attachments-oss + + # Integration tests with current CAP version (Java 17 & 21) + integration-tests-current: + name: Integration Tests - CAP (Java ${{ matrix.java-version }}) runs-on: ubuntu-latest needs: build strategy: @@ -67,42 +150,100 @@ jobs: java-version: [ 17, 21 ] steps: - name: Checkout - uses: actions/checkout@v6 - - name: Integration Tests - uses: ./.github/actions/integration-tests + uses: actions/checkout@v4 + + - name: Set up Java ${{ matrix.java-version }} + uses: actions/setup-java@v4 with: java-version: ${{ matrix.java-version }} + distribution: sapmachine + cache: maven + + - name: Set up Maven ${{ env.MAVEN_VERSION }} + uses: stCarolas/setup-maven@v5 + with: + maven-version: ${{ env.MAVEN_VERSION }} + + - name: Download Maven repository + uses: actions/download-artifact@v4 + with: + name: maven-repository + path: ~/.m2/repository/com/sap/cds/ + + - name: Integration Tests with current CAP Java version + run: mvn verify -ntp -B -P integration-tests-current + + # Integration tests for Object Store Service (Java 17 only) + integration-tests-oss: + name: Integration Tests - OSS (Java 17) + runs-on: ubuntu-latest + needs: build + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Java 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: sapmachine + cache: maven + + - name: Set up Maven ${{ env.MAVEN_VERSION }} + uses: stCarolas/setup-maven@v5 + with: maven-version: ${{ env.MAVEN_VERSION }} + - name: Download Maven repository + uses: actions/download-artifact@v4 + with: + name: maven-repository + path: ~/.m2/repository/com/sap/cds/ + + - name: Integration Tests for Object Store Service + run: mvn verify -ntp -B -P integration-tests-oss + sonarqube-scan: name: SonarQube Scan runs-on: ubuntu-latest - needs: build + needs: [build] steps: - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@v4 + + - name: Download Maven repository + uses: actions/download-artifact@v4 + with: + name: maven-repository + path: ~/.m2/repository/com/sap/cds/ + + - name: Download build targets + uses: actions/download-artifact@v4 + with: + name: build-targets + - name: SonarQube Scan uses: ./.github/actions/scan-with-sonar with: java-version: 17 maven-version: ${{ env.MAVEN_VERSION }} sonarq-token: ${{ env.SONARQ_TOKEN }} - github-token: ${{ env.GITHUB_TOKEN }} + github-token: ${{ secrets.GITHUB_TOKEN }} scan: name: Blackduck Scan runs-on: ubuntu-latest - needs: build + needs: [build] timeout-minutes: 15 steps: - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@v4 - name: Scan uses: ./.github/actions/scan-with-blackduck with: blackduck_token: ${{ env.BLACK_DUCK_TOKEN }} - github_token: ${{ env.GITHUB_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} maven-version: ${{ env.MAVEN_VERSION }} deploy-snapshot: diff --git a/.github/workflows/main-build-and-deploy-oss.yml b/.github/workflows/main-build-and-deploy-oss.yml index b992a9b4f..5b6828247 100644 --- a/.github/workflows/main-build-and-deploy-oss.yml +++ b/.github/workflows/main-build-and-deploy-oss.yml @@ -2,7 +2,7 @@ name: Deploy to Maven Central env: JAVA_VERSION: '17' - MAVEN_VERSION: '3.6.3' + MAVEN_VERSION: '3.9.9' on: release: @@ -15,7 +15,7 @@ jobs: timeout-minutes: 15 steps: - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@v4 - name: Scan With Black Duck uses: ./.github/actions/scan-with-blackduck @@ -29,9 +29,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v6 - with: - token: ${{ secrets.GH_TOKEN }} + uses: actions/checkout@v4 - name: Update version uses: ./.github/actions/newrelease diff --git a/.mvn/maven.config b/.mvn/maven.config new file mode 100644 index 000000000..e9ea0a8a8 --- /dev/null +++ b/.mvn/maven.config @@ -0,0 +1,16 @@ +# Maven configuration for consistent behavior across local and CI environments +# This file is automatically applied to all Maven commands + +# Batch mode: Run in non-interactive mode +-B + +# Suppress transfer progress +-ntp + +# Use UTF-8 encoding +-Dproject.build.sourceEncoding=UTF-8 +-Dproject.reporting.outputEncoding=UTF-8 + +# Enable Spotless formatting checks by default +# Developers can skip with: mvn -Dspotless.check.skip=true ... +-Dspotless.check.skip=false diff --git a/.pipeline/config.yml b/.pipeline/config.yml index 1fed94467..11a74c20a 100644 --- a/.pipeline/config.yml +++ b/.pipeline/config.yml @@ -17,12 +17,14 @@ steps: versioningModel: "major-minor" detectTools: [ 'DETECTOR', 'BINARY_SCAN' ] installArtifacts: true + installArtifactsExcludes: + - samples/** repository: '/cap-java/cds-feature-attachments' verbose: true scanProperties: - --detect.included.detector.types=MAVEN - - --detect.excluded.directories='**/node_modules,**/*test*,**/localrepo,**/target/site,**/*-site.jar' - - --detect.maven.excluded.modules=integration-tests,integration-tests/db,integration-tests/srv + - --detect.excluded.directories='**/node_modules,**/*test*,**/localrepo,**/target/site,**/*-site.jar,**/samples' + - --detect.maven.excluded.modules=integration-tests,integration-tests/db,integration-tests/srv,samples/bookshop,samples/bookshop/srv - --detect.maven.build.command='-pl com.sap.cds:cds-feature-attachments' # https://www.project-piper.io/steps/detectExecuteScan/#dockerimage # If empty, Docker is not used and the command is executed directly on the Jenkins system. diff --git a/README.md b/README.md index 51e1677f1..b8dccea25 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Java Build with Maven](https://github.com/cap-java/cds-feature-attachments/actions/workflows/main-build.yml/badge.svg)](https://github.com/cap-java/cds-feature-attachments/actions/workflows/main-build.yml) [![Deploy new Version with Maven](https://github.com/cap-java/cds-feature-attachments/actions/workflows/main-build.yml/badge.svg?branch=main)](https://github.com/cap-java/cds-feature-attachments/actions/workflows/main-build.yml) [![REUSE status](https://api.reuse.software/badge/github.com/cap-java/cds-feature-attachments)](https://api.reuse.software/info/github.com/cap-java/cds-feature-attachments) +[![CI](https://github.com/cap-java/cds-feature-attachments/actions/workflows/ci.yml/badge.svg)](https://github.com/cap-java/cds-feature-attachments/actions/workflows/ci.yml) [![Deploy to Maven Central](https://github.com/cap-java/cds-feature-attachments/actions/workflows/main-build-and-deploy-oss.yml/badge.svg)](https://github.com/cap-java/cds-feature-attachments/actions/workflows/main-build-and-deploy-oss.yml) [![REUSE status](https://api.reuse.software/badge/github.com/cap-java/cds-feature-attachments)](https://api.reuse.software/info/github.com/cap-java/cds-feature-attachments) # Attachments Plugin for SAP Cloud Application Programming Model (CAP) @@ -12,28 +12,30 @@ It supports the [AWS, Azure, and Google object stores](storage-targets/cds-featu -* [Quick Start](#quick-start) -* [Usage](#usage) - * [MVN Setup](#mvn-setup) - * [Changes in the CDS Models and for the UI](#changes-in-the-cds-models-and-for-the-UI) - * [Try the Bookshop Sample](#try-the-bookshop-sample) - * [Storage Targets](#storage-targets) - * [Malware Scanner](#malware-scanner) - * [Outbox](#outbox) - * [Restore Endpoint](#restore-endpoint) - * [Motivation](#motivation) - * [HTTP Endpoint](#http-endpoint) - * [Security](#security) -* [Releases: Maven Central and Artifactory](#releases-maven-central-and-artifactory) -* [Minimum UI5 and CAP Java Version](#minimum-ui5-and-cap-java-version) -* [Architecture Overview](#architecture-overview) - * [Design](#design) - * [Multitenancy](#multitenancy) - * [Object Stores](#object-stores) - * [Model Texts](#model-texts) -* [Monitoring \& Logging](#monitoring--logging) -* [Support, Feedback, Contributing](#support-feedback-contributing) -* [References \& Links](#references--links) +- [Attachments Plugin for SAP Cloud Application Programming Model (CAP)](#attachments-plugin-for-sap-cloud-application-programming-model-cap) + - [Table of Contents](#table-of-contents) + - [Quick Start](#quick-start) + - [Usage](#usage) + - [MVN Setup](#mvn-setup) + - [Changes in the CDS Models and for the UI](#changes-in-the-cds-models-and-for-the-ui) + - [Try the Bookshop Sample](#try-the-bookshop-sample) + - [Storage Targets](#storage-targets) + - [Malware Scanner](#malware-scanner) + - [Outbox](#outbox) + - [Restore Endpoint](#restore-endpoint) + - [Motivation](#motivation) + - [HTTP Endpoint](#http-endpoint) + - [Security](#security) + - [Releases: Maven Central and Artifactory](#releases-maven-central-and-artifactory) + - [Minimum UI5 and CAP Java Version](#minimum-ui5-and-cap-java-version) + - [Architecture Overview](#architecture-overview) + - [Design](#design) + - [Multitenancy](#multitenancy) + - [Object Stores](#object-stores) + - [Model Texts](#model-texts) + - [Monitoring \& Logging](#monitoring--logging) + - [Support, Feedback, Contributing](#support-feedback-contributing) + - [References \& Links](#references--links) ## Quick Start diff --git a/doc/CONTRIBUTING.md b/doc/CONTRIBUTING.md index 422f0d039..4513aa39f 100644 --- a/doc/CONTRIBUTING.md +++ b/doc/CONTRIBUTING.md @@ -39,6 +39,117 @@ The following rule governs code contributions: the first pull request to this project. This happens in an automated fashion during the submission process. SAP uses [the standard DCO text of the Linux Foundation](https://developercertificate.org/). +## Development Environment Setup + +### Prerequisites + +* **Java**: JDK 17 or 21 (SAPMachine, OpenJDK, or similar) +* **Maven**: 3.9.0 or higher (required for consistent build behavior with CI) +* **Git**: For version control + +### Local Build Configuration + +The project includes a `.mvn/maven.config` file that ensures consistent behavior between local development and CI: +- Batch mode (`-B`) +- Suppressed transfer progress (`-ntp`) +- UTF-8 encoding +- Spotless formatting checks enabled by default + +### Code Formatting + +The project uses [Spotless](https://github.com/diffplug/spotless) with Google Java Format style. + +**Important:** Spotless checks are now enabled by default to ensure code quality. Before committing: + +```bash +# Check formatting +mvn spotless:check + +# Apply formatting +mvn spotless:apply +``` + +To skip formatting checks temporarily during development: +```bash +mvn clean install -Dspotless.check.skip=true +``` + +### Running Tests Locally + +#### Without Cloud Storage Credentials + +If you don't have AWS/Azure/Google Cloud credentials configured, use the `local-testing` profile: + +```bash +mvn clean verify -P local-testing +``` + +This skips cloud storage integration tests and uses filesystem storage targets instead. + +#### With Cloud Storage Credentials + +To run the full test suite including cloud storage integration tests, set these environment variables: + +```bash +# AWS S3 +export AWS_S3_HOST= +export AWS_S3_BUCKET= +export AWS_S3_REGION= +export AWS_S3_ACCESS_KEY_ID= +export AWS_S3_SECRET_ACCESS_KEY= + +# Azure Blob Storage +export AZURE_CONTAINER_URI= +export AZURE_SAS_TOKEN= + +# Google Cloud Storage +export GS_BASE_64_ENCODED_PRIVATE_KEY_DATA= +export GS_BUCKET= +export GS_PROJECT_ID= + +# Then run all tests +mvn clean verify +``` + +#### Running Mutation Testing + +Mutation testing with pitest provides deep test quality analysis but is slower: + +```bash +mvn org.pitest:pitest-maven:mutationCoverage -f cds-feature-attachments/pom.xml +``` + +### Common Build Commands + +```bash +# Build and run unit tests +mvn clean install + +# Run integration tests with current CAP version +mvn clean verify -f ./integration-tests/pom.xml + +# Run integration tests with latest CAP version +mvn clean verify -f ./integration-tests/pom.xml -P latest-test-version + +# Run OSS integration tests +mvn clean verify -P integration-tests-oss + +# Skip tests completely +mvn clean install -DskipTests +``` + +### CI/CD Pipeline + +The project uses an optimized CI pipeline (`.github/workflows/ci.yml`) that: +- Runs quality checks (Spotless) once +- Builds with Java 17 and runs mutation testing +- Tests compiled artifacts against Java 17 & 21 +- Runs integration tests in parallel (current CAP version, latest CAP version, OSS) +- Performs SonarQube and BlackDuck security scans +- Deploys snapshots to Artifactory + +For details, see [Design.md](Design.md#github-actions). + ## Issues and Planning * We use GitHub issues to track bugs and enhancement requests. diff --git a/doc/Design.md b/doc/Design.md index 24d49c46c..1913674f0 100644 --- a/doc/Design.md +++ b/doc/Design.md @@ -3,56 +3,56 @@ ## Table of Contents -* [Links for Design, Processes and Readme](#links-for-design-processes-and-readme) -* [Folder Structure](#folder-structure) -* [GitHub Actions](#github-actions) - * [Build Action](#build-action) - * [Pull Requests Build](#pull-requests-build) - * [Trigger](#trigger) - * [Main Build](#main-build) - * [Trigger](#trigger-1) - * [Build and Deploy](#build-and-deploy) - * [Trigger](#trigger-2) - * [Repository for Deploy](#repository-for-deploy) - * [Update Version](#update-version) - * [Token for Version Update](#token-for-version-update) - * [BlackDuck](#blackduck) - * [Pull Requests](#pull-requests) - * [BlackDuck Links](#blackduck-links) - * [Secrets](#secrets) -* [Feature](#feature) - * [CDS Model](#cds-model) - * [ETag](#etag) - * [Usage of the CDS Model](#usage-of-the-cds-model) - * [Configuration](#configuration) - * [Handler](#handler) - * [Events](#events) - * [Draft Activate and Deep Updates](#draft-activate-and-deep-updates) - * [Content for new Draft](#content-for-new-draft) - * [Delete](#delete) - * [Draft Keys](#draft-keys) - * [Sibling Entity (Draft or Active)](#sibling-entity-draft-or-active) - * [Readonly Fields](#readonly-fields) - * [Optimistic Concurrency Control](#optimistic-concurrency-control) - * [Service](#service) - * [Service Interface](#service-interface) - * [Multi-Tenancy](#multi-tenancy) - * [Default Implementation](#default-implementation) - * [Internal Stored](#internal-stored) - * [Content ID](#content-id) - * [Malware Scan](#malware-scan) - * [Implementation](#implementation) - * [Read Data](#read-data) - * [Scan Content](#scan-content) - * [Store Scan Result](#store-scan-result) - * [Read Attachment calls Malware Scan](#read-attachment-calls-malware-scan) - * [Status](#status) - * [Texts](#texts) -* [Tests](#tests) - * [Unit Tests](#unit-tests) - * [Mutation Tests](#mutation-tests) - * [Integration Tests](#integration-tests) -* [Quality Tools](#quality-tools) +- [Implementation Details](#implementation-details) + - [Table of Contents](#table-of-contents) + - [Links for Design, Processes and Readme](#links-for-design-processes-and-readme) + - [Folder Structure](#folder-structure) + - [GitHub Actions](#github-actions) + - [CI Pipeline](#ci-pipeline) + - [Trigger](#trigger) + - [Build Action](#build-action) + - [Build and Deploy](#build-and-deploy) + - [Trigger](#trigger-1) + - [Repository for Deploy](#repository-for-deploy) + - [Update Version](#update-version) + - [Token for Version Update](#token-for-version-update) + - [BlackDuck](#blackduck) + - [Pull Requests](#pull-requests) + - [BlackDuck Links](#blackduck-links) + - [Secrets](#secrets) + - [Feature](#feature) + - [CDS Model](#cds-model) + - [ETag](#etag) + - [Usage of the CDS Model](#usage-of-the-cds-model) + - [Configuration](#configuration) + - [Handler](#handler) + - [Events](#events) + - [Draft Activate and Deep Updates](#draft-activate-and-deep-updates) + - [Content for new Draft](#content-for-new-draft) + - [Delete](#delete) + - [Draft Keys](#draft-keys) + - [Sibling Entity (Draft or Active)](#sibling-entity-draft-or-active) + - [Readonly Fields](#readonly-fields) + - [Optimistic Concurrency Control](#optimistic-concurrency-control) + - [Service](#service) + - [Service Interface](#service-interface) + - [Multi-Tenancy](#multi-tenancy) + - [Default Implementation](#default-implementation) + - [Internal Stored](#internal-stored) + - [Content ID](#content-id) + - [Malware Scan](#malware-scan) + - [Implementation](#implementation) + - [Read Data](#read-data) + - [Scan Content](#scan-content) + - [Store Scan Result](#store-scan-result) + - [Read Attachment calls Malware Scan](#read-attachment-calls-malware-scan) + - [Status](#status) + - [Texts](#texts) + - [Tests](#tests) + - [Unit Tests](#unit-tests) + - [Mutation Tests](#mutation-tests) + - [Integration Tests](#integration-tests) + - [Quality Tools](#quality-tools) ## Links for Design, Processes and Readme @@ -90,34 +90,37 @@ In folder `.github/workflows` are the GitHub Actions defined. The following tabl | File Name | Description | |----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `pull-requests-build.yaml` | Build the project and run unit tests, integration tests and mutation tests for Java 17 and 21 for new pull requests. Each pull request need to have green runs from this workflow to be able to be merged. | -| `main-build.yaml` | Build the project and run unit tests, integration tests and mutation tests for Java 17 and 21 once commits are merged to the master to get an indicator if everything works with the main branch. | -| `main-build-and-deploy.yaml` | Creates a new version for main, builds the project, run all tests and deploy it to maven or artifactory. See also [Build and Deploy](#build-and-deploy) | -| `main-build-and-deploy-oss.yaml` | Creates a new version for main, builds the project, run all tests and deploy it to Maven Central. See also [Build and Deploy](#build-and-deploy) | +| `ci.yml` | Main CI pipeline that builds the project, runs quality checks, unit tests, integration tests, and mutation testing for Java 17 and 21. Runs on pull requests and pushes to main branch. | +| `main-build-and-deploy-oss.yml` | Creates a new version for main, builds the project, runs all tests and deploys it to Maven Central. See also [Build and Deploy](#build-and-deploy) | +| `codeql.yml` | Security scanning workflow using GitHub CodeQL for vulnerability detection | +| `issue.yml` | Auto-labels new issues for triage | +| `prevent-issue-labeling.yml` | Prevents manual application of the "New" label | -### Build Action +### CI Pipeline -The build step is implemented in action `.github/actions/build/action.yaml` which is used in the workflows: -"Pull Requests Build", "Main Build" and "Build and Deploy". -As the build action does not only run a build of the project, but also the mutations tests this action is used in all -the mentioned workflows. +The `ci.yml` workflow is an optimized CI pipeline that eliminates redundant builds and runs tests efficiently. The workflow consists of these jobs: -### Pull Requests Build +1. **Quality Checks**: Runs Spotless code formatting check once (Java 17) +2. **Build & Mutation Testing**: Builds the project once with Java 17 and runs mutation testing with pitest +3. **Test Java Versions**: Tests the built artifacts against Java 17 and 21 in parallel +4. **Integration Tests**: Runs three parallel integration test suites: + - Java 17 & 21 + - Object Store Service tests (Java 17 only) +5. **SonarQube Scan**: Code quality analysis (runs after unit tests complete) +6. **BlackDuck Scan**: Security scanning (runs after all integration tests) +7. **Deploy Snapshot**: Deploys snapshot versions to Artifactory (on main branch only) -The `pull-requests-build.yaml` starts a workflow to build the project and run all unit and Spring Boot tests for the -coding in the new branch including the changes in the pull request. +The pipeline uses artifact caching to avoid rebuilding dependencies multiple times, significantly reducing build time compared to the previous approach. #### Trigger -This workflow is triggered if a new pull request is created or updated in GitHub. - -### Main Build - -The `main-build.yaml` starts a workflow to build the project and run all unit and Spring Boot tests for the main branch. +This workflow is triggered when: +- A pull request is created or updated +- Code is pushed to the `main` branch -#### Trigger +### Build Action -This workflow is triggered if a new commit is pushed to the main branch. +The build step is implemented in action `.github/actions/build/action.yml` which handles the Maven build using SAP's project-piper-action. It optionally runs mutation testing with pitest. ### Build and Deploy diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index c3df8bc73..541c43360 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -26,7 +26,7 @@ org.springframework.boot spring-boot-dependencies - 3.5.7 + 3.5.8 pom import diff --git a/integration-tests/srv/src/test/java/com/sap/cds/feature/attachments/integrationtests/draftservice/DraftOdataRequestValidationWithTestHandlerTest.java b/integration-tests/srv/src/test/java/com/sap/cds/feature/attachments/integrationtests/draftservice/DraftOdataRequestValidationWithTestHandlerTest.java index 8807bc41d..0195ad932 100644 --- a/integration-tests/srv/src/test/java/com/sap/cds/feature/attachments/integrationtests/draftservice/DraftOdataRequestValidationWithTestHandlerTest.java +++ b/integration-tests/srv/src/test/java/com/sap/cds/feature/attachments/integrationtests/draftservice/DraftOdataRequestValidationWithTestHandlerTest.java @@ -18,11 +18,16 @@ import java.util.concurrent.TimeUnit; import org.awaitility.Awaitility; import org.junit.jupiter.api.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.test.context.ActiveProfiles; @ActiveProfiles(Profiles.TEST_HANDLER_ENABLED) class DraftOdataRequestValidationWithTestHandlerTest extends DraftOdataRequestValidationBase { + private static final Logger logger = + LoggerFactory.getLogger(DraftOdataRequestValidationWithTestHandlerTest.class); + @Test void serviceHandlerIsNotEmpty() { assertThat(serviceHandler).isNotNull(); @@ -171,8 +176,10 @@ protected void verifyTwoCreateAndRevertedDeleteEvents() { private void awaitNumberOfExpectedEvents(int expectedEvents) { Awaitility.await() - .atMost(20, TimeUnit.SECONDS) - .until(() -> serviceHandler.getEventContext().size() == expectedEvents); + .atMost(60, TimeUnit.SECONDS) + .pollDelay(1, TimeUnit.SECONDS) + .pollInterval(2, TimeUnit.SECONDS) + .until(() -> serviceHandler.getEventContext().size() >= expectedEvents); } private void verifyCreateEventFound(List createEvents, String newContent) { diff --git a/pom.xml b/pom.xml index c5b0aa06f..767c5fa15 100644 --- a/pom.xml +++ b/pom.xml @@ -70,15 +70,15 @@ - 3.10.7 + 4.5.1 - 8.9.8 + 9.5.0 - 4.4.0 - 9.3.2 + 4.5.1 + 9.5.0 - true + false @@ -340,7 +340,7 @@ - 3.6.3 + 3.9.0 ${java.version} @@ -387,6 +387,28 @@ + + + local-testing + + false + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + + true + + + + + + + deploy-release diff --git a/samples/bookshop/pom.xml b/samples/bookshop/pom.xml index f18606817..9065ae82c 100644 --- a/samples/bookshop/pom.xml +++ b/samples/bookshop/pom.xml @@ -17,8 +17,8 @@ 17 - 4.4.2 - 3.5.7 + 4.5.1 + 3.5.8 UTF-8