Build and test -> Compute coverage -> Release #38
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and test -> Compute coverage -> Release | |
on: | |
watch: | |
types: [started] | |
jobs: | |
ask-for-authorization: | |
name: Ask for authorization | |
runs-on: ubuntu-latest | |
steps: | |
- uses: octokit/[email protected] | |
with: | |
route: GET /repos/:repository/collaborators/${{ github.actor }} | |
repository: ${{ github.repository }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Send push notification | |
if: ${{ failure() }} | |
uses: techulus/[email protected] | |
env: | |
API_KEY: ${{ secrets.PUSH_NOTIFICATION_API_KEY }} | |
MESSAGE: ${{ format('New star for {0}!', github.repository) }} | |
build-and-test-with-Java-8-and-later: | |
name: Build -> Test (JVM ${{ matrix.java }}, ${{ matrix.os }}) | |
needs: [ask-for-authorization] | |
strategy: | |
fail-fast: true | |
max-parallel: 15 | |
matrix: | |
os: [windows-latest, macOS-latest, ubuntu-latest] | |
java: [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22] | |
architecture: [x64] | |
exclude: | |
- os: macOS-latest | |
java: 13 | |
- os: macOS-latest | |
java: 14 | |
- os: ubuntu-latest | |
java: 10 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK ${{ matrix.java }} | |
uses: actions/setup-java@v3 | |
with: | |
java-version: ${{ matrix.java }} | |
distribution: 'zulu' | |
architecture: ${{ matrix.architecture }} | |
- name: Build and test with | |
run: mvn -B clean test -DskipTests=false --file pom.xml | |
test-and-compute-coverage: | |
name: Test -> Compute coverage | |
needs: [build-and-test-with-Java-8-and-later] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
java-version: 8 | |
distribution: 'zulu' | |
architecture: x64 | |
- name: Build and test | |
run: mvn clean test -DskipTests=false -Dproject.test.testSuite=AllTestsSuite -P run-coveralls jacoco:report coveralls:report -DrepoToken=${{ secrets.coveralls_repo_token }} | |
release: | |
name: Release | |
needs: [build-and-test-with-Java-8-and-later] | |
# This is an organization variable: see https://docs.github.com/en/actions/learn-github-actions/variables | |
if: ${{ fromJSON(vars.MANUAL_RELEASE_ENABLED) }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 22 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 22 | |
distribution: 'zulu' | |
server-id: ossrh | |
server-username: MAVEN_USERNAME | |
server-password: MAVEN_PASSWORD | |
- name: Publish to the Maven Central repository | |
run: | | |
export GPG_TTY=$(tty) | |
echo "${{ secrets.gpg_private_key }}" | gpg --batch --import | |
git config user.name "${GITHUB_ACTOR}" | |
git config user.email "[email protected]" | |
mvn -B release:prepare release:perform -Dproject_jdk_version=8 -DskipTests=true -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} -Dgpg.keyname=${{ secrets.gpg_key_id }} -Drepository.url=https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git | |
env: | |
MAVEN_USERNAME: ${{ secrets.nexus_username }} | |
MAVEN_PASSWORD: ${{ secrets.nexus_password }} |