1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-12-22 10:59:01 +00:00

gradle, separate test, and build/upload

This commit is contained in:
soloturn 2022-02-12 08:36:01 +01:00
parent a08af697e4
commit ba4c7da3e4

View File

@ -66,17 +66,13 @@ jobs:
# We run the tests on many OS / Java combinations but also the Compile step because some users build # We run the tests on many OS / Java combinations but also the Compile step because some users build
# their own jars from source, so it is good for CI to check that is working on all combinations. # their own jars from source, so it is good for CI to check that is working on all combinations.
build: test:
needs: workflow_config needs: workflow_config
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
java_version: [ 8, 11, 17 ] java_version: [ 8, 11, 17 ]
os: [ macos-10.15, macos-11, ubuntu-18.04, ubuntu-20.04, windows-2019, windows-2022 ] os: [ macos-10.15, macos-11, ubuntu-18.04, ubuntu-20.04, windows-2019, windows-2022 ]
include:
- release_from_this_build: true
os: ubuntu-20.04
java_version: 8
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Checkout the repository - name: Checkout the repository
@ -96,17 +92,32 @@ jobs:
- name: Test - name: Test
run: gradle -q test --no-daemon run: gradle -q test --no-daemon
# The repeated "matrix.release_from_this_build" checks are messy, but I have not found a simple way to avoid them upload:
# See https://github.com/actions/runner/issues/662 needs: [ workflow_config, test ]
if: needs.workflow_config.outputs.do_release == 'true' || needs.workflow_config.outputs.do_snapshot_release == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v2
- name: Create artifacts - name: Set up java
if: matrix.release_from_this_build uses: actions/setup-java@v2.5.0
with:
java-version: 17
distribution: temurin
cache: gradle
- name: Set version from tag
if: env.POM_VERSION
env: env:
POM_VERSION: ${{ needs.workflow_config.outputs.pom_version }} POM_VERSION: ${{ needs.workflow_config.outputs.pom_version }}
run: gradle -q clean build generateMetadataFileForMavenPublication generatePomFileForMavenPublication -Pversion=${POM_VERSION} -x test run: sed -i "s/version = .*/version = $POM_VERSION/" gradle.properties
- name: Build artifacts
run: gradle -q clean build generateMetadataFileForMavenPublication generatePomFileForMavenPublication -x test
- name: Setup gpg - name: Setup gpg
if: matrix.release_from_this_build && env.ARTIFACT_SIGNING_KEY if: env.ARTIFACT_SIGNING_KEY
id: gpg id: gpg
env: env:
ARTIFACT_SIGNING_KEY: ${{ secrets.ARTIFACT_SIGNING_KEY }} ARTIFACT_SIGNING_KEY: ${{ secrets.ARTIFACT_SIGNING_KEY }}
@ -119,18 +130,16 @@ jobs:
echo "::set-output name=key_id::${key_id}" echo "::set-output name=key_id::${key_id}"
- name: Sign artifacts - name: Sign artifacts
if: matrix.release_from_this_build && env.GPG_KEYNAME if: env.GPG_KEYNAME
env: env:
GPG_KEYNAME: ${{ steps.gpg.outputs.key_id }} GPG_KEYNAME: ${{ steps.gpg.outputs.key_id }}
GPG_PASSPHRASE: ${{ secrets.ARTIFACT_SIGNING_PASSPHRASE }} GPG_PASSPHRASE: ${{ secrets.ARTIFACT_SIGNING_PASSPHRASE }}
POM_VERSION: ${{ needs.workflow_config.outputs.pom_version }}
run: | run: |
gradle sign "-Pversion=${POM_VERSION}"\ gradle sign \
"-Psigning.gnupg.keyName=${GPG_KEYNAME}" \ "-Psigning.gnupg.keyName=${GPG_KEYNAME}" \
"-Psigning.gnupg.passphrase=${GPG_PASSPHRASE}" "-Psigning.gnupg.passphrase=${GPG_PASSPHRASE}"
- name: Upload artifacts - name: Upload artifacts
if: matrix.release_from_this_build
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
# Using github.run_number here to reduce confusion when downloading & comparing artifacts from several builds # Using github.run_number here to reduce confusion when downloading & comparing artifacts from several builds
@ -139,20 +148,6 @@ jobs:
build/libs/* build/libs/*
build/publications/maven/* build/publications/maven/*
release:
needs: [ workflow_config, build ]
if: needs.workflow_config.outputs.do_release == 'true' || needs.workflow_config.outputs.do_snapshot_release == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v2
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: ${{ github.run_number }}-artifacts
path: build
- name: Create snapshot release - name: Create snapshot release
if: needs.workflow_config.outputs.do_snapshot_release == 'true' if: needs.workflow_config.outputs.do_snapshot_release == 'true'
env: env:
@ -163,6 +158,5 @@ jobs:
if: needs.workflow_config.outputs.do_release == 'true' if: needs.workflow_config.outputs.do_release == 'true'
env: env:
GITHUB_TOKEN: ${{ github.token }} GITHUB_TOKEN: ${{ github.token }}
POM_VERSION: ${{ needs.workflow_config.outputs.pom_version }}
TAG: ${{ github.event.ref }} TAG: ${{ github.event.ref }}
run: .github/scripts/release-gradle.sh run: .github/scripts/release-gradle.sh