Skip to content

Update gradle-build-action usage #318

Update gradle-build-action usage

Update gradle-build-action usage #318

Workflow file for this run

name: 'Build and Release Spock'
on:
push:
branches:
- master
tags:
- 'spock-*'
jobs:
build-and-verify:
runs-on: ${{ matrix.os }}
if: github.repository == 'spockframework/spock'
strategy:
fail-fast: false
matrix:
os: [ 'ubuntu-latest' ]
variant: ['2.5', '3.0', '4.0']
java: [ '8', '11', '17', '21' ]
exclude:
- os: 'ubuntu-latest'
variant: '2.5'
java: '17'
- os: 'ubuntu-latest'
variant: '2.5'
java: '21'
include:
- os: 'windows-latest'
variant: '2.5'
java: '8'
- os: 'windows-latest'
variant: '3.0'
java: '8'
- os: 'windows-latest'
variant: '4.0'
java: '8'
- os: 'macos-latest'
variant: '2.5'
java: '8'
- os: 'macos-latest'
variant: '3.0'
java: '8'
- os: 'macos-latest'
variant: '4.0'
java: '8'
steps:
- uses: actions/checkout@v4
with:
# Codecov needs fetch-depth > 1
fetch-depth: 2
- name: 'Set up JDKs'
uses: ./.github/actions/setup-build-env
with:
additional-java-version: ${{ matrix.java }}
- name: 'Build Spock'
env:
ORG_GRADLE_PROJECT_spockBuildCacheUsername: ${{ secrets.SPOCK_BUILD_CACHE_USERNAME }}
ORG_GRADLE_PROJECT_spockBuildCachePassword: ${{ secrets.SPOCK_BUILD_CACHE_PASSWORD }}
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
run: ./gradlew --no-parallel --stacktrace ghActionsBuild "-Dvariant=${{ matrix.variant }}" "-DjavaVersion=${{ matrix.java }}" "-Dscan.tag.main-build"
- name: 'Stop Daemon'
run: |
./gradlew --stop
- name: 'Upload to Codecov.io'
uses: codecov/codecov-action@v3
release-spock:
runs-on: ${{ matrix.os }}
needs: [ 'build-and-verify' ]
strategy:
matrix:
os: [ 'ubuntu-latest' ]
variant: [ '2.5', '3.0', '4.0' ] # publish needs to be done for all versions
java: [ '8' ] # publish needs the min supported java version
steps:
- uses: actions/checkout@v4
- name: 'Set up JDKs'
uses: ./.github/actions/setup-build-env
with:
additional-java-version: ${{ matrix.java }}
- name: 'Publish Spock'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONATYPE_OSS_USER: ${{ secrets.SONATYPE_OSS_USER }}
SONATYPE_OSS_PASSWORD: ${{ secrets.SONATYPE_OSS_PASSWORD }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_GPG_PASSWORD }}
ORG_GRADLE_PROJECT_spockBuildCacheUsername: ${{ secrets.SPOCK_BUILD_CACHE_USERNAME }}
ORG_GRADLE_PROJECT_spockBuildCachePassword: ${{ secrets.SPOCK_BUILD_CACHE_PASSWORD }}
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
run: ./gradlew --no-parallel --stacktrace ghActionsPublish "-Dvariant=${{ matrix.variant }}" "-DjavaVersion=${{ matrix.java }}" "-Dscan.tag.main-publish"
publish-release-docs:
runs-on: ${{ matrix.os }}
needs: ['release-spock']
strategy:
matrix:
os: ['ubuntu-latest']
variant: ['4.0'] # docs need the highest variant
java: ['21'] # docs need the highest java version
steps:
- uses: actions/checkout@v4
- name: 'Set up JDKs'
uses: ./.github/actions/setup-build-env
with:
additional-java-version: ${{ matrix.java }}
- name: 'Create Temporary Branch'
run: |
git checkout -b "docs-$GITHUB_SHA"
- name: 'Publish Docs'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ORG_GRADLE_PROJECT_spockBuildCacheUsername: ${{ secrets.SPOCK_BUILD_CACHE_USERNAME }}
ORG_GRADLE_PROJECT_spockBuildCachePassword: ${{ secrets.SPOCK_BUILD_CACHE_PASSWORD }}
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
run: ./gradlew --no-parallel --stacktrace ghActionsDocs "-Dvariant=${{ matrix.variant }}" "-DjavaVersion=${{ matrix.java }}" "-Dscan.tag.main-docs"