-
Notifications
You must be signed in to change notification settings - Fork 0
136 lines (112 loc) · 3.6 KB
/
ci.yaml
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: CI
on:
- pull_request
- push
- workflow_dispatch
env:
JDK_VERSION: "23"
WORKSPACE_ARCHIVE: workspace.tar
WORKSPACE_ARTIFACT: build-results
jobs:
build:
name: Build
strategy:
matrix:
os: [ macos-latest, ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: ${{ env.JDK_VERSION }}
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Gradle Assemble
run: ./gradlew assemble --info -S --show-version
- name: Tar files
run: tar --exclude='.git' --exclude=${{ env.WORKSPACE_ARCHIVE }} -cvf ${{ env.WORKSPACE_ARCHIVE }} .
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-${{ env.WORKSPACE_ARTIFACT }}
path: ${{ env.WORKSPACE_ARCHIVE }}
retention-days: 1
build-docs:
name: Build Documentation
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/download-artifact@v4
with:
name: ubuntu-latest-${{ env.WORKSPACE_ARTIFACT }}
path: .
- name: Untar
run: |
tar -xvf ${{ env.WORKSPACE_ARCHIVE }}
rm ${{ env.WORKSPACE_ARCHIVE }}
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: ${{ env.JDK_VERSION }}
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Dokka Generate
run: ./gradlew dokkaGenerate --info -S --show-version
check:
name: Check
strategy:
matrix:
os: [ macos-latest, ubuntu-latest, windows-latest ]
needs: build
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/download-artifact@v4
with:
# https://github.com/actions/runner/issues/409#issuecomment-752775072
name: ${{ matrix.os == 'windows-latest' && 'ubuntu-latest' || matrix.os }}-${{ env.WORKSPACE_ARTIFACT }}
path: .
- name: Untar
run: |
tar -xvf ${{ env.WORKSPACE_ARCHIVE }}
rm ${{ env.WORKSPACE_ARCHIVE }}
- uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: ${{ env.JDK_VERSION }}
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Gradle Check
run: ./gradlew check --info -S --show-version
# So, what's happening here?
#
# Basically, restoring the workspace state between jobs is incredibly annoying.
# We can get reasonable support by using the upload-/download-artifact
# actions, but they suffer from a severe limitation:
# GH Actions has a storage limit and the minimum retention is 24 hours...
#
# Since the storage quota is limited, we have to make sure that the artifact
# is removed. Unfortunately, there is no official way to do this, so we resort
# to a third party action for now.
#
# See also: https://github.com/actions/upload-artifact/issues/290
cleanup:
name: Cleanup
if: ${{ always() }}
needs: [check]
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- name: Cleanup
uses: GeekyEggo/delete-artifact@24928e75e6e6590170563b8ddae9fac674508aa1
with:
name: macos-latest-${{ env.WORKSPACE_ARTIFACT }}
- name: Cleanup
uses: GeekyEggo/delete-artifact@24928e75e6e6590170563b8ddae9fac674508aa1
with:
name: ubuntu-latest-${{ env.WORKSPACE_ARTIFACT }}