-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.travis.yml
297 lines (295 loc) · 9.42 KB
/
.travis.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
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
# dist: xenial is required to run "multiarch/qemu-user-static -p yes".
# dist: trusty does not work for that.
# I am not sure if the reason is the trusty's Linux kernel is old.
# "multiarch/qemu-user-static" image uses Linux kernel feature binfmt_misc
# in it.
dist: xenial
# This means your current language mode.
language: c
services: docker
os: linux
# Definitions using YAML's anchor (&) and reference (*).
.com.github.junaruga.ci-multi-arch-test.matrix-definitions:
# Recommended way 1. It's easy to implement.
# But the way using "-p yes" (binfmt_misc persistent option)
# might be slower than below alternative ways.
- &test_in_container
# language: bash or generic is good to run container.
language: bash
install:
- ls /proc/sys/fs/binfmt_misc/
- |
if [ "$(uname -m)" = x86_64 ]; then
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
fi
- ls /proc/sys/fs/binfmt_misc/
- |
travis_retry docker build --rm -t sample \
--build-arg BASE_IMAGE=${BASE_IMAGE} \
-f Dockerfile-${OS_NAME} \
.
script:
- docker run --rm -t sample ./sample_test.sh
# A case to check only "uname"'s result without building a container.
- &test_simple_in_container
language: bash
install:
- ls /proc/sys/fs/binfmt_misc/
- docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- ls /proc/sys/fs/binfmt_misc/
script:
- docker run --rm -t "${BASE_IMAGE}" uname -a
# Recommended way 2. This way does not use binfmt_misc persistent option.
# It uses multiarch/qemu-user-static:$arch container in Dockerfile.
- &test_in_container_qemu_interpreter
language: bash
install:
- ls /proc/sys/fs/binfmt_misc/
- docker run --rm --privileged multiarch/qemu-user-static:register --reset
- ls /proc/sys/fs/binfmt_misc/
- |
travis_retry docker build --rm -t sample \
--build-arg ARCH=${ARCH} \
--build-arg BASE_IMAGE=${BASE_IMAGE} \
-f Dockerfile-${OS_NAME} \
.
script:
- docker run --rm -t sample ./sample_test.sh
# The way to use compatible os images (multiarch's ubuntu image etc) is deprecated.
# But it might be faster than above recommended ways.
- &test_in_container_compatible_image
language: bash
install:
- ls /proc/sys/fs/binfmt_misc/
- docker run --rm --privileged multiarch/qemu-user-static:register --reset
- ls /proc/sys/fs/binfmt_misc/
- |
travis_retry docker build --rm -t sample \
--build-arg BASE_IMAGE=${BASE_IMAGE} \
-f Dockerfile-${OS_NAME} \
.
script:
- docker run --rm -t sample ./sample_test.sh
- &inspect_image
addons:
apt:
config:
retries: true
update: true
sources:
- sourceline: 'ppa:projectatomic/ppa'
packages:
- jq
- skopeo
before_install:
- BASE_IMAGE="$BASE_IMAGE@$(script/print-manifest-arch-digest.sh "$BASE_IMAGE" "$MANIFEST_ARCH")"
matrix:
include:
# Intel, 64-bit, Little-endian
- name: ubuntu-x86_64-linux-native
# Intel, 32-bit, Little-endian
- name: ubuntu-i386-linux
# A container job with QEMU takes more running time (2 ~ 4 times).
# You can run non-important job only for cron mode
# or any specific environment variable (ex: CI_CRON: 1) is set,
# avoiding to run it at pull-request timing.
# if: type = cron or CI_CRON = 1
# if: type = cron
env:
- BASE_IMAGE=i386/ubuntu
<<: *test_in_container
- name: ubuntu-i386-linux-qemu-interpreter
env:
- ARCH=i386
- BASE_IMAGE=i386/ubuntu
- OS_NAME=ubuntu-qemu
<<: *test_in_container_qemu_interpreter
- name: ubuntu-i386-linux-compatible-image
env:
- BASE_IMAGE=multiarch/ubuntu-debootstrap:i386-bionic
<<: *test_in_container_compatible_image
# ARM, 64-bit, Little-endian
- name: ubuntu-aarch64-linux-native
arch: arm64
- name: ubuntu-aarch64-linux
env:
- BASE_IMAGE=arm64v8/ubuntu
<<: *test_in_container
- name: ubuntu-aarch64-linux-qemu-interpreter
env:
- ARCH=aarch64
- BASE_IMAGE=arm64v8/ubuntu
- OS_NAME=ubuntu-qemu
<<: *test_in_container_qemu_interpreter
- name: ubuntu-aarch64-linux-compatible-image
env:
- BASE_IMAGE=multiarch/ubuntu-debootstrap:arm64-bionic
<<: *test_in_container_compatible_image
# ARM, 32-bit, Little-endian
- name: ubuntu-arm32-linux
env:
- BASE_IMAGE=arm32v7/ubuntu
<<: *test_in_container
- name: ubuntu-arm32-linux-qemu-interpreter
env:
- ARCH=arm
- BASE_IMAGE=arm32v7/ubuntu
- OS_NAME=ubuntu-qemu
<<: *test_in_container_qemu_interpreter
- name: ubuntu-arm32-linux-compatible-image
env:
- BASE_IMAGE=multiarch/ubuntu-debootstrap:armhf-bionic
<<: *test_in_container_compatible_image
# PowerPC, 64-bit, Little-endian
- name: ubuntu-ppc64le-linux
env:
- BASE_IMAGE=ppc64le/ubuntu
<<: *test_in_container
- name: ubuntu-ppc64le-linux-native
os: linux-ppc64le
# IBM Z and LinuxONE, 64-bit, Big-endian
- name: ubuntu-s390x-linux
env:
- BASE_IMAGE=s390x/ubuntu
<<: *test_in_container
- name: ubuntu-s390x-linux-simple
env:
- BASE_IMAGE=s390x/ubuntu
<<: *test_simple_in_container
- name: ubuntu-s390x-linux-qemu-interpreter
env:
- ARCH=s390x
- BASE_IMAGE=s390x/ubuntu
- OS_NAME=ubuntu-qemu
<<: *test_in_container_qemu_interpreter
# PowerPC, 64-bit, Big-endian
- name: ubuntu-ppc64-linux-compatible-image
env:
- BASE_IMAGE=multiarch/ubuntu-debootstrap:powerpc-xenial
<<: *test_in_container_compatible_image
# Intel, 32-bit, Little-endian
- name: debian-i386-linux
env:
- BASE_IMAGE=i386/debian
- OS_NAME=debian
<<: *test_in_container
# ARM, 64-bit, Little-endian
- name: debian-aarch64-linux
env:
- BASE_IMAGE=arm64v8/debian
- OS_NAME=debian
<<: *test_in_container
# ARM, 32-bit, Little-endian
- name: debian-arm32-linux
env:
- BASE_IMAGE=arm32v7/debian
- OS_NAME=debian
<<: *test_in_container
# PowerPC, 64-bit, Little-endian
- name: debian-ppc64le-linux
env:
- BASE_IMAGE=ppc64le/debian
- OS_NAME=debian
<<: *test_in_container
# IBM Z and LinuxONE, 64-bit, Big-endian
- name: debian-s390x-linux
env:
- BASE_IMAGE=s390x/debian
- OS_NAME=debian
<<: *test_in_container
# Intel, 32-bit, Little-endian
- name: centos-i386-linux
env:
- BASE_IMAGE=i386/centos
- OS_NAME=centos
<<: *test_in_container
# ARM, 64-bit, Little-endian
- name: centos-aarch64-linux
env:
- BASE_IMAGE=arm64v8/centos
- OS_NAME=centos
<<: *test_in_container
# PowerPC, 64-bit, Little-endian
- name: centos-ppc64le-linux
env:
- BASE_IMAGE=ppc64le/centos
- OS_NAME=centos
<<: *test_in_container
# ARM, 64-bit, Little-endian
- name: fedora-aarch64-linux
env:
- BASE_IMAGE=arm64v8/fedora
- OS_NAME=fedora
<<: *test_in_container
# PowerPC, 64-bit, Little-endian
- name: fedora-ppc64le-linux
env:
- BASE_IMAGE=ppc64le/fedora
- OS_NAME=fedora
<<: *test_in_container
# PowerPC, 64-bit, Big-endian
- name: fedora-s390x-linux
env:
- BASE_IMAGE=s390x/fedora
- OS_NAME=fedora
<<: *test_in_container
# Intel, 64-bit, Little-endian
- name: rhel-x86_64-linux-native
env:
- BASE_IMAGE=registry.access.redhat.com/ubi8:8.0
- OS_NAME=rhel
<<: *test_in_container
# ARM, 64-bit, Little-endian
- name: rhel-aarch64-linux
env:
- BASE_IMAGE=registry.access.redhat.com/ubi8:8.0
- OS_NAME=rhel
- MANIFEST_ARCH=arm64
<<: *inspect_image
<<: *test_in_container
# PowerPC, 64-bit, Little-endian
- name: rhel-ppc64le-linux-native
os: linux-ppc64le
env:
- BASE_IMAGE=registry.access.redhat.com/ubi8:8.0
- OS_NAME=rhel
<<: *test_in_container
# "dnf -y update" ouptuts an error:
# "qemu: uncaught target signal 11 (Segmentation fault) - core dumped"
# - name: rhel-ppc64le-linux
# env:
# - BASE_IMAGE=registry.access.redhat.com/ubi8:8.0
# - OS_NAME=rhel
# - MANIFEST_ARCH=ppc64le
# <<: *inspect_image
# <<: *test_in_container
# IBM Z and LinuxONE, 64-bit, Big-endian
- name: rhel-s390x-linux
env:
- BASE_IMAGE=registry.access.redhat.com/ubi8:8.0
- OS_NAME=rhel
- MANIFEST_ARCH=s390x
<<: *inspect_image
<<: *test_in_container
allow_failures:
# `dnf update` on QEMU outputs core dump.
# https://travis-ci.org/junaruga/ci-multi-arch-test/jobs/617843947#L238
- name: fedora-ppc64le-linux
# No package epel-release available.
# https://travis-ci.org/junaruga/ci-multi-arch-test/jobs/568490418
- name: centos-i386-linux
fast_finish: true
before_install:
# Show environment.
- uname -a
- id
- pwd
- "OS_NAME=${OS_NAME:-ubuntu}"
- echo OS_NAME=${OS_NAME} BASE_IMAGE=${BASE_IMAGE}
# Logic without container and QEMU.
# This means your current logic.
install: true
script: ./sample_test.sh
branches:
only:
- master