-
Notifications
You must be signed in to change notification settings - Fork 165
157 lines (153 loc) · 5.48 KB
/
build-and-check.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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: Build and check
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
build-jvm-matrix:
runs-on: ubuntu-latest
steps: # https://michaelheap.com/dynamic-matrix-generation-github-actions/
- id: set-matrix
run: echo "::set-output name=version_matrix::$(curl https://endoflife.date/api/oracle-jdk.json | jq -c '[.[] | select(.extendedSupport > (now | strftime("%Y-%m-%d"))) | .cycle]' | sed 's/ //g')"
- name: verify-matrix
run: echo "The selected java versions are ${{ steps.set-matrix.outputs.version_matrix }}"
outputs:
version_matrix: ${{ steps.set-matrix.outputs.version_matrix }}
build:
needs: build-jvm-matrix
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
java_version: ${{ fromJson(needs.build-jvm-matrix.outputs.version_matrix) }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4.2.2
- name: configure windows pagefile
if: ${{ matrix.os == 'windows-latest' }}
uses: al-cheb/configure-pagefile-action@v1.4
with:
minimum-size: 8GB
maximum-size: 8GB
disk-root: "D:"
- name: set up JDK
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java_version }}
distribution: 'zulu'
- name: Restore Gradle caches
uses: actions/cache@v4
with:
path: |
~/.gradle/caches/modules-2
~/.gradle/caches/files-2.1
~/.gradle/caches/metadata-2.96
key: ${{ runner.os }}-gradle-cache-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('**/gradle.properties') }}
restore-keys: |
${{ runner.os }}-gradle-cache-
# Inspired by https://github.com/actions/cache/issues/432#issuecomment-740376179
- name: Restore TestKit cache
uses: actions/cache@v4
with:
path: |
plugin/.gradle-test-kit/caches/modules-2
plugin/.gradle-test-kit/caches/files-2.1
plugin/.gradle-test-kit/caches/metadata-2.96
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradlew') }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradlew') }}-
${{ runner.os }}-gradle-wrapper-
- name: Restore Gradle wrapper
uses: actions/cache@v4
with:
path: |
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradlew') }}
restore-keys: |
${{ runner.os }}-gradle-wrapper-
- name: Build plugin
run: ./plugin/gradlew -p ./plugin assemble ensureDependenciesAreInlined test --no-daemon
- name: Upload test results
uses: actions/upload-artifact@v4.4.3
if: failure()
with:
name: test-results-${{ runner.os }}
path: plugin/build/reports/tests/test/
- name: Upload Memory Dump
uses: actions/upload-artifact@v4.4.3
if: failure()
with:
name: memory-dump-${{ runner.os }}
path: |
hs_err_pid*
replay_pid*
plugin/hs_err_pid*
plugin/replay_pid*
- name: Check plugin codestyle
run: ./plugin/gradlew -p ./plugin ktlintCheck --no-daemon
check_bashisms:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4.2.2
- name: set up JDK 11
uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'zulu'
- name: update apt
run: sudo apt update
- name: Install lintian
run: sudo apt install -qq lintian
- name: Install libdistro
run: sudo apt install -qq libdistro-info-perl
- name: Install checkbashisms
run: sudo apt-get install -qq devscripts
- name: Restore Gradle caches
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-cache-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('**/gradle.properties') }}
restore-keys: |
${{ runner.os }}-gradle-cache-
- name: Restore Gradle wrapper
uses: actions/cache@v4
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradlew') }}
restore-keys: |
${{ runner.os }}-gradle-wrapper-
- name: Check git bashisms
run: ./gradlew addKtlintCheckGitPreCommitHook --no-daemon && checkbashisms .git/hooks/pre-commit
check_samples:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
needs: build
steps:
- uses: actions/checkout@v4.2.2
- name: set up JDK 1.8
uses: actions/setup-java@v4
with:
java-version: 8
distribution: 'zulu'
- name: Restore Gradle caches
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-cache-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('**/gradle.properties') }}
restore-keys: |
${{ runner.os }}-gradle-cache-
- name: Restore Gradle wrapper
uses: actions/cache@v4
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradlew') }}
restore-keys: |
${{ runner.os }}-gradle-wrapper-
- name: Check ktlint-plugin on samples
run: ./gradlew ktlintCheck --no-daemon