From b673fcf522e33a72c0bf1d390e84139d1349e29c Mon Sep 17 00:00:00 2001 From: Mauricio Astudillo Toledo Date: Wed, 19 Jun 2024 16:27:21 -0400 Subject: [PATCH 1/9] chore: rename .travis folder to scripts --- {.travis => scripts}/deploy.sh | 0 {.travis => scripts}/settings.xml | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename {.travis => scripts}/deploy.sh (100%) rename {.travis => scripts}/settings.xml (100%) diff --git a/.travis/deploy.sh b/scripts/deploy.sh similarity index 100% rename from .travis/deploy.sh rename to scripts/deploy.sh diff --git a/.travis/settings.xml b/scripts/settings.xml similarity index 100% rename from .travis/settings.xml rename to scripts/settings.xml From b4278247aab588371ea15a098484f185390b74d4 Mon Sep 17 00:00:00 2001 From: Mauricio Astudillo Toledo Date: Wed, 19 Jun 2024 17:54:01 -0400 Subject: [PATCH 2/9] chore: remove sonar-project.properties file --- sonar-project.properties | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 sonar-project.properties diff --git a/sonar-project.properties b/sonar-project.properties deleted file mode 100644 index 5e3089a..0000000 --- a/sonar-project.properties +++ /dev/null @@ -1,7 +0,0 @@ -sonar.host.url=http://localhost:9000 -sonar.projectKey=POS-Integrado-Java-SDK -sonar.sources=src/main/java -sonar.java.binaries=target/classes - -#these files were generated by SWIG so we aren't gonna scan them. -sonar.exclusions=src/main/java/cl/transbank/pos/utils/*.java \ No newline at end of file From 14e03d54c9ae6c9b3f32e7873f598182af2e6ab0 Mon Sep 17 00:00:00 2001 From: Mauricio Astudillo Toledo Date: Wed, 19 Jun 2024 17:54:19 -0400 Subject: [PATCH 3/9] chore: add sonar properties in pom file --- pom.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pom.xml b/pom.xml index 1265914..266977d 100644 --- a/pom.xml +++ b/pom.xml @@ -93,6 +93,8 @@ 1.7 UTF-8 UTF-8 + transbankdevelopers + https://sonarcloud.io From 00dbf7078c7d32db3bacce4040c0fa8736e7f850 Mon Sep 17 00:00:00 2001 From: Mauricio Astudillo Toledo Date: Wed, 19 Jun 2024 17:55:35 -0400 Subject: [PATCH 4/9] chore: update deploy.sh file to use env variables from GitHub actions --- scripts/deploy.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/deploy.sh b/scripts/deploy.sh index fb3c938..9eb9215 100644 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -1,17 +1,17 @@ #!/bin/bash -if [ ! -z "$TRAVIS_TAG" ] +if [ ! -z "$TAG" ] then echo "Tag found" - if ( echo $TRAVIS_TAG | egrep -i '^v[0-9]+\.[0-9]+\.[0-9]+') + if ( echo $TAG | egrep -i '^v[0-9]+\.[0-9]+\.[0-9]+') then - VERSION_NUMBER=${TRAVIS_TAG:1} + VERSION_NUMBER=${TAG:1} echo "on a tag -> set pom.xml to $VERSION_NUMBER" - mvn --settings .travis/settings.xml org.codehaus.mojo:versions-maven-plugin:2.1:set -DnewVersion=$VERSION_NUMBER 1>/dev/null 2>/dev/null + mvn --settings scripts/settings.xml org.codehaus.mojo:versions-maven-plugin:2.1:set -DnewVersion=$VERSION_NUMBER 1>/dev/null 2>/dev/null else - echo "Tag does not start with v: ${TRAVIS_TAG} keep snapshot version in pom.xml" + echo "Tag does not start with v: ${TAG} keep snapshot version in pom.xml" fi - mvn clean deploy --settings .travis/settings.xml -B -U + mvn clean deploy --settings scripts/settings.xml -B -U else echo "not on a tag no deploy trigered" fi From f5eebc403112299717a4243b543d216a4313b7cd Mon Sep 17 00:00:00 2001 From: Mauricio Astudillo Toledo Date: Wed, 19 Jun 2024 17:58:57 -0400 Subject: [PATCH 5/9] chore: add build workflow --- .github/workflows/build.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..124c91f --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,30 @@ +name: Build and Scan + +on: + pull_request: + branches: + - "*" +jobs: + build: + runs-on: ubuntu-latest + + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Java 8 + uses: actions/setup-java@v4 + with: + distribution: 'oracle' + java-version: 8 + + - name: Compile + run: mvn --settings scripts/settings.xml clean compile + + - name: Run SonarCloud analysis + run: mvn --settings scripts/settings.xml sonar:sonar -Dsonar.token=$SONAR_TOKEN -Dsonar.projectKey=TransbankDevelopers_transbank-pos-sdk-java From 88596b64cb9b8c4f280c11591882ea41c2e0a283 Mon Sep 17 00:00:00 2001 From: Mauricio Astudillo Toledo Date: Wed, 19 Jun 2024 17:59:42 -0400 Subject: [PATCH 6/9] chore: add release workflow --- .github/workflows/release.yml | 45 +++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..44636e8 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,45 @@ +name: Release to Mave + +on: + release: + types: [created] + +jobs: + release: + runs-on: ubuntu-latest + + env: + TAG: ${{ github.event.release.tag_name }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + GPG_SECRET_KEYS: ${{ secrets.GPG_SECRET_KEYS }} + GPG_OWNERTRUST: ${{ secrets.GPG_OWNERTRUST }} + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + GPG_EXECUTABLE: ${{ secrets.GPG_EXECUTABLE }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + + steps: + - name: Use checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Java 8 + uses: actions/setup-java@v4 + with: + distribution: 'oracle' + java-version: 8 + + - name: Import GPG keys + run: | + echo $GPG_SECRET_KEYS | base64 --decode | gpg --import + echo $GPG_OWNERTRUST | base64 --decode | gpg --import-ownertrust + + - name: Build with Jacoco + run: mvn --settings scripts/settings.xml clean org.jacoco:jacoco-maven-plugin:prepare-agent package org.jacoco:jacoco-maven-plugin:report + + - name: Deploy + run: | + chmod +x scripts/deploy.sh + ./scripts/deploy.sh + \ No newline at end of file From b20e6d45b65c27bc1e316d80ac34a73e9b0716c0 Mon Sep 17 00:00:00 2001 From: Mauricio Astudillo Toledo Date: Wed, 19 Jun 2024 18:07:45 -0400 Subject: [PATCH 7/9] style: add end line --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 44636e8..9557ef3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -42,4 +42,4 @@ jobs: run: | chmod +x scripts/deploy.sh ./scripts/deploy.sh - \ No newline at end of file + From 2c31836065dffba46b0f600eac9ce55a0e9455de Mon Sep 17 00:00:00 2001 From: Mauricio Astudillo Toledo Date: Wed, 19 Jun 2024 18:13:46 -0400 Subject: [PATCH 8/9] chore: update java provider --- .github/workflows/build.yml | 4 ++-- .github/workflows/release.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 124c91f..d85f363 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,7 +7,7 @@ on: jobs: build: runs-on: ubuntu-latest - + env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} @@ -20,7 +20,7 @@ jobs: - name: Set up Java 8 uses: actions/setup-java@v4 with: - distribution: 'oracle' + distribution: 'temurin' java-version: 8 - name: Compile diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9557ef3..fbe5dba 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,7 +27,7 @@ jobs: - name: Set up Java 8 uses: actions/setup-java@v4 with: - distribution: 'oracle' + distribution: 'temurin' java-version: 8 - name: Import GPG keys From ed3c7fdb09c9691ce4c0a3242fba3547dcb83241 Mon Sep 17 00:00:00 2001 From: Mauricio Astudillo Toledo Date: Wed, 19 Jun 2024 18:38:46 -0400 Subject: [PATCH 9/9] chore: use java 17 to run sonar cloud step --- .github/workflows/build.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d85f363..736d6c8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,5 +26,11 @@ jobs: - name: Compile run: mvn --settings scripts/settings.xml clean compile + - name: Set up Java 17 + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: 17 + - name: Run SonarCloud analysis run: mvn --settings scripts/settings.xml sonar:sonar -Dsonar.token=$SONAR_TOKEN -Dsonar.projectKey=TransbankDevelopers_transbank-pos-sdk-java