-
Notifications
You must be signed in to change notification settings - Fork 1
136 lines (111 loc) · 3.53 KB
/
build.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Build
on:
push:
branches:
- main
pull_request:
jobs:
check-code-style:
name: Check code style
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download ktlint binary
run: |
curl -sSLO https://github.com/pinterest/ktlint/releases/download/0.48.2/ktlint
chmod +x ktlint
- name: Run ktlint
run: ./ktlint --editorconfig=".editorconfig"
run-tests:
name: Run tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
- name: Run tests
run: ./gradlew test
- name: Upload coverage.csv file
uses: actions/upload-artifact@v3
with:
name: coverage.csv
path: build/reports/coverage/coverage.csv
build-linux:
name: Build Linux
needs: [ check-code-style, run-tests ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
- name: Setup version variable
run: echo "VERSION=$(grep '^version=' src/main/resources/version.properties | cut -d= -f2)" >> $GITHUB_ENV
- name: Build debug jar
run: ./gradlew packageUberJarForCurrentOS
- name: Store jar file
uses: actions/upload-artifact@v3
with:
name: autokpass-linux-x64-${{env.VERSION}}.jar
path: ./build/compose/jars/autokpass-linux-x64-${{env.VERSION}}.jar
build-macos:
name: Build macOS
needs: [ check-code-style, run-tests ]
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
- name: Set environment variables
run: echo "VERSION=$(grep '^version=' src/main/resources/version.properties | cut -d= -f2)" >> $GITHUB_ENV
- name: Build dmg file
run: ./gradlew packageDmg
- name: Build debug jar
run: ./gradlew packageUberJarForCurrentOS
- name: Store dmg file
uses: actions/upload-artifact@v3
with:
name: autokpass-${{env.VERSION}}.dmg
path: ./build/compose/binaries/main/dmg/autokpass-${{env.VERSION}}.dmg
- name: Store jar file
uses: actions/upload-artifact@v3
with:
name: autokpass-macos-x64-${{env.VERSION}}.jar
path: ./build/compose/jars/autokpass-macos-x64-${{env.VERSION}}.jar
create-coverage-badge:
name: Create coverage badge
needs: [ build-linux, build-macos ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get coverage.csv
uses: actions/download-artifact@v3
with:
name: coverage.csv
path: artifacts
- name: Create JaCoCo Badge
id: jacoco
uses: cicirello/[email protected]
with:
jacoco-csv-file: artifacts/coverage.csv
badges-directory: .github/badges
generate-coverage-badge: true
- name: Log coverage percentage
run: |
echo "coverage = ${{steps.jacoco.outputs.coverage}}"
- name: Commit and push the badge (if it changed)
uses: EndBug/add-and-commit@v7
with:
default_author: github_actions
message: 'Commit coverage badge'
add: '*.svg'