From f8b7f8f282c18f229f9417fc510f59b978ad39f4 Mon Sep 17 00:00:00 2001 From: Rick Ossendrijver Date: Mon, 26 Sep 2022 14:23:56 +0200 Subject: [PATCH 01/13] Migrate Travis CI to GitHub Actions --- .github/workflows/build.yaml | 29 +++++++++++++++++++++++++++++ .mvn/maven.config | 1 + README.md | 6 +++--- pom.xml | 20 ++++++-------------- 4 files changed, 39 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/build.yaml create mode 100644 .mvn/maven.config diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..b473172 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,29 @@ +name: Build and verify +on: + pull_request: + push: + branches: + - 'master' +jobs: + build: + runs-on: ubuntu-22.04 + strategy: + matrix: + jdk: [ 11.0.16, 17.0.4 ] + steps: + - name: Check out code + uses: actions/checkout@v3.0.2 + - name: Set up JDK + uses: actions/setup-java@v3.4.1 + with: + java-version: ${{ matrix.jdk }} + distribution: temurin + cache: maven + - name: Display build environment details + run: mvn --version + - name: Build project and perform SonarQube analysis + run: mvn -T1C install sonar:sonar + - name: Remove installed project artifacts + run: mvn build-helper:remove-project-artifact + +# XXX: Enable SonarCloud. \ No newline at end of file diff --git a/.mvn/maven.config b/.mvn/maven.config new file mode 100644 index 0000000..87f93e7 --- /dev/null +++ b/.mvn/maven.config @@ -0,0 +1 @@ +--batch-mode --errors --strict-checksums \ No newline at end of file diff --git a/README.md b/README.md index 441b87b..c29ba28 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Picnic OSS Maven Parent -[![Build Status][travisci-badge]][travisci-builds] +[![GitHub Actions][github-actions-build-badge]][github-actions-build-master] [![Maven Central][maven-central-badge]][maven-central-browse] [![SonarCloud Quality Gate][sonarcloud-badge-quality-gate]][sonarcloud-dashboard] [![SonarCloud Bugs][sonarcloud-badge-bugs]][sonarcloud-measure-reliability] @@ -34,6 +34,8 @@ When submitting changes, please make every effort to follow existing conventions and style in order to keep the configuration as readable as possible. +[github-actions-build-badge]: https://github.com/PicnicSupermarket/error-prone-support/actions/workflows/build.yaml/badge.svg +[github-actions-build-master]: https://github.com/PicnicSupermarket/error-prone-support/actions/workflows/build.yaml?query=branch%3Amaster [maven-central-badge]: https://img.shields.io/maven-central/v/tech.picnic/oss-parent.svg [maven-central-browse]: https://repo1.maven.org/maven2/tech/picnic/oss-parent/ [maven-central-search]: https://search.maven.org @@ -47,5 +49,3 @@ possible. [sonarcloud-measure-reliability]: https://sonarcloud.io/component_measures?id=tech.picnic%3Aoss-parent&metric=Reliability [sonarcloud-measure-security]: https://sonarcloud.io/component_measures?id=tech.picnic%3Aoss-parent&metric=Security [sonarcloud-measure-maintainability]: https://sonarcloud.io/component_measures?id=tech.picnic%3Aoss-parent&metric=Maintainability -[travisci-badge]: https://travis-ci.org/PicnicSupermarket/oss-parent.svg?branch=master -[travisci-builds]: https://travis-ci.org/PicnicSupermarket/oss-parent diff --git a/pom.xml b/pom.xml index cdd55de..bf6c9b8 100644 --- a/pom.xml +++ b/pom.xml @@ -42,8 +42,8 @@ https://github.com/PicnicSupermarket/oss-parent/issues - Travis CI - https://travis-ci.com/PicnicSupermarket/oss-parent + GitHub Actions + https://github.com/PicnicSupermarket/oss-parent/actions @@ -66,9 +66,9 @@ -XX:TieredStopAtLevel=1 - - -Xmx512m + + -Xmx1024m -Djava.awt.headless=true - LOCAL @@ -306,14 +306,6 @@ - - io.takari - maven - 0.7.7 - - ${version.maven} - - org.apache.maven.plugins maven-checkstyle-plugin From 116ac7db61483c088898ab396117e8170abfd16a Mon Sep 17 00:00:00 2001 From: Ivan Babiankou Date: Wed, 28 Sep 2022 11:45:23 +0200 Subject: [PATCH 02/13] Configure sonar --- .github/workflows/build.yaml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b473172..28b53e9 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -4,6 +4,7 @@ on: push: branches: - 'master' + - 'rossendrijver/PSM-1584' jobs: build: runs-on: ubuntu-22.04 @@ -22,8 +23,12 @@ jobs: - name: Display build environment details run: mvn --version - name: Build project and perform SonarQube analysis - run: mvn -T1C install sonar:sonar + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: mvn -T1C install sonar:sonar \ + -Dsonar.host.url=https://sonarcloud.io \ + -Dsonar.organization=picnic-technologies \ + -Dsonar.projectKey=tech.picnic:oss-parent - name: Remove installed project artifacts run: mvn build-helper:remove-project-artifact - -# XXX: Enable SonarCloud. \ No newline at end of file From 1be52f3b4915c7c1fe65910746d527a8cdf43f85 Mon Sep 17 00:00:00 2001 From: Ivan Babiankou Date: Wed, 28 Sep 2022 11:50:21 +0200 Subject: [PATCH 03/13] Fix multiline command --- .github/workflows/build.yaml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 28b53e9..6d8c590 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -26,9 +26,10 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: mvn -T1C install sonar:sonar \ - -Dsonar.host.url=https://sonarcloud.io \ - -Dsonar.organization=picnic-technologies \ - -Dsonar.projectKey=tech.picnic:oss-parent + run: >- + mvn -T1C install sonar:sonar + -Dsonar.host.url=https://sonarcloud.io + -Dsonar.organization=picnic-technologies + -Dsonar.projectKey=tech.picnic:oss-parent - name: Remove installed project artifacts run: mvn build-helper:remove-project-artifact From 568a71fe04c561758d41a5bb422bd10919a4569b Mon Sep 17 00:00:00 2001 From: Ivan Babiankou Date: Wed, 28 Sep 2022 11:57:59 +0200 Subject: [PATCH 04/13] Remove extra indent --- .github/workflows/build.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 6d8c590..425fbca 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -28,8 +28,8 @@ jobs: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: >- mvn -T1C install sonar:sonar - -Dsonar.host.url=https://sonarcloud.io - -Dsonar.organization=picnic-technologies - -Dsonar.projectKey=tech.picnic:oss-parent + -Dsonar.host.url=https://sonarcloud.io + -Dsonar.organization=picnic-technologies + -Dsonar.projectKey=tech.picnic:oss-parent - name: Remove installed project artifacts run: mvn build-helper:remove-project-artifact From 84645f0f813000f74d998ab1a213f5efd9a45fde Mon Sep 17 00:00:00 2001 From: Ivan Babiankou Date: Wed, 28 Sep 2022 13:27:42 +0200 Subject: [PATCH 05/13] Delete Travis config; Execute analysis on JDK 11 only --- .github/workflows/build.yaml | 18 +++++++++++++----- .travis.yml | 28 ---------------------------- 2 files changed, 13 insertions(+), 33 deletions(-) delete mode 100644 .travis.yml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 425fbca..26e14ac 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -10,24 +10,32 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - jdk: [ 11.0.16, 17.0.4 ] + include: + - jdk: 11.0.16 + sonarEnabled: true + - jdk: 17.0.4 + sonarEnabled: false steps: - name: Check out code uses: actions/checkout@v3.0.2 + with: + # Fetch entire history for SonarCloud analysis. + fetch-depth: 0 - name: Set up JDK uses: actions/setup-java@v3.4.1 with: java-version: ${{ matrix.jdk }} distribution: temurin cache: maven - - name: Display build environment details - run: mvn --version - - name: Build project and perform SonarQube analysis + - name: Display environment details and build the project + run: mvn --show-version -T1C install + - name: Perform SonarCloud analysis + if: ${{ matrix.sonarEnabled }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: >- - mvn -T1C install sonar:sonar + mvn sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=picnic-technologies -Dsonar.projectKey=tech.picnic:oss-parent diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d2ad944..0000000 --- a/.travis.yml +++ /dev/null @@ -1,28 +0,0 @@ -language: java -matrix: - include: - - jdk: openjdk11 - # This is the primary target platform. In this build perform a SonarQube - # analysis. - script: ./mvnw install sonar:sonar - - jdk: openjdk17 - script: ./mvnw install -addons: - sonarcloud: - organization: picnic-technologies - token: "${SONARCLOUD_TOKEN}" -install: mvn io.takari:maven:wrapper -before_cache: - # Don't cache the artifacts we just generated, for multiple reasons: (1) we - # shouldn't need them next time around and (2) if we do, that indicates a - # dependency issue which might otherwise go unnoticed until next time we bump - # the project's version (i.e., when tagging). - - find "${HOME}/.m2/repository" -depth -name '*-SNAPSHOT' -exec rm -r '{}' \; -cache: - directories: - # The local Maven repository in which third party dependencies are stored. - - ${HOME}/.m2/repository - # The Takari Maven Wrapper's storage for downloaded Maven distributions. - - ${HOME}/.m2/wrapper - # The SonarQube analysis cache. - - ${HOME}/.sonar/cache From a3758f69199bfe9ed80e129c5c5682303cb2b41d Mon Sep 17 00:00:00 2001 From: Ivan Babiankou Date: Wed, 28 Sep 2022 13:30:50 +0200 Subject: [PATCH 06/13] Drop extra branch --- .github/workflows/build.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 26e14ac..eca67bc 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -4,7 +4,6 @@ on: push: branches: - 'master' - - 'rossendrijver/PSM-1584' jobs: build: runs-on: ubuntu-22.04 From fdbe8065f6aa616e7266e6d9c4e9c7717b600b93 Mon Sep 17 00:00:00 2001 From: Ivan Babiankou Date: Wed, 28 Sep 2022 13:34:44 +0200 Subject: [PATCH 07/13] Add new line; restrict pull_request types --- .github/workflows/build.yaml | 4 ++-- .mvn/maven.config | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index eca67bc..6a230a3 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,9 +1,9 @@ name: Build and verify on: pull_request: + types: [opened, synchronize, reopened] push: - branches: - - 'master' + branches: [master] jobs: build: runs-on: ubuntu-22.04 diff --git a/.mvn/maven.config b/.mvn/maven.config index 87f93e7..d44ca85 100644 --- a/.mvn/maven.config +++ b/.mvn/maven.config @@ -1 +1 @@ ---batch-mode --errors --strict-checksums \ No newline at end of file +--batch-mode --errors --strict-checksums From 814959175e91aef20460d652cfaa52a1611beb2c Mon Sep 17 00:00:00 2001 From: Ivan Babiankou Date: Wed, 28 Sep 2022 13:41:56 +0200 Subject: [PATCH 08/13] Cache SonarCloud packages --- .github/workflows/build.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 6a230a3..1413994 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -26,6 +26,12 @@ jobs: java-version: ${{ matrix.jdk }} distribution: temurin cache: maven + - name: Cache SonarCloud packages + uses: actions/cache@v3.0.8 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar - name: Display environment details and build the project run: mvn --show-version -T1C install - name: Perform SonarCloud analysis From b0f96d0e5fcf4fcdac8f49138500a51c19e6bfc0 Mon Sep 17 00:00:00 2001 From: Ivan Babiankou Date: Wed, 28 Sep 2022 13:53:50 +0200 Subject: [PATCH 09/13] Conditionally cache SonarCloud packages --- .github/workflows/build.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 1413994..54aae3d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -27,6 +27,7 @@ jobs: distribution: temurin cache: maven - name: Cache SonarCloud packages + if: ${{ matrix.sonarEnabled }} uses: actions/cache@v3.0.8 with: path: ~/.sonar/cache From 27701520573ec6ae9517a564e1b361bd952fdb9f Mon Sep 17 00:00:00 2001 From: Rick Ossendrijver Date: Wed, 28 Sep 2022 20:58:27 +0200 Subject: [PATCH 10/13] Suggestions --- .github/workflows/build.yaml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 54aae3d..5856a69 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -3,7 +3,7 @@ on: pull_request: types: [opened, synchronize, reopened] push: - branches: [master] + branches: [$default-branch] jobs: build: runs-on: ubuntu-22.04 @@ -21,7 +21,7 @@ jobs: # Fetch entire history for SonarCloud analysis. fetch-depth: 0 - name: Set up JDK - uses: actions/setup-java@v3.4.1 + uses: actions/setup-java@v3.5.1 with: java-version: ${{ matrix.jdk }} distribution: temurin @@ -33,8 +33,10 @@ jobs: path: ~/.sonar/cache key: ${{ runner.os }}-sonar restore-keys: ${{ runner.os }}-sonar - - name: Display environment details and build the project - run: mvn --show-version -T1C install + - name: Display build environment details + run: mvn --version + - name: Build the project + run: mvn -T1C install - name: Perform SonarCloud analysis if: ${{ matrix.sonarEnabled }} env: From 39effd9f93c0e04b44244c8eec9a01beedbb9de0 Mon Sep 17 00:00:00 2001 From: Ivan Babiankou Date: Thu, 29 Sep 2022 13:22:02 +0200 Subject: [PATCH 11/13] Reduce GitHub Actions build workflow permissions --- .github/workflows/build.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 5856a69..1fd9b2b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -4,6 +4,8 @@ on: types: [opened, synchronize, reopened] push: branches: [$default-branch] +permissions: + contents: read jobs: build: runs-on: ubuntu-22.04 From e6ba577045ead32b675cc9bfe2a9a4083d45d27a Mon Sep 17 00:00:00 2001 From: Stephan Schroevers Date: Thu, 6 Oct 2022 08:57:30 +0200 Subject: [PATCH 12/13] Suggestions --- .github/workflows/build.yaml | 16 ++++++---------- .mvn/jvm.config | 2 +- README.md | 4 ++-- pom.xml | 13 ++++++++----- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 1fd9b2b..0b24f20 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -3,7 +3,7 @@ on: pull_request: types: [opened, synchronize, reopened] push: - branches: [$default-branch] + branches: [ master ] permissions: contents: read jobs: @@ -18,7 +18,7 @@ jobs: sonarEnabled: false steps: - name: Check out code - uses: actions/checkout@v3.0.2 + uses: actions/checkout@v3.1.0 with: # Fetch entire history for SonarCloud analysis. fetch-depth: 0 @@ -30,24 +30,20 @@ jobs: cache: maven - name: Cache SonarCloud packages if: ${{ matrix.sonarEnabled }} - uses: actions/cache@v3.0.8 + uses: actions/cache@v3.0.10 with: - path: ~/.sonar/cache + path: "${HOME}/.sonar/cache" key: ${{ runner.os }}-sonar restore-keys: ${{ runner.os }}-sonar - name: Display build environment details run: mvn --version - - name: Build the project + - name: Build project run: mvn -T1C install - name: Perform SonarCloud analysis if: ${{ matrix.sonarEnabled }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: >- - mvn sonar:sonar - -Dsonar.host.url=https://sonarcloud.io - -Dsonar.organization=picnic-technologies - -Dsonar.projectKey=tech.picnic:oss-parent + run: mvn sonar:sonar - name: Remove installed project artifacts run: mvn build-helper:remove-project-artifact diff --git a/.mvn/jvm.config b/.mvn/jvm.config index 504456f..2031314 100644 --- a/.mvn/jvm.config +++ b/.mvn/jvm.config @@ -1,4 +1,5 @@ --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED +--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED @@ -6,5 +7,4 @@ --add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED ---add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED diff --git a/README.md b/README.md index c29ba28..57ea50b 100644 --- a/README.md +++ b/README.md @@ -34,8 +34,8 @@ When submitting changes, please make every effort to follow existing conventions and style in order to keep the configuration as readable as possible. -[github-actions-build-badge]: https://github.com/PicnicSupermarket/error-prone-support/actions/workflows/build.yaml/badge.svg -[github-actions-build-master]: https://github.com/PicnicSupermarket/error-prone-support/actions/workflows/build.yaml?query=branch%3Amaster +[github-actions-build-badge]: https://github.com/PicnicSupermarket/oss-parent/actions/workflows/build.yaml/badge.svg +[github-actions-build-master]: https://github.com/PicnicSupermarket/oss-parent/actions/workflows/build.yaml?query=branch%3Amaster [maven-central-badge]: https://img.shields.io/maven-central/v/tech.picnic/oss-parent.svg [maven-central-browse]: https://repo1.maven.org/maven2/tech/picnic/oss-parent/ [maven-central-search]: https://search.maven.org diff --git a/pom.xml b/pom.xml index bf6c9b8..5470ffd 100644 --- a/pom.xml +++ b/pom.xml @@ -66,8 +66,9 @@ -XX:TieredStopAtLevel=1 - + -Xmx1024m -Djava.awt.headless=true - + LOCAL UTF-8 + https://sonarcloud.io + picnic-technologies 1.0.1 2.10.0 9+181-r4173-1 From bba712194d7b85fef93641e875dbc80b36d22387 Mon Sep 17 00:00:00 2001 From: Stephan Schroevers Date: Fri, 7 Oct 2022 13:18:49 +0200 Subject: [PATCH 13/13] Tweak --- .github/workflows/build.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 0b24f20..57be739 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,7 +1,6 @@ name: Build and verify on: pull_request: - types: [opened, synchronize, reopened] push: branches: [ master ] permissions: