Update PR template #162
Workflow file for this run
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
# | |
# CI build that assembles artifacts and runs tests. | |
# If validation is successful this workflow releases from the main dev branch. | |
# | |
# - skipping CI: add [skip ci] to the commit message | |
# - skipping release: add [skip release] to the commit message | |
# | |
name: CI | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- 5.* | |
pull_request: | |
branches: | |
- main | |
jobs: | |
# | |
# SINGLE-JOB | |
# | |
verify: | |
runs-on: ubuntu-latest | |
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')" | |
steps: | |
- name: 1. Check out code | |
uses: actions/checkout@v2 # https://github.com/actions/checkout | |
- name: 2. Set up Java 11 | |
uses: actions/setup-java@v1 # https://github.com/actions/setup-java | |
with: | |
java-version: 11 | |
- name: 3. Validate Gradle wrapper | |
uses: gradle/wrapper-validation-action@v1 # https://github.com/gradle/wrapper-validation-action | |
# | |
# Main build job | |
# | |
build: | |
needs: [verify] | |
runs-on: ubuntu-latest | |
# Definition of the build matrix | |
strategy: | |
matrix: | |
mock-maker: ['mock-maker-default', 'mock-maker-inline'] | |
kotlin: ['1.9.20'] | |
# Note that the old Travis CI referenced other Kotlin versions: '1.0.7', '1.1.61', '1.2.50' | |
# However, those versions of Kotlin don't work with latest Gradle | |
steps: | |
- name: 1. Check out code | |
uses: actions/checkout@v2 # https://github.com/actions/checkout | |
- name: 2. Set up Java 11 | |
uses: actions/setup-java@v1 # https://github.com/actions/setup-java | |
with: | |
java-version: 11 | |
- name: 3. Build with Kotlin ${{ matrix.kotlin }} and mock-maker ${{ matrix.mock-maker }} | |
run: | | |
ops/mockMakerInline.sh | |
./gradlew build | |
env: | |
KOTLIN_VERSION: ${{ matrix.kotlin }} | |
MOCK_MAKER: ${{ matrix.mock-maker }} | |
# | |
# Release job, only for pushes to the main development branch | |
# | |
release: | |
runs-on: ubuntu-latest | |
needs: [build] # build job must pass before we can release | |
if: github.event_name == 'push' | |
&& (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/5.')) | |
&& github.repository == 'mockito/mockito-kotlin' | |
&& !contains(toJSON(github.event.commits.*.message), '[skip release]') | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 # https://github.com/actions/checkout | |
with: | |
fetch-depth: '0' # https://github.com/shipkit/shipkit-changelog#fetch-depth-on-ci | |
- name: Set up Java 11 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- name: Build and release | |
run: ./gradlew githubRelease publishToSonatype closeAndReleaseStagingRepository releaseSummary | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
NEXUS_TOKEN_USER: ${{secrets.NEXUS_TOKEN_USER}} | |
NEXUS_TOKEN_PWD: ${{secrets.NEXUS_TOKEN_PWD}} | |
PGP_KEY: ${{secrets.PGP_KEY}} | |
PGP_PWD: ${{secrets.PGP_PWD}} |