From ab22c7377d39df735715b64f09f21f6c9161c6c0 Mon Sep 17 00:00:00 2001 From: Lukasz Lenart Date: Tue, 20 Sep 2022 15:48:21 +0200 Subject: [PATCH 1/8] WW-5232 Introduces GH Actions build instead of using Travis --- .github/workflows/maven.yml | 53 ++++++++++++++++++++++++++++++++++ .travis.yml | 29 ------------------- pom.xml | 57 +++++++++---------------------------- 3 files changed, 66 insertions(+), 73 deletions(-) create mode 100644 .github/workflows/maven.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml new file mode 100644 index 000000000..9e40783c7 --- /dev/null +++ b/.github/workflows/maven.yml @@ -0,0 +1,53 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Java Build + +on: + pull_request: + push: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + java: [ '8', '11', '17' ] + steps: + - name: Checkout code + uses: actions/checkout@v3.0.2 + - name: Set up cache + uses: actions/cache@v3.0.8 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - name: Set up JDK ${{ matrix.java }} + uses: actions/setup-java@v3 + with: + distribution: adopt + java-version: ${{ matrix.java }} + - name: Build with Maven on Java ${{ matrix.java }} + if: matrix.java != '11' + run: mvn -B -V -DskipAssembly test --no-transfer-progress + - name: Code coverage on Java ${{ matrix.java }} + if: matrix.java == '11' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }} + run: mvn -B -V -Pcoverage verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar --no-transfer-progress diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e86980e60..000000000 --- a/.travis.yml +++ /dev/null @@ -1,29 +0,0 @@ -dist: jammy -language: java -sudo: false - -jdk: - - openjdk11 - - openjdk17 - -install: true - -env: -global: - - secure: iI7IpfDtS+LUyS2yNuRCR3KelNyvBHuoMQ3gb1UNmR5SSL7jO/p3olQWrQROs28FJ+dpE3lHyIjoHrebKQGJHHAgTG2XWxn+G3fDsf+wSSFSLoDGj0o2SgGXooBbR2dccnNZHCyQaOyE2cIPWaOxrQZFE4No70LQB4mrP/gdkoc= -matrix: - include: - - jdk: openjdk8 - env: STRUTS_IT=true # do integration tests and coverage reports when jdk 11 and 17 tests prospered - -script: - - if [ "$STRUTS_IT" == "true" ]; then - ./mvnw clean install -DskipTests -DskipAssembly -B; - ./mvnw test org.jacoco:jacoco-maven-plugin:report org.jacoco:jacoco-maven-plugin:report-integration org.eluder.coveralls:coveralls-maven-plugin:report -Ptravis-coveralls -DskipAssembly -B; - else - ./mvnw clean package test -DskipAssembly -B; - fi; - -cache: - directories: - - $HOME/.m2 diff --git a/pom.xml b/pom.xml index 50d7ce699..da4ee7a64 100644 --- a/pom.xml +++ b/pom.xml @@ -182,17 +182,6 @@ - - jdk9 - - [9,) - - - - - true - - jdk17 @@ -218,33 +207,13 @@ - travis-coveralls + coverage + + https://sonarcloud.io + apache + apache_struts + - - - - org.apache.maven.plugins - maven-surefire-plugin - - ${argLine} - - - - org.apache.maven.plugins - maven-failsafe-plugin - - ${argLine} - - - - org.eclipse.jetty - jetty-maven-plugin - - ${argLine} - - - - org.jacoco @@ -258,18 +227,18 @@ - prepare-agent-integration + report - prepare-agent-integration + report + + + XML + + - - io.jsonwebtoken.coveralls - coveralls-maven-plugin - 4.4.1 - From 6b2cc20b2dc8957c670305f67bffad37963b3cbd Mon Sep 17 00:00:00 2001 From: Lukasz Lenart Date: Tue, 20 Sep 2022 16:08:32 +0200 Subject: [PATCH 2/8] WW-5232 Defines default ENV settings --- .github/workflows/maven.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 9e40783c7..2f8ae774e 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -21,6 +21,10 @@ on: branches: - master +env: + MAVEN_OPTS: -Xmx2048m -Xms1024m + LANG: en_US.utf8 + jobs: build: runs-on: ubuntu-latest From 36ac23acf58eb6cf43f04b3a817d87e8d8c9c33c Mon Sep 17 00:00:00 2001 From: Lukasz Lenart Date: Tue, 20 Sep 2022 16:18:17 +0200 Subject: [PATCH 3/8] WW-5232 Uses Sonar Coverage badge instead of Travis on --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 136a290dd..e416a56dd 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ The Apache Struts web framework [![Build Status @ Travis](https://travis-ci.com/apache/struts.svg?branch=master)](https://app.travis-ci.com/apache/struts) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.apache.struts/struts2-core/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.apache.struts/struts2-core/) [![Javadocs](https://javadoc.io/badge/org.apache.struts/struts2-core.svg)](https://javadoc.io/doc/org.apache.struts/struts2-core) -[![Coverage Status](https://coveralls.io/repos/github/apache/struts/badge.svg)](https://coveralls.io/github/apache/struts) +[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=apache_struts&metric=coverage)](https://sonarcloud.io/summary/new_code?id=apache_struts) [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/apache/struts/badge)](https://deps.dev/maven/org.apache.struts%3Astruts2-core) [![License](http://img.shields.io/:license-apache-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0.html) From dc1a663d69e2c2d84b32b5d8ce5fd514603ffb12 Mon Sep 17 00:00:00 2001 From: Lukasz Lenart Date: Tue, 20 Sep 2022 16:22:59 +0200 Subject: [PATCH 4/8] WW-5232 Uses default SONAR_TOKEN name --- .github/workflows/maven.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 2f8ae774e..06601e4da 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -53,5 +53,5 @@ jobs: if: matrix.java == '11' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: mvn -B -V -Pcoverage verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar --no-transfer-progress From 0fc71949ca3ee316174235dc7864f1d672051124 Mon Sep 17 00:00:00 2001 From: Lukasz Lenart Date: Wed, 21 Sep 2022 15:44:47 +0200 Subject: [PATCH 5/8] WW-5232 Uses Apache specific SONARCLOUD_TOKEN secret --- .github/workflows/maven.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 06601e4da..2f8ae774e 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -53,5 +53,5 @@ jobs: if: matrix.java == '11' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }} run: mvn -B -V -Pcoverage verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar --no-transfer-progress From 9fb86054bbebcc1fc40b0a652ee9857ac489c53d Mon Sep 17 00:00:00 2001 From: Lukasz Lenart Date: Wed, 21 Sep 2022 17:17:07 +0200 Subject: [PATCH 6/8] Reverts back to SONAR_TOKEN --- .github/workflows/maven.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 2f8ae774e..06601e4da 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -53,5 +53,5 @@ jobs: if: matrix.java == '11' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: mvn -B -V -Pcoverage verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar --no-transfer-progress From 296b3cc89c9b9be5bc67de0ba6b5db78f60cbe5d Mon Sep 17 00:00:00 2001 From: Lukasz Lenart Date: Wed, 21 Sep 2022 17:27:20 +0200 Subject: [PATCH 7/8] Uses SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }} --- .github/workflows/maven.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 06601e4da..2f8ae774e 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -53,5 +53,5 @@ jobs: if: matrix.java == '11' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }} run: mvn -B -V -Pcoverage verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar --no-transfer-progress From eb6836828088fb06ff927465a0fa4e1d05e8b07b Mon Sep 17 00:00:00 2001 From: Lukasz Lenart Date: Wed, 21 Sep 2022 22:29:14 +0200 Subject: [PATCH 8/8] WW-5232 Avoids building assemblies --- .github/workflows/maven.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 2f8ae774e..9a0d796aa 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -54,4 +54,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }} - run: mvn -B -V -Pcoverage verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar --no-transfer-progress + run: mvn -B -V -Pcoverage -DskipAssembly verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar --no-transfer-progress