From 9857f41d6b7490e715699beb47b83bec36781036 Mon Sep 17 00:00:00 2001 From: Tristan Tarrant Date: Mon, 29 Aug 2022 11:37:17 +0200 Subject: [PATCH] GitHub Actions for PRs and release --- .github/workflows/pull_requests.yml | 80 ++++++++++++++++++++++++++++ .github/workflows/release.yml | 81 +++++++++++++++++++++++++++++ 2 files changed, 161 insertions(+) create mode 100644 .github/workflows/pull_requests.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/pull_requests.yml b/.github/workflows/pull_requests.yml new file mode 100644 index 000000000..7319daec9 --- /dev/null +++ b/.github/workflows/pull_requests.yml @@ -0,0 +1,80 @@ +name: Test + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + jdk11: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Setup Java + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'temurin' + cache: maven + + - name: JDK 11 Tests + run: mvn -B verify -Dmaven.test.failure.ignore=true -Dansi.strip=true + + - name: Test Results + uses: dorny/test-reporter@v1 + if: success() || failure() + with: + name: JDK 11 Test Results + path: "**/target/*-reports*/**/TEST-*.xml" + reporter: java-junit + + jdk17: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Setup Java + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + + - name: JDK 17 Tests + run: mvn -B verify -Dmaven.test.failure.ignore=true -Dansi.strip=true + + - name: Test Results + uses: dorny/test-reporter@v1 + if: success() || failure() + with: + name: JDK 17 Test Results + path: "**/target/*-reports*/**/TEST-*.xml" + reporter: java-junit + + jdk8: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Setup Java + uses: actions/setup-java@v3 + with: + java-version: '8' + distribution: 'temurin' + cache: maven + + - name: JDK 8 Tests + run: mvn -B verify -Dmaven.test.failure.ignore=true -Dansi.strip=true + + - name: Test Results + uses: dorny/test-reporter@v1 + if: success() || failure() + with: + name: JDK 8 Test Results + path: "**/target/*-reports*/**/TEST-*.xml" + reporter: java-junit + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..88fb80eb1 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,81 @@ +name: Release + +on: + workflow_dispatch: + inputs: + branch: + description: "The ProtoStream branch to checkout when cutting the release." + required: true + default: "main" + version: + description: "Release version" + required: true + nextVersion: + description: "Next version" + required: true + +jobs: + release: + runs-on: ubuntu-latest + + steps: + - name: Checkout Source + uses: actions/checkout@v2 + with: + ref: ${{ github.event.inputs.branch }} + + - name: Set release version + run: | + mvn -B versions:set -DnewVersion=${{ github.event.inputs.version }} -DprocessAllModules=true + mvn -B versions:set-property -Dproperty=version.infinispan -DnewVersion=${{ github.event.inputs.version }} + + - name: Set up Java for publishing to OSSRH + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'temurin' + server-id: ossrh + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + gpg-private-key: ${{ secrets.INFINISPAN_MAVEN_GPG_ARMORED }} + gpg-passphrase: MAVEN_GPG_PASSPHRASE + + - name: Publish to OSSRH + run: mvn -B clean deploy -Pcommunity-release -DskipTests + env: + MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.INFINISPAN_MAVEN_GPG_PASSPHRASE }} + + - name: Configure Git User + run: | + git config user.email "infinispan@infinispan.org" + git config user.name "Infinispan" + + + - name: Tag Release + run: | + git commit -a -m "Releasing ${{ github.event.inputs.version }}" + git tag ${{ github.event.inputs.version }} + + - name: Next Version + run: | + mvn -B versions:set -DnewVersion=${{ github.event.inputs.nextVersion }} -DprocessAllModules=true + mvn -B versions:set-property -Dproperty=version.infinispan -DnewVersion=${{ github.event.inputs.nextVersion }} + git commit -a -m "Next version ${{ github.event.inputs.nextVersion }}" + + - name: Push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ github.event.inputs.branch }} + tags: true + + - id: release + name: Create Release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.event.inputs.version }} + release_name: ${{ github.event.inputs.version }}