From dfda1ea5cae88cb2397a30c28bdf9a0396fd9810 Mon Sep 17 00:00:00 2001 From: Jeremy Landis Date: Wed, 2 Dec 2020 09:03:47 -0500 Subject: [PATCH 1/2] [actions] Board github actions --- .github/workflows/ci.yaml | 39 +++++++++++++++++++++++++++++++ .github/workflows/sonar.yaml | 41 +++++++++++++++++++++++++++++++++ .github/workflows/sonatype.yaml | 38 ++++++++++++++++++++++++++++++ .mvn/extensions.xml | 8 +++++++ .mvn/settings.xml | 19 +++++++++++++++ .travis.yml | 1 - travis/after_success.sh | 25 +++++++++----------- travis/settings.xml | 33 -------------------------- 8 files changed, 156 insertions(+), 48 deletions(-) create mode 100644 .github/workflows/ci.yaml create mode 100644 .github/workflows/sonar.yaml create mode 100644 .github/workflows/sonatype.yaml create mode 100644 .mvn/extensions.xml create mode 100644 .mvn/settings.xml delete mode 100644 travis/settings.xml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000..a0978afc --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,39 @@ +# +# Copyright 2010-2020 the original author or authors. +# +# Licensed 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 CI + +on: [push, pull_request] + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macOS-latest, windows-latest] + java: [8, 11, 15, 16-ea] + fail-fast: false + max-parallel: 4 + name: Test JDK ${{ matrix.java }}, ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + - name: Set up JDK + uses: actions/setup-java@v1 + with: + java-version: ${{ matrix.java }} + - name: Test with Maven + run: ./mvnw test -B -D"license.skip=true" diff --git a/.github/workflows/sonar.yaml b/.github/workflows/sonar.yaml new file mode 100644 index 00000000..bfe065e9 --- /dev/null +++ b/.github/workflows/sonar.yaml @@ -0,0 +1,41 @@ +# +# Copyright 2010-2020 the original author or authors. +# +# Licensed 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: SonarCloud + +on: + push: + branches: + - master + +jobs: + build: + if: github.repository_owner == 'mybatis' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + # Disabling shallow clone is recommended for improving relevancy of reporting + fetch-depth: 0 + - name: Set up JDK + uses: actions/setup-java@v1 + with: + java-version: 11 + - name: Analyze with SonarCloud + run: ./mvnw verify sonar:sonar -B -Dsonar.projectKey=mybatis_migrations -Dsonar.organization=mybatis -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_TOKEN -Dlicense.skip=true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.github/workflows/sonatype.yaml b/.github/workflows/sonatype.yaml new file mode 100644 index 00000000..1ad95b8b --- /dev/null +++ b/.github/workflows/sonatype.yaml @@ -0,0 +1,38 @@ +# +# Copyright 2010-2020 the original author or authors. +# +# Licensed 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: Sonatype + +on: + push: + branches: + - master + +jobs: + build: + if: github.repository_owner == 'mybatis' && ! contains(toJSON(github.event.head_commit.message), '[maven-release-plugin]') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up JDK + uses: actions/setup-java@v1 + with: + java-version: 11 + - name: Deploy to Sonatype + run: ./mvnw deploy -DskipTests -B --settings ./.mvn/settings.xml -Dlicense.skip=true + env: + CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }} + CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }} diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml new file mode 100644 index 00000000..1c87ce31 --- /dev/null +++ b/.mvn/extensions.xml @@ -0,0 +1,8 @@ + + + + fr.jcgay.maven + maven-profiler + 3.0 + + diff --git a/.mvn/settings.xml b/.mvn/settings.xml new file mode 100644 index 00000000..5b91cb63 --- /dev/null +++ b/.mvn/settings.xml @@ -0,0 +1,19 @@ + + + + + ossrh + ${env.CI_DEPLOY_USERNAME} + ${env.CI_DEPLOY_PASSWORD} + + + gh-pages + + + github + ${env.CI_DEPLOY_USERNAME} + ${env.GITHUB_TOKEN} + + + diff --git a/.travis.yml b/.travis.yml index 1d0f00e1..2f60207a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: java jdk: - - openjdk11 - openjdk8 script: ./mvnw test -Djacoco.skip=true -B diff --git a/travis/after_success.sh b/travis/after_success.sh index d26e02e8..77a63968 100755 --- a/travis/after_success.sh +++ b/travis/after_success.sh @@ -23,30 +23,27 @@ echo "Current commit detected: ${commit_message}" # We build for several JDKs on Travis. # Some actions, like analyzing the code (Coveralls) and uploading # artifacts on a Maven repository, should only be made for one version. - -# If the version is 1.6, then perform the following actions. -# 1. Upload artifacts to Sonatype. -# 2. Use -q option to only display Maven errors and warnings. -# 3. Use --settings to force the usage of our "settings.xml" file. -# 4. Notify Coveralls. -# 5. Deploy site + +# If the version is 1.8, then perform the following actions. +# 1. Notify Coveralls. +# 2. Deploy site (disabled as solution not complete). + +# Parameters +# 1. Use -q option to only display Maven errors and warnings. +# 2. Use --settings to force the usage of our "settings.xml" file. if [ $TRAVIS_REPO_SLUG == "mybatis/migrations" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ] && [[ "$commit_message" != *"[maven-release-plugin]"* ]]; then if [ $TRAVIS_JDK_VERSION == "openjdk8" ]; then - # Deploy to sonatype - ./mvnw clean deploy -q --settings ./travis/settings.xml - echo -e "Successfully deployed SNAPSHOT artifacts to Sonatype under Travis job ${TRAVIS_JOB_NUMBER}" - # Deploy to coveralls - ./mvnw clean test jacoco:report coveralls:report -q --settings ./travis/settings.xml + ./mvnw clean test jacoco:report coveralls:report -q --settings ./mvn/settings.xml echo -e "Successfully ran coveralls under Travis job ${TRAVIS_JOB_NUMBER}" # Deploy to site # Cannot currently run site this way - # ./mvnw site site:deploy -q --settings ./travis/settings.xml - # echo -e "Successfully deploy site under Travis job ${TRAVIS_JOB_NUMBER}" + # ./mvnw site site:deploy -q --settings ./mvn/settings.xml + # echo -e "Successfully deploy site under Travis job ${TRAVIS_JOB_NUMBER}" else echo "Java Version does not support additonal activity for travis CI" fi diff --git a/travis/settings.xml b/travis/settings.xml deleted file mode 100644 index 44eb3402..00000000 --- a/travis/settings.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - ossrh - ${env.CI_DEPLOY_USERNAME} - ${env.CI_DEPLOY_PASSWORD} - - - gh-pages - git - ${env.CI_SITE_PASSWORD} - - - From cfedd4cc7eb28e85c828522f408d1b5ff10feb84 Mon Sep 17 00:00:00 2001 From: Jeremy Landis Date: Fri, 4 Dec 2020 22:10:34 -0500 Subject: [PATCH 2/2] [actions] Drop jdk 15/16 and windows for time being windows doesn't work due to tmp handling. jdk 15/16 do not work currently. --- .github/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a0978afc..834c7647 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -23,8 +23,8 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macOS-latest, windows-latest] - java: [8, 11, 15, 16-ea] + os: [ubuntu-latest, macOS-latest] + java: [8, 11] fail-fast: false max-parallel: 4 name: Test JDK ${{ matrix.java }}, ${{ matrix.os }}