Skip to content

Improve support for stubbing Result return values for synchronous and suspendable functions #311

Improve support for stubbing Result return values for synchronous and suspendable functions

Improve support for stubbing Result return values for synchronous and suspendable functions #311

Workflow file for this run

#
# 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:
- v*
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 17
uses: actions/setup-java@v1 # https://github.com/actions/setup-java
with:
java-version: 17
- name: 3. Validate Gradle wrapper
uses: gradle/actions/wrapper-validation@v4 # https://github.com/gradle/wrapper-validation-action
#
# Main build job
#
build:
needs: [verify]
runs-on: ubuntu-latest
# Definition of the build matrix
strategy:
matrix:
kotlin: ['2.1.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 17
uses: actions/setup-java@v1 # https://github.com/actions/setup-java
with:
java-version: 17
- name: 3. Spotless check. Run './gradlew spotlessApply :tests:spotlessApply' locally if this job fails.
run: >
./gradlew
spotlessCheck :tests:spotlessCheck
--stacktrace
--scan
- name: 4. Build with Kotlin ${{ matrix.kotlin }}
run: |
./gradlew build -PtestKotlinVersion=${{ matrix.kotlin }}
#
# 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'
&& startsWith(github.ref, 'refs/tags/v')
&& 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 17
uses: actions/setup-java@v1
with:
java-version: 17
- 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}}