| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100 |
- # -----------------------------------------------------------------------------
- # This file is part of the xPack distribution.
- # (https://xpack.github.io)
- # Copyright (c) 2020 Liviu Ionescu.
- #
- # Permission to use, copy, modify, and/or distribute this software
- # for any purpose is hereby granted, under the terms of the MIT license.
- # -----------------------------------------------------------------------------
- # Helper script used in the tests.
- # -----------------------------------------------------------------------------
- # https://github.com/docker-library/official-images#architectures-other-than-amd64
- # - https://hub.docker.com/_/ubuntu
- # - https://hub.docker.com/r/i386/ubuntu/
- # - https://hub.docker.com/r/arm32v7/ubuntu
- # - https://hub.docker.com/_/debian
- # - https://hub.docker.com/r/i386/debian
- # - https://hub.docker.com/r/arm32v7/debian
- # - https://hub.docker.com/_/centos
- # - https://hub.docker.com/r/i386/centos
- # - https://hub.docker.com/r/opensuse/tumbleweed
- # - https://hub.docker.com/_/fedora
- # - https://hub.docker.com/_/archlinux
- # - https://hub.docker.com/u/manjarolinux
- # - https://hub.docker.com/r/gentoo/portage
- # "i386/ubuntu:20.04" # Fails to install prerequisites
- # "i386/ubuntu:12.04" --skip-gdb-py # Not available
- # "i386/centos:8" # not available
- # arm32v7/fedora:29 - Error: Failed to synchronize cache for repo 'fedora-modular'
- # arm32v7/fedora:27 - Error: Failed to synchronize cache for repo 'fedora-modular'
- # arm32v7/fedora:25 - KeyError: 'armv8l'
- # Debian versions: 8 jessie, 9 stretch, 10 buster.
- function create_stable_data_file()
- {
- local message="$1"
- local branch="$2"
- local base_url="$3"
- local data_file_path="$4"
- # Note: __EOF__ is NOT quoted to allow substitutions.
- cat <<__EOF__ > "${data_file_path}"
- {
- "request": {
- "message": "${message}",
- "branch": "${branch}",
- "config": {
- "merge_mode": "replace",
- "jobs": [
- {
- "name": "Ubuntu 12, 14, 16, 18, 20 (Intel 64-bit)",
- "os": "linux",
- "arch": "amd64",
- "dist": "bionic",
- "services": [ "docker" ],
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh ubuntu:20.04 ${base_url} ",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh ubuntu:18.04 ${base_url} ",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh ubuntu:16.04 ${base_url} ",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh ubuntu:14.04 ${base_url} ",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh ubuntu:12.04 ${base_url} "
- ]
- },
- {
- "name": "Ubuntu 14, 16, 18 (Intel 32-bit)",
- "os": "linux",
- "arch": "amd64",
- "dist": "bionic",
- "services": [ "docker" ],
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh --32 i386/ubuntu:18.04 ${base_url} ",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh --32 i386/ubuntu:16.04 ${base_url} ",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh --32 i386/ubuntu:14.04 ${base_url} "
- ]
- },
- {
- "name": "Ubuntu 16, 18, 20 (Arm 64-bit)",
- "os": "linux",
- "arch": "arm64",
- "dist": "bionic",
- "services": [ "docker" ],
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh ubuntu:20.04 ${base_url} ",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh ubuntu:18.04 ${base_url} ",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh ubuntu:16.04 ${base_url} "
- ]
- },
- {
- "name": "Ubuntu 16, 18 (Arm 32-bit)",
- "os": "linux",
- "arch": "arm64",
- "dist": "bionic",
- "services": [ "docker" ],
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh --32 arm32v7/ubuntu:18.04 ${base_url} ",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh --32 arm32v7/ubuntu:16.04 ${base_url} "
- ]
- },
- {
- "name": "Debian 8, 9, 10 (Intel 64-bit)",
- "os": "linux",
- "arch": "amd64",
- "dist": "bionic",
- "services": [ "docker" ],
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh debian:buster ${base_url} ",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh debian:stretch ${base_url} ",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh debian:jessie ${base_url} "
- ]
- },
- {
- "name": "Debian 8, 9, 10 (Intel 32-bit)",
- "os": "linux",
- "arch": "amd64",
- "dist": "bionic",
- "services": [ "docker" ],
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh --32 i386/debian:buster ${base_url} ",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh --32 i386/debian:stretch ${base_url} ",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh --32 i386/debian:jessie ${base_url} "
- ]
- },
- {
- "name": "Debian 9, 10 (Arm 64-bit)",
- "os": "linux",
- "arch": "arm64",
- "dist": "bionic",
- "services": [ "docker" ],
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh debian:buster ${base_url} ",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh debian:stretch ${base_url} "
- ]
- },
- {
- "name": "Debian 9, 10 (Arm 32-bit)",
- "os": "linux",
- "arch": "arm64",
- "dist": "bionic",
- "services": [ "docker" ],
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh --32 arm32v7/debian:buster ${base_url} ",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh --32 arm32v7/debian:stretch ${base_url} "
- ]
- },
- {
- "name": "CentOS 7, 8 (Intel 64-bit)",
- "os": "linux",
- "arch": "amd64",
- "dist": "bionic",
- "services": [ "docker" ],
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh centos:8 ${base_url} ",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh centos:7 ${base_url} "
- ]
- },
- {
- "name": "CentOS 7 (Intel 32-bit)",
- "os": "linux",
- "arch": "amd64",
- "dist": "bionic",
- "services": [ "docker" ],
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh --32 i386/centos:7 ${base_url} "
- ]
- },
- {
- "name": "CentOS 7, 8 (Arm 64-bit)",
- "os": "linux",
- "arch": "arm64",
- "dist": "bionic",
- "services": [ "docker" ],
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh centos:8 ${base_url} ",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh centos:7 ${base_url} "
- ]
- },
- {
- "name": "OpenSUSE 13, 15 (Intel 64-bit)",
- "os": "linux",
- "arch": "amd64",
- "dist": "bionic",
- "services": [ "docker" ],
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh opensuse/leap:15 ${base_url} ",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh opensuse/amd64:13.2 ${base_url} "
- ]
- },
- {
- "name": "OpenSUSE 15 (Arm 64-bit)",
- "os": "linux",
- "arch": "arm64",
- "dist": "bionic",
- "services": [ "docker" ],
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh opensuse/leap:15 ${base_url} "
- ]
- },
- {
- "name": "Fedora 20, 25, 27, 29, 31 (Intel 64-bit)",
- "os": "linux",
- "arch": "amd64",
- "dist": "bionic",
- "services": [ "docker" ],
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh fedora:31 ${base_url} ",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh fedora:29 ${base_url} ",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh fedora:27 ${base_url} ",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh fedora:25 ${base_url} ",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh fedora:20 ${base_url} "
- ]
- },
- {
- "name": "Fedora 27, 29, 31 (Arm 64-bit)",
- "os": "linux",
- "arch": "arm64",
- "dist": "bionic",
- "services": [ "docker" ],
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh fedora:31 ${base_url} ",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh fedora:29 ${base_url} ",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh fedora:27 ${base_url} "
- ]
- },
- {
- "name": "Raspbian 8, 9 (Arm 32-bit)",
- "os": "linux",
- "arch": "arm64",
- "dist": "bionic",
- "services": [ "docker" ],
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh --32 raspbian/stretch ${base_url} ",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh --32 raspbian/jessie ${base_url} "
- ]
- },
- {
- "name": "macOS 10.15 Intel",
- "os": "osx",
- "arch": "amd64",
- "osx_image": "xcode11.5",
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/native-test.sh ${base_url}"
- ]
- },
- {
- "name": "macOS 10.14 Intel",
- "os": "osx",
- "arch": "amd64",
- "osx_image": "xcode11.3",
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/native-test.sh ${base_url}"
- ]
- },
- {
- "name": "macOS 10.13 Intel",
- "os": "osx",
- "arch": "amd64",
- "osx_image": "xcode10.1",
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/native-test.sh ${base_url}"
- ]
- },
- {
- "name": "macOS 10.12 Intel",
- "os": "osx",
- "arch": "amd64",
- "osx_image": "xcode9.2",
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/native-test.sh ${base_url}"
- ]
- },
- {
- "name": "macOS 10.11 Intel",
- "os": "osx",
- "arch": "amd64",
- "osx_image": "xcode8",
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/native-test.sh ${base_url}"
- ]
- },
- {
- "name": "macOS 10.10 Intel",
- "os": "osx",
- "arch": "amd64",
- "osx_image": "xcode6.4",
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/native-test.sh ${base_url}"
- ]
- },
- {
- "name": "Windows 10 (Intel 64-bit)",
- "os": "windows",
- "arch": "amd64",
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/native-test.sh ${base_url} "
- ]
- },
- {
- "name": "Windows 10 (Intel 32-bit)",
- "os": "windows",
- "arch": "amd64",
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/native-test.sh --32 ${base_url} "
- ]
- }
- ],
- "notifications": {
- "email": {
- "on_success": "always",
- "on_failure": "always"
- }
- }
- }
- }
- }
- __EOF__
- }
- function create_latest_data_file()
- {
- local message="$1"
- local branch="$2"
- local base_url="$3"
- local data_file_path="$4"
- # Note: __EOF__ is NOT quoted to allow substitutions.
- cat <<__EOF__ > "${data_file_path}"
- {
- "request": {
- "message": "${message}",
- "branch": "${branch}",
- "config": {
- "merge_mode": "replace",
- "jobs": [
- {
- "name": "Ubuntu rolling, latest (Intel 64-bit)",
- "os": "linux",
- "arch": "amd64",
- "dist": "bionic",
- "services": [ "docker" ],
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh ubuntu:latest ${base_url} ",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh ubuntu:rolling ${base_url} "
- ]
- },
- {
- "name": "Ubuntu rolling, latest (Intel 32-bit)",
- "os": "linux",
- "arch": "amd64",
- "dist": "bionic",
- "services": [ "docker" ],
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh --32 i386/ubuntu:latest ${base_url} ",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh --32 i386/ubuntu:rolling ${base_url} "
- ]
- },
- {
- "name": "Ubuntu rolling, latest (Arm 64-bit)",
- "os": "linux",
- "arch": "arm64",
- "dist": "bionic",
- "services": [ "docker" ],
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh ubuntu:latest ${base_url} ",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh ubuntu:rolling ${base_url} "
- ]
- },
- {
- "name": "Ubuntu rolling, latest (Arm 32-bit)",
- "os": "linux",
- "arch": "arm64",
- "dist": "bionic",
- "services": [ "docker" ],
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh --32 arm32v7/ubuntu:latest ${base_url} ",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh --32 arm32v7/ubuntu:rolling ${base_url} "
- ]
- },
- {
- "name": "Debian latet, testing (Intel 64-bit)",
- "os": "linux",
- "arch": "amd64",
- "dist": "bionic",
- "services": [ "docker" ],
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh debian:testing ${base_url} ",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh debian:latest ${base_url} "
- ]
- },
- {
- "name": "Debian testing (Intel 32-bit)",
- "os": "linux",
- "arch": "amd64",
- "dist": "bionic",
- "services": [ "docker" ],
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh --32 i386/debian:testing ${base_url} "
- ]
- },
- {
- "name": "Debian latest, testing (Arm 64-bit)",
- "os": "linux",
- "arch": "arm64",
- "dist": "bionic",
- "services": [ "docker" ],
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh debian:testing ${base_url} ",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh debian:latest ${base_url} "
- ]
- },
- {
- "name": "Debian testing (Arm 32-bit)",
- "os": "linux",
- "arch": "arm64",
- "dist": "bionic",
- "services": [ "docker" ],
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh --32 arm32v7/debian:testing ${base_url} "
- ]
- },
- {
- "name": "CentOS latest (Intel 64-bit)",
- "os": "linux",
- "arch": "amd64",
- "dist": "bionic",
- "services": [ "docker" ],
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh centos:latest ${base_url} "
- ]
- },
- {
- "name": "CentOS latest (Intel 32-bit)",
- "os": "linux",
- "arch": "amd64",
- "dist": "bionic",
- "services": [ "docker" ],
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh --32 i386/centos:latest ${base_url} "
- ]
- },
- {
- "name": "CentOS latest (Arm 64-bit)",
- "os": "linux",
- "arch": "arm64",
- "dist": "bionic",
- "services": [ "docker" ],
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh centos:latest ${base_url} "
- ]
- },
- {
- "name": "OpenSUSE tumbleweed (Intel 64-bit)",
- "os": "linux",
- "arch": "amd64",
- "dist": "bionic",
- "services": [ "docker" ],
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh opensuse/tumbleweed ${base_url} "
- ]
- },
- {
- "name": "OpenSUSE tumbleweed (Arm 64-bit)",
- "os": "linux",
- "arch": "arm64",
- "dist": "bionic",
- "services": [ "docker" ],
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh opensuse/tumbleweed ${base_url} "
- ]
- },
- {
- "name": "Fedora latest, rawhide (Intel 64-bit)",
- "os": "linux",
- "arch": "amd64",
- "dist": "bionic",
- "services": [ "docker" ],
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh fedora:rawhide ${base_url} ",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh fedora:latest ${base_url} "
- ]
- },
- {
- "name": "Fedora latest, rawhide (Arm 64-bit)",
- "os": "linux",
- "arch": "arm64",
- "dist": "bionic",
- "services": [ "docker" ],
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh fedora:rawhide ${base_url} ",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh fedora:latest ${base_url} "
- ]
- },
- {
- "name": "Arch latest (Intel 64-bit)",
- "os": "linux",
- "arch": "amd64",
- "dist": "bionic",
- "services": [ "docker" ],
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh archlinux:latest ${base_url} "
- ]
- },
- {
- "name": "Manjaro base (Intel 64-bit)",
- "os": "linux",
- "arch": "amd64",
- "dist": "bionic",
- "services": [ "docker" ],
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/docker-test.sh manjarolinux/base ${base_url} "
- ]
- },
- {}
- ],
- "notifications": {
- "email": {
- "on_success": "always",
- "on_failure": "always"
- }
- }
- }
- }
- }
- __EOF__
- }
- function create_macos_data_file()
- {
- local message="$1"
- local branch="$2"
- local base_url="$3"
- local data_file_path="$4"
- # Note: __EOF__ is NOT quoted to allow substitutions.
- cat <<__EOF__ > "${data_file_path}"
- {
- "request": {
- "message": "${message}",
- "branch": "${branch}",
- "config": {
- "merge_mode": "replace",
- "jobs": [
- {
- "name": "macOS 10.15 Intel",
- "os": "osx",
- "arch": "amd64",
- "osx_image": "xcode11.5",
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/native-test.sh ${base_url}"
- ]
- },
- {
- "name": "macOS 10.14 Intel",
- "os": "osx",
- "arch": "amd64",
- "osx_image": "xcode11.3",
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/native-test.sh ${base_url}"
- ]
- },
- {
- "name": "macOS 10.13 Intel",
- "os": "osx",
- "arch": "amd64",
- "osx_image": "xcode10.1",
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/native-test.sh ${base_url}"
- ]
- },
- {
- "name": "macOS 10.12 Intel",
- "os": "osx",
- "arch": "amd64",
- "osx_image": "xcode9.2",
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/native-test.sh ${base_url}"
- ]
- },
- {
- "name": "macOS 10.11 Intel",
- "os": "osx",
- "arch": "amd64",
- "osx_image": "xcode8",
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/native-test.sh ${base_url}"
- ]
- },
- {
- "name": "macOS 10.10 Intel",
- "os": "osx",
- "arch": "amd64",
- "osx_image": "xcode6.4",
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/native-test.sh ${base_url}"
- ]
- }
- ],
- "notifications": {
- "email": {
- "on_success": "always",
- "on_failure": "always"
- }
- }
- }
- }
- }
- __EOF__
- }
- function create_windows_data_file()
- {
- local message="$1"
- local branch="$2"
- local base_url="$3"
- local data_file_path="$4"
- # Note: __EOF__ is NOT quoted to allow substitutions.
- cat <<__EOF__ > "${data_file_path}"
- {
- "request": {
- "message": "${message}",
- "branch": "${branch}",
- "config": {
- "merge_mode": "replace",
- "jobs": [
- {
- "name": "Windows 10 (Intel 64-bit)",
- "os": "windows",
- "arch": "amd64",
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/native-test.sh ${base_url} "
- ]
- },
- {
- "name": "Windows 10 (Intel 32-bit)",
- "os": "windows",
- "arch": "amd64",
- "language": "minimal",
- "script": [
- "env | sort",
- "pwd",
- "DEBUG=${DEBUG} bash tests/scripts/native-test.sh --32 ${base_url} "
- ]
- }
- ],
- "notifications": {
- "email": {
- "on_success": "always",
- "on_failure": "always"
- }
- }
- }
- }
- }
- __EOF__
- }
- # data_file_path
- # github_org
- # github_repo
- function trigger_travis()
- {
- local github_org="$1"
- local github_repo="$2"
- local data_file_path="$3"
- curl -v -X POST \
- -H "Content-Type: application/json" \
- -H "Accept: application/json" \
- -H "Travis-API-Version: 3" \
- -H "Authorization: token ${TRAVIS_ORG_TOKEN}" \
- --data-binary @"${data_file_path}" \
- https://api.travis-ci.org/repo/${github_org}%2F${github_repo}/requests
- }
- # -----------------------------------------------------------------------------
- # Runs inside a container.
- # Set the following variables:
- #
- # - node_platform={win32,linux,darwin}
- # - node_architecture={x64,x32,arm64,arm}
- # - bits={32,64}
- function detect_architecture()
- {
- uname -a
- uname_platform=$(uname -s | tr '[:upper:]' '[:lower:]')
- uname_machine=$(uname -m | tr '[:upper:]' '[:lower:]')
- node_platform="${uname_platform}"
- # Travis uses Msys2; git for Windows uses mingw-w64.
- if [[ "${uname_platform}" == msys_nt* ]] \
- || [[ "${uname_platform}" == mingw64_nt* ]] \
- || [[ "${uname_platform}" == mingw32_nt* ]]
- then
- node_platform="win32"
- fi
- node_architecture=""
- bits=""
- if [ "${uname_machine}" == "x86_64" ]
- then
- node_architecture="x64"
- bits="64"
- elif [ "${uname_machine}" == "i386" -o "${uname_machine}" == "i586" -o "${uname_machine}" == "i686" ]
- then
- node_architecture="x32"
- bits="32"
- elif [ "${uname_machine}" == "aarch64" ]
- then
- node_architecture="arm64"
- bits="64"
- elif [ "${uname_machine}" == "armv7l" -o "${uname_machine}" == "armv8l" ]
- then
- node_architecture="arm"
- bits="32"
- else
- echo "${uname_machine} not supported"
- exit 1
- fi
- }
- function prepare_env()
- {
- container_work_folder_path="/Host/Work"
- container_repo_folder_path="/Host/repo"
- if [ -f "/.dockerenv" -a -d "${container_work_folder_path}" ]
- then
- work_folder_path="${container_work_folder_path}"
- repo_folder_path="${container_repo_folder_path}"
- else
- work_folder_path="${HOME}/Work"
- # On the host, it must be called using the script folder path.
- repo_folder_path="$1"
- fi
- cache_folder_path="${work_folder_path}/cache"
- # Extract only the first line
- version="$(cat ${repo_folder_path}/scripts/VERSION | sed -e '2,$d')"
- if [ -z "${version}" ]
- then
- echo "Check the version, it cannot be empty."
- exit 1
- fi
- # Always in the user home, even when inside a container.
- test_folder_path="${HOME}/tmp/test-${app_lc_name}"
- }
- # -----------------------------------------------------------------------------
- # Requires base_url and lots of other variables.
- function install_archive()
- {
- local archive_extension
- local archive_architecture="${node_architecture}"
- if [ "${node_platform}" == "win32" ]
- then
- archive_extension="zip"
- if [ "${force_32_bit}" == "y" ]
- then
- archive_architecture="x32"
- fi
- else
- archive_extension="tar.gz"
- fi
- archive_name="xpack-${app_lc_name}-${version}-${node_platform}-${archive_architecture}.${archive_extension}"
- archive_folder_name="xpack-${app_lc_name}-${version}"
- mkdir -pv "${cache_folder_path}"
- if [ ! -f "${cache_folder_path}/${archive_name}" ]
- then
- echo
- echo "Downloading ${archive_name}..."
- curl -L --fail -o "${cache_folder_path}/${archive_name}" \
- "${base_url}/${archive_name}"
- echo
- fi
- app_folder_path="${test_folder_path}/${archive_folder_name}"
- rm -rf "${app_folder_path}"
- mkdir -pv "${test_folder_path}"
- cd "${test_folder_path}"
- echo
- echo "Extracting ${archive_name}..."
- if [[ "${archive_name}" == *.zip ]]
- then
- unzip -q "${cache_folder_path}/${archive_name}"
- else
- tar xf "${cache_folder_path}/${archive_name}"
- fi
- echo ls -lL "${app_folder_path}"
- ls -lL "${app_folder_path}"
- }
- # -----------------------------------------------------------------------------
- # $1 = image name
- # $2 = base URL
- function docker_run_test() {
- local image_name="$1"
- shift
- local base_url="$1"
- shift
- (
- prefix32="${prefix32:-""}"
- docker run \
- --tty \
- --hostname "docker" \
- --workdir="/root" \
- --env DEBUG=${DEBUG} \
- --volume "${work_folder_path}:${container_work_folder_path}" \
- --volume "${repo_folder_path}:${container_repo_folder_path}" \
- "${image_name}" \
- ${prefix32} /bin/bash "${container_repo_folder_path}/tests/scripts/container-test.sh" \
- "${image_name}" \
- "${base_url}" \
- "$@"
- )
- }
- function docker_run_test_32() {
- (
- prefix32="linux32"
- docker_run_test "$@"
- )
- }
- # -----------------------------------------------------------------------------
- function show_libs()
- {
- # Does not include the .exe extension.
- local app_path=$1
- shift
- if [ "${node_platform}" == "win32" ]
- then
- app_path+='.exe'
- fi
- if [ "${node_platform}" == "linux" ]
- then
- echo
- echo "readelf -d ${app_path} | egrep -i ..."
- readelf -d "${app_path}" | egrep -i '(SONAME)' || true
- readelf -d "${app_path}" | egrep -i '(RUNPATH|RPATH)' || true
- readelf -d "${app_path}" | egrep -i '(NEEDED)' || true
- echo
- echo "ldd -v ${app_path}"
- ldd -v "${app_path}" 2>&1 || true
- elif [ "${node_platform}" == "darwin" ]
- then
- echo
- echo "otool -L ${app_path}"
- otool -L "${app_path}"
- fi
- }
- function run_verbose()
- {
- echo
- echo "$@"
- "$@" 2>&1
- }
- function run_app()
- {
- local app_path=$1
- shift
- if [ "${node_platform}" == "win32" ]
- then
- app_path+='.exe'
- fi
- echo
- echo "${app_path} $@"
- "${app_path}" "$@" 2>&1
- }
- function run_app_silent()
- {
- local app_path=$1
- shift
- if [ "${node_platform}" == "win32" ]
- then
- app_path+='.exe'
- fi
- "${app_path}" "$@" 2>&1
- }
- function do_run()
- {
- local app_path=$1
- shift
- echo
- echo "${app_path} $@"
- "${app_path}" "$@" 2>&1
- }
- function do_expect()
- {
- local app_name="$1"
- local expected="$2"
- show_libs "${app_name}"
- local output="$(run_app_silent "./${app_name}")"
- if [ "x${output}x" == "x${expected}x" ]
- then
- echo "Test ${app_name} ok"
- else
- exit 1
- fi
- }
- function good_bye()
- {
- echo
- echo "All tests completed successfully."
- do_run uname -a
- if [ "${node_platform}" == "linux" ]
- then
- do_run lsb_release -a
- do_run ldd --version
- elif [ "${node_platform}" == "darwin" ]
- then
- do_run sw_vers
- fi
- }
- # -----------------------------------------------------------------------------
|