From ff97ce2b205299b532a6e88050f72f3563f2b604 Mon Sep 17 00:00:00 2001 From: Ivan Babiankou Date: Mon, 10 Oct 2022 08:31:57 +0200 Subject: [PATCH] Migrate from Travis CI to GitHub Actions (#237) While there, drop the now-obsolete Takari Maven plugin. --- .github/workflows/build.yaml | 48 ++++++++++++++++++++++++++++++++++++ .mvn/jvm.config | 2 +- .mvn/maven.config | 1 + .travis.yml | 28 --------------------- README.md | 6 ++--- pom.xml | 27 +++++++++----------- 6 files changed, 64 insertions(+), 48 deletions(-) create mode 100644 .github/workflows/build.yaml create mode 100644 .mvn/maven.config delete mode 100644 .travis.yml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..57be739 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,48 @@ +name: Build and verify +on: + pull_request: + push: + branches: [ master ] +permissions: + contents: read +jobs: + build: + runs-on: ubuntu-22.04 + strategy: + matrix: + include: + - jdk: 11.0.16 + sonarEnabled: true + - jdk: 17.0.4 + sonarEnabled: false + steps: + - name: Check out code + uses: actions/checkout@v3.1.0 + with: + # Fetch entire history for SonarCloud analysis. + fetch-depth: 0 + - name: Set up JDK + uses: actions/setup-java@v3.5.1 + with: + java-version: ${{ matrix.jdk }} + distribution: temurin + cache: maven + - name: Cache SonarCloud packages + if: ${{ matrix.sonarEnabled }} + uses: actions/cache@v3.0.10 + with: + path: "${HOME}/.sonar/cache" + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + - name: Display build environment details + run: mvn --version + - 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 + - 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/.mvn/maven.config b/.mvn/maven.config new file mode 100644 index 0000000..d44ca85 --- /dev/null +++ b/.mvn/maven.config @@ -0,0 +1 @@ +--batch-mode --errors --strict-checksums 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 diff --git a/README.md b/README.md index 441b87b..57ea50b 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/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 @@ -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..5470ffd 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,10 @@ -XX:TieredStopAtLevel=1 - - -Xmx512m + + -Xmx1024m -Djava.awt.headless=true - + LOCAL UTF-8 + https://sonarcloud.io + picnic-technologies 1.0.1 2.10.0 9+181-r4173-1 @@ -306,14 +309,6 @@ - - io.takari - maven - 0.7.7 - - ${version.maven} - - org.apache.maven.plugins maven-checkstyle-plugin