-
Notifications
You must be signed in to change notification settings - Fork 5
209 lines (182 loc) · 6.19 KB
/
builds.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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
# SPDX-FileCopyrightText: Copyright 2022 Micron Technology, Inc.
name: Builds
on:
release:
types: [created]
push:
branches:
- master
- "v[0-9]+.[0-9]+"
paths:
- "**.c"
- "**.h"
- "**.java"
- "**/meson.build"
- "subprojects/*.wrap"
- "cross/*.ini"
- .github/workflows/builds.yaml
- meson_options.txt
- pom.xml
- VERSION
pull_request:
types: [opened, synchronize, reopened]
paths:
- "**.c"
- "**.h"
- "**.java"
- "**/meson.build"
- "subprojects/*.wrap"
- "cross/*.ini"
- .github/workflows/builds.yaml
- meson_options.txt
- pom.xml
- VERSION
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
permissions:
packages: read
env:
MESON_TESTTHREADS: 1
jobs:
determine-tag:
runs-on: ubuntu-latest
continue-on-error: false
outputs:
tag: ${{ steps.determine-tag.outputs.tag }}
steps:
- name: Determine tag
id: determine-tag
run: |
if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
echo "tag=$GITHUB_BASE_REF" >> "$GITHUB_OUTPUT"
else
echo "tag=$GITHUB_REF_NAME" >> "$GITHUB_OUTPUT"
fi
normal:
runs-on: ubuntu-latest
needs:
- determine-tag
container:
image: ghcr.io/hse-project/ci-images/${{ matrix.image }}:${{ needs.determine-tag.outputs.tag }}
strategy:
fail-fast: false
matrix:
image:
- almalinux-8
- almalinux-9
- cross-s390x
- fedora-37
- ubuntu-18.04
- ubuntu-20.04
- ubuntu-22.04
buildtype: [release, debug]
steps:
- name: To skip or not to skip
id: to-skip
shell: sh +e {0}
run: |
skip="false"
echo "${{ matrix.image }}" | grep -P --quiet "(almalinux-8|almalinux-9|ubuntu-20.04|ubuntu-22.04)"
if [ $? -eq 0 ] && [ "$GITHUB_EVENT_NAME" != "release" ]; then
skip="true"
fi
echo "skip=$skip" >> "$GITHUB_OUTPUT"
- name: Checkout hse-java
if: ${{ steps.to-skip.outputs.skip == 'false' }}
uses: actions/checkout@v3
- name: Determine branches
id: determine-branches
if: ${{ steps.to-skip.outputs.skip == 'false' }}
shell: sh +e {0}
run: |
for p in hse; do
branch=master
if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
git ls-remote --exit-code --heads \
"https://github.com/hse-project/$p.git" "$GITHUB_HEAD_REF" \
> /dev/null
if [ $? -eq 0 ]; then
branch="$GITHUB_HEAD_REF"
fi
elif [ "$GITHUB_EVENT_NAME" = "release" ]; then
branch="$GITHUB_REF_NAME"
else
git ls-remote --exit-code --heads \
"https://github.com/hse-project/$p.git" "$GITHUB_REF" \
> /dev/null
if [ $? -eq 0 ]; then
branch="$GITHUB_REF_NAME"
fi
fi
echo "$p=$branch" >> "$GITHUB_OUTPUT"
done
- name: Checkout HSE
if: ${{ steps.to-skip.outputs.skip == 'false' }}
uses: actions/checkout@v3
with:
repository: hse-project/hse
path: subprojects/hse
ref: ${{ steps.determine-branches.outputs.hse }}
- name: Export Maven local repository
id: maven-local-repository
if: ${{ steps.to-skip.outputs.skip == 'false' }}
run: |
local_repository=$(mvn help:evaluate -Dexpression=settings.localRepository --quiet -DforceStdout)
echo "local-repository=$local_repository" >> "$GITHUB_OUTPUT"
- name: Cache Maven dependencies
id: maven-dependencies
if: ${{ steps.to-skip.outputs.skip == 'false' }}
uses: actions/cache@v3
with:
path: ${{ steps.maven-local-repository.outputs.local-repository }}
key: maven-dependencies-${{ hashFiles('pom.xml') }}
# Download all dependencies up front if cache wasn't hit. Will keep
# Maven from downloading dependencies during the test phase which could
# cause tests to timeout.
- name: Download Maven dependencies
if: ${{ steps.to-skip.outputs.skip == 'false' && steps.maven-dependencies.outputs.cache-hit != 'true' }}
run: |
mvn dependency:go-offline
- name: Cache Meson packagecache
if: ${{ steps.to-skip.outputs.skip == 'false' }}
id: meson-packagecache
uses: actions/cache@v3
with:
path: subprojects/packagecache
key: meson-packagecache-${{ matrix.image }}-${{ hashFiles('subprojects/hse/subprojects/*.wrap') }}
- name: Export cross arguments
if: ${{ steps.to-skip.outputs.skip == 'false' && startsWith(matrix.image, 'cross') }}
run: |
image="${{ matrix.image }}"
echo "CROSS_ARGS=--cross-file cross/${image##*-}.ini --cross-file cross/common.ini" >> "$GITHUB_ENV"
- name: Setup
if: ${{ steps.to-skip.outputs.skip == 'false' }}
run: |
MESON_ARGS=
if [ "${{ matrix.image }}" = "ubuntu-18.04" ]; then
# javadoc is not available on Ubuntu 18.04
MESON_ARGS="-Ddocs=false"
fi
meson setup builddir --fatal-meson-warnings $MESON_ARGS \
--buildtype=${{ matrix.buildtype }} $CROSS_ARGS --werror
- name: Build
if: ${{ steps.to-skip.outputs.skip == 'false' }}
run: |
DOCS_TARGET=
if [ "${{ matrix.image }}" != "ubuntu-18.04" ]; then
# javadoc is not available on Ubuntu 18.04
DOCS_TARGET="docs/apidocs"
fi
ninja -C builddir all $DOCS_TARGET
- name: Test
if: ${{ steps.to-skip.outputs.skip == 'false' && !startsWith(matrix.image, 'cross') }}
run: |
meson test -C builddir --setup=ci --print-errorlogs --no-stdsplit
- uses: actions/upload-artifact@v4
if: failure()
with:
name: ${{ matrix.image }}-${{ matrix.buildtype }}
path: builddir/meson-logs/