Skip to content

Commit 8b97f9a

Browse files
author
Szczepan Faber
committed
Initial GH Actions workflow
1 parent b8f480f commit 8b97f9a

File tree

1 file changed

+104
-0
lines changed

1 file changed

+104
-0
lines changed

.github/workflows/ci.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
#
2+
# CI build that assembles artifacts and runs tests.
3+
# If validation is successful this workflow releases from the main dev branch.
4+
#
5+
# - skipping CI: add [skip ci] to the commit message
6+
# - skipping release: add [skip release] to the commit message
7+
#
8+
name: CI
9+
10+
on:
11+
push:
12+
branches:
13+
- main
14+
tags-ignore:
15+
- v* # release tags are automatically generated after a successful CI build, no need to run CI against them
16+
pull_request:
17+
branches:
18+
- main
19+
20+
jobs:
21+
22+
#
23+
# SINGLE-JOB
24+
#
25+
verify:
26+
runs-on: ubuntu-latest
27+
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
28+
29+
steps:
30+
31+
- name: 1. Check out code
32+
uses: actions/checkout@v2 # https://github.com/actions/checkout
33+
34+
- name: 2. Set up Java 8
35+
uses: actions/setup-java@v1 # https://github.com/actions/setup-java
36+
with:
37+
java-version: 8
38+
39+
- name: 3. Validate Gradle wrapper
40+
uses: gradle/wrapper-validation-action@v1 # https://github.com/gradle/wrapper-validation-action
41+
42+
#
43+
# Main build job
44+
#
45+
build:
46+
needs: [verify]
47+
runs-on: ubuntu-latest
48+
49+
# Definition of the build matrix
50+
strategy:
51+
matrix:
52+
mock-maker: ['mock-maker-default', 'mock-maker-inline']
53+
kotlin: ['1.0.7', '1.1.61', '1.2.50', '1.3.50']
54+
55+
steps:
56+
57+
- name: 1. Check out code
58+
uses: actions/checkout@v2 # https://github.com/actions/checkout
59+
60+
- name: 2. Set up Java 8
61+
uses: actions/setup-java@v1 # https://github.com/actions/setup-java
62+
with:
63+
java-version: 8
64+
65+
- name: 3. Build with Kotlin ${{ matrix.kotlin }} and mock-maker ${{ matrix.mock-maker }}
66+
run: |
67+
ops/mockMakerInline.sh
68+
./gradlew build bintrayUpload idea -PbintrayDryRun
69+
env:
70+
KOTLIN_VERSION: ${{ matrix.kotlin }}
71+
MOCK_MAKER: ${{ matrix.mock-maker }}
72+
73+
#
74+
# Release job, only for pushes to the main development branch
75+
#
76+
release:
77+
runs-on: ubuntu-latest
78+
needs: [build] # build job must pass before we can release
79+
80+
if: github.event_name == 'push'
81+
&& github.ref == 'refs/heads/main'
82+
&& github.repository == 'mockito/mockito-kotlin'
83+
&& !contains(toJSON(github.event.commits.*.message), '[skip release]')
84+
85+
steps:
86+
87+
- name: Check out code
88+
uses: actions/checkout@v2 # https://github.com/actions/checkout
89+
with:
90+
fetch-depth: '0' # https://github.com/shipkit/shipkit-changelog#fetch-depth-on-ci
91+
92+
- name: Set up Java 8
93+
uses: actions/setup-java@v1
94+
with:
95+
java-version: 8
96+
97+
- name: Build and publish to Bintray/MavenCentral
98+
run: ./gradlew tasks # TODO, in progress: bintrayUpload githubRelease
99+
# env:
100+
# GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
101+
# BINTRAY_API_KEY: ${{secrets.BINTRAY_API_KEY}}
102+
# NEXUS_TOKEN_USER: ${{secrets.NEXUS_TOKEN_USER}}
103+
# NEXUS_TOKEN_PWD: ${{secrets.NEXUS_TOKEN_PWD}}
104+

0 commit comments

Comments
 (0)