From cb611ef6d5e26d039170b2d6aff41cad31d04a03 Mon Sep 17 00:00:00 2001 From: Leonid Rozenblyum Date: Sun, 26 Feb 2023 12:20:42 +0200 Subject: [PATCH 01/17] #387: initial CI using GitHub actions --- .github/workflows/ci.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..69408392 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,22 @@ +name: CI + +on: + push: + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 8 + uses: actions/setup-java@v3 + with: + java-version: '8' + # some arbitrary distribution selected + distribution: 'temurin' + cache: maven + - name: Build with Maven + # -B means: batch-mode (no questions, no progress-related log pollution) + # coverage profile is needed for test coverage for sonar + run: mvn test -Pcoverage -B From b9f038c81c5fc45ec90b2ab6f47c584f29192526 Mon Sep 17 00:00:00 2001 From: Leonid Rozenblyum Date: Sun, 26 Feb 2023 12:23:53 +0200 Subject: [PATCH 02/17] #387: inception of Sonar in GitHub Actions CI --- .idea/encodings.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.idea/encodings.xml b/.idea/encodings.xml index e79da7ec..af673e73 100644 --- a/.idea/encodings.xml +++ b/.idea/encodings.xml @@ -1,6 +1,8 @@ - + + + \ No newline at end of file From 97acafe7514f11554d4ce76859a4d2455be0671c Mon Sep 17 00:00:00 2001 From: Leonid Rozenblyum Date: Sun, 26 Feb 2023 12:23:53 +0200 Subject: [PATCH 03/17] #387: inception of Sonar in GitHub Actions CI --- .idea/encodings.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.idea/encodings.xml b/.idea/encodings.xml index e79da7ec..af673e73 100644 --- a/.idea/encodings.xml +++ b/.idea/encodings.xml @@ -1,6 +1,8 @@ - + + + \ No newline at end of file From c7a6e1f7537ecf60b86bb1080ca7b97e7fb44b38 Mon Sep 17 00:00:00 2001 From: Leonid Rozenblyum Date: Sun, 26 Feb 2023 12:47:27 +0200 Subject: [PATCH 04/17] #387: PoC: Sonar step in the workflow --- .github/workflows/ci.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c3493f0f..d16f7137 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,6 +20,22 @@ jobs: # -B means: batch-mode (no questions, no progress-related log pollution) # coverage profile is needed for test coverage for sonar run: mvn test -Pcoverage -B + sonar: + runs-on: ubuntu-latest + # carries Sonar secret + environment: CI + steps: + - uses: actions/checkout@v3 + with: + # unlimited fetch depth for Sonar + fetch-depth: 0 + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + # some arbitrary distribution selected + distribution: 'temurin' + cache: maven - name: Run Sonar analyzing # Sonar would require extra preparations run: mvn sonar:sonar -Dsonar.projectKey=leokom-chess From 054e9edf5a1f01a375dbfa551df8207232ea5f58 Mon Sep 17 00:00:00 2001 From: Leonid Rozenblyum Date: Sun, 26 Feb 2023 12:53:52 +0200 Subject: [PATCH 05/17] #387: PoC: Sonar step in the workflow --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d16f7137..938f1bde 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,6 +24,9 @@ jobs: runs-on: ubuntu-latest # carries Sonar secret environment: CI + env: + # The SonarScanner for Maven automatically picks up the value directly from the environment variable. + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} steps: - uses: actions/checkout@v3 with: From 971b20f78fbe30d5c8be7d6428b1808e50eb86fc Mon Sep 17 00:00:00 2001 From: Leonid Rozenblyum Date: Sun, 26 Feb 2023 12:55:51 +0200 Subject: [PATCH 06/17] #387: Provide Sonar organization --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 938f1bde..6a5c1f7e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,4 +41,6 @@ jobs: cache: maven - name: Run Sonar analyzing # Sonar would require extra preparations - run: mvn sonar:sonar -Dsonar.projectKey=leokom-chess + run: mvn sonar:sonar \ + -Dsonar.projectKey=leokom-chess \ + -Dsonar.organization=lrozenblyum-github From 83f94916b17a3fea99733db23047ee549000669e Mon Sep 17 00:00:00 2001 From: Leonid Rozenblyum Date: Sun, 26 Feb 2023 12:56:48 +0200 Subject: [PATCH 07/17] #387: Provide Sonar host URL --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6a5c1f7e..a859d201 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,4 +43,5 @@ jobs: # Sonar would require extra preparations run: mvn sonar:sonar \ -Dsonar.projectKey=leokom-chess \ - -Dsonar.organization=lrozenblyum-github + -Dsonar.organization=lrozenblyum-github \ + -Dsonar.host.url=https://sonarcloud.io From adfbd4e2290a3d7b8800da4ba2cf9e59bc0c7431 Mon Sep 17 00:00:00 2001 From: Leonid Rozenblyum Date: Sun, 26 Feb 2023 12:58:06 +0200 Subject: [PATCH 08/17] #387: Fix multiline command --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a859d201..0aa883a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,7 +41,7 @@ jobs: cache: maven - name: Run Sonar analyzing # Sonar would require extra preparations - run: mvn sonar:sonar \ - -Dsonar.projectKey=leokom-chess \ - -Dsonar.organization=lrozenblyum-github \ + run: mvn sonar:sonar + -Dsonar.projectKey=leokom-chess + -Dsonar.organization=lrozenblyum-github -Dsonar.host.url=https://sonarcloud.io From bb13b41a8ab77d5682510fcbef2b6e706efaf610 Mon Sep 17 00:00:00 2001 From: Leonid Rozenblyum Date: Sun, 26 Feb 2023 13:04:47 +0200 Subject: [PATCH 09/17] #387: Unite build and Sonar. Sonar depends on build and coverage results --- .github/workflows/ci.yml | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0aa883a5..bcb2745d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,10 +5,19 @@ on: pull_request: jobs: - build: + CI_Sonar: + # carries Sonar secret + environment: CI + env: + # The SonarScanner for Maven automatically picks up the value directly from the environment variable. + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + # unlimited fetch depth for Sonar + fetch-depth: 0 - name: Set up JDK 8 uses: actions/setup-java@v3 with: @@ -20,18 +29,6 @@ jobs: # -B means: batch-mode (no questions, no progress-related log pollution) # coverage profile is needed for test coverage for sonar run: mvn test -Pcoverage -B - sonar: - runs-on: ubuntu-latest - # carries Sonar secret - environment: CI - env: - # The SonarScanner for Maven automatically picks up the value directly from the environment variable. - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - steps: - - uses: actions/checkout@v3 - with: - # unlimited fetch depth for Sonar - fetch-depth: 0 - name: Set up JDK 11 uses: actions/setup-java@v3 with: From 1aa7aaf719d974bb840a1e7f949518a201316256 Mon Sep 17 00:00:00 2001 From: Leonid Rozenblyum Date: Sun, 26 Feb 2023 13:21:49 +0200 Subject: [PATCH 10/17] #387: attempt to provide more info for Sonar PR --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bcb2745d..43cf8405 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,8 @@ jobs: env: # The SonarScanner for Maven automatically picks up the value directly from the environment variable. SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - + # According to Sonar: Needed to get PR information, if any + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 From 37afd4c5c6198076aa752573c14621fa7b8f0a2b Mon Sep 17 00:00:00 2001 From: Leonid Rozenblyum Date: Sun, 26 Feb 2023 13:41:22 +0200 Subject: [PATCH 11/17] #387: invoke actions on push to master/release --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 43cf8405..8e8f18c6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,6 +2,9 @@ name: CI on: push: + branches: + master + release/** pull_request: jobs: From 8ed71ec09906e9d299da3eff3830e161a4043858 Mon Sep 17 00:00:00 2001 From: Leonid Rozenblyum Date: Sun, 26 Feb 2023 13:43:59 +0200 Subject: [PATCH 12/17] #387: added badge for GitHub actions --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c6a83475..8986bc60 100644 --- a/README.md +++ b/README.md @@ -70,10 +70,8 @@ The release consists of: * binaries in *.zip ## Continuous Integration -### Travis CI -Builds: https://travis-ci.com/lrozenblyum/chess/builds - -[![Build Status](https://travis-ci.com/lrozenblyum/chess.svg?branch=master)](https://travis-ci.com/lrozenblyum/chess) +### GitHub Actions +[![CI](https://github.com/lrozenblyum/chess/actions/workflows/ci.yml/badge.svg)](https://github.com/lrozenblyum/chess/actions/workflows/ci.yml) ### SonarCloud Full overview: https://sonarcloud.io/dashboard?id=leokom-chess From bba529952c277f8d608565a678091bd20b304c2c Mon Sep 17 00:00:00 2001 From: Leonid Rozenblyum Date: Sun, 26 Feb 2023 14:27:17 +0200 Subject: [PATCH 13/17] Revert "#387: inception of Sonar in GitHub Actions CI" This reverts commit b9f038c81c5fc45ec90b2ab6f47c584f29192526. --- .idea/encodings.xml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.idea/encodings.xml b/.idea/encodings.xml index af673e73..e79da7ec 100644 --- a/.idea/encodings.xml +++ b/.idea/encodings.xml @@ -1,8 +1,6 @@ - + - - \ No newline at end of file From 4e49b4da7e3993c376d8059839591697f3126263 Mon Sep 17 00:00:00 2001 From: Leonid Rozenblyum Date: Sun, 26 Feb 2023 14:28:31 +0200 Subject: [PATCH 14/17] #387: migrated comment from Travis --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8e8f18c6..78424789 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,7 +41,9 @@ jobs: distribution: 'temurin' cache: maven - name: Run Sonar analyzing - # Sonar would require extra preparations + # specified the project key explicitly because I didn't like the automatically generate Maven-based name (com.leokom:chess) + # thanks to this explicit specification we're free to change Maven coordinates + # the organization key was found here: https://sonarcloud.io/account/organizations run: mvn sonar:sonar -Dsonar.projectKey=leokom-chess -Dsonar.organization=lrozenblyum-github From d5fee7160cbf9d7c4d99f010bf970a9e1702802f Mon Sep 17 00:00:00 2001 From: Leonid Rozenblyum Date: Sun, 26 Feb 2023 14:29:58 +0200 Subject: [PATCH 15/17] #387: dropped Travis CI build. --- .travis.yml | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 46287433..00000000 --- a/.travis.yml +++ /dev/null @@ -1,31 +0,0 @@ -language: java - -jdk: - - openjdk8 - -dist: xenial - -addons: - sonarcloud: - # the organization key was found here: https://sonarcloud.io/account/organizations - organization: "lrozenblyum-github" - -script: - # fixes SonarCloud warning: - # 'Shallow clone detected during the analysis. Some files will miss SCM information. - # This will affect features like auto-assignment of issues. Please configure your build to disable shallow clone.' - - git fetch --unshallow --quiet - # by default travis 'install' phase will execute - # mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V - # travis 'script' phase is by default: mvn test -B - # -B means: batch-mode (no questions, no progress-related logs pollution) - # coverage profile is needed for test coverage for sonar - - mvn test -Pcoverage -B - # manually switching from OpenJDK11. Travis CI doc points us to use install-jdk.sh which fails - # xenial distributive at the moment already has OpenJDK8 + OpenJDK11 installed. Just env. vars changes seem to be needed. - - export JAVA_HOME=/usr/local/lib/jvm/openjdk11 - - export PATH=${JAVA_HOME}/bin:$PATH - - java -version - # specified the project key explicitly because I didn't like the automatically generate Maven-based name (com.leokom:chess) - # thanks to this explicit specification we're free to change Maven coordinates - - mvn sonar:sonar -Dsonar.projectKey=leokom-chess From 7c5950dd8e8a413b9ef08e0b82b9bdf078be3920 Mon Sep 17 00:00:00 2001 From: lrozenblyum Date: Sun, 26 Feb 2023 14:41:02 +0200 Subject: [PATCH 16/17] #387: Updated Javadoc mentioning Travis --- .../java/com/leokom/games/chess/SimulatorMultiRunnerIT.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/leokom/games/chess/SimulatorMultiRunnerIT.java b/src/test/java/com/leokom/games/chess/SimulatorMultiRunnerIT.java index ebbe335f..fdbd9314 100644 --- a/src/test/java/com/leokom/games/chess/SimulatorMultiRunnerIT.java +++ b/src/test/java/com/leokom/games/chess/SimulatorMultiRunnerIT.java @@ -18,7 +18,7 @@ /** * Author: Leonid - * Trying to avoid Travis limitation on test duration < 10 minutes: + * Historical reasons of the collector usage: trying to avoid Travis limitation on test duration < 10 minutes: * run every game in a separate test, collect all results and analyze * Date-time: 24.04.16 22:54 */ From b2912aaf3d6a950092600bb09bca4af175685d27 Mon Sep 17 00:00:00 2001 From: lrozenblyum Date: Sun, 26 Feb 2023 14:42:45 +0200 Subject: [PATCH 17/17] #387: updated comment --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 16c3d815..23bbfda5 100644 --- a/pom.xml +++ b/pom.xml @@ -323,7 +323,7 @@ report - + test report @@ -352,4 +352,4 @@ LeokomChess ${brandName}-${project.version} - \ No newline at end of file +