-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (61 loc) · 2.13 KB
/
gradle.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
name: Diceware CI with Gradle
on:
workflow_dispatch:
push:
branches:
- main
paths-ignore:
- 'site/**'
permissions:
contents: read
packages: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: |
build
kover
--info
- name: Extract and print coverage
run: |
sudo apt-get update && sudo apt-get install libxml2-utils
covered=$(xmllint --xpath 'string(/report/counter[@type="LINE"]/@covered)' web/build/reports/kover/report.xml)
missed=$(xmllint --xpath 'string(/report/counter[@type="LINE"]/@missed)' web/build/reports/kover/report.xml)
total=$(awk "BEGIN { print 100.0*$covered/($covered+$missed) }")
echo "Total line coverage: $total%"
echo "covered=$covered" >> $GITHUB_OUTPUT
echo "missed=$missed" >> $GITHUB_OUTPUT
echo "coverage_pct=$total" >> $GITHUB_OUTPUT
echo "### Line coverage" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY # this is a blank line
echo "- Covered: $covered" >> $GITHUB_STEP_SUMMARY
echo "- Missed: $missed" >> $GITHUB_STEP_SUMMARY
echo "- Coverage: $total" >> $GITHUB_STEP_SUMMARY
- name: Upload build reports
uses: actions/upload-artifact@v3
with:
name: build-reports
path: |
core/build/reports/
web/build/reports/
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and publish docker image to ghcr.io
run: |
docker build . --tag ghcr.io/yannisf/diceware:latest
docker push ghcr.io/yannisf/diceware:latest