This repository has been archived by the owner on Apr 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
95 lines (92 loc) · 3.3 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
persist-credentials: false
fetch-depth: 0
- name: Use current branch
run: git checkout ${{ github.head_ref }}
- name: Download ktlint
run: "curl -sSLO https://github.com/pinterest/ktlint/releases/download/0.39.0/ktlint && chmod a+x ktlint && mv ktlint .."
- name: Run ktlint
run: "../ktlint -F"
- name: Check for changes
run: |
if [[ $(git status -s) ]]; then
echo "Fixing PR lint"
git diff
git config --local user.email "[email protected]"
git config --local user.name "Auto Lint"
git commit -m "Fix PR lint" -a
git push https://${{ secrets.GITHUBTOKEN }}@github.com/andrewinci/insulator.git
exit 1
else
echo "Nothing to change"
exit 0
fi
build-and-test:
needs: linting
runs-on: ${{ matrix.os.name }}
strategy:
matrix:
os:
- name: macos-latest
run-coverage: false
- name: ubuntu-latest
run-coverage: true
- name: windows-latest
run-coverage: false
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Java JDK
uses: actions/[email protected]
with:
java-version: 14
java-package: jdk
- name: Cache
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: ${{ runner.os }}-gradle-
- name: Build and run tests
if: ${{ !matrix.os.run-coverage }}
run: "./gradlew check --no-daemon"
- name: Run unit tests and upload coverage
if: ${{ matrix.os.run-coverage }}
uses: paambaati/[email protected]
env:
DISPLAY: ":99.0"
_JAVA_OPTIONS: "-Djava.awt.headless=true -Dtestfx.robot=glass -Dtestfx.headless=true -Dprism.order=sw -Dprism.text=t2k -Dtestfx.setup.timeout=2500 -Dheadless.geometry=1920x1080-64"
GITHUB_SHA: "${{ github.event.pull_request.head.sha }}"
CC_TEST_REPORTER_ID: ${{secrets.codecovToken}}
JACOCO_SOURCE_PATH: |
${{github.workspace}}/app/src/main/kotlin \
${{github.workspace}}/bootstrap/src/main/kotlin \
${{github.workspace}}/lib/configuration/src/main/kotlin \
${{github.workspace}}/lib/helper/src/main/kotlin \
${{github.workspace}}/lib/jsonhelper/src/main/kotlin \
${{github.workspace}}/lib/kafka/src/main/kotlin \
${{github.workspace}}/lib/update/src/main/kotlin
with:
coverageCommand: ./gradlew clean check integrationTest codeCoverageReport --no-daemon
coverageLocations: ${{github.workspace}}/build/reports/jacoco/codeCoverageReport/codeCoverageReport.xml:jacoco
- name: Test build update4j config
if: ${{ matrix.os.run-coverage }}
run: |
./gradlew getDependencySources && \
./gradlew :app:mergeLocalLibs && \
python3 scripts/build.py