raz / containers / ci / build-tools.sh

69 lines · 2.4 KiB · raw · history · last change 4c98ab55

1#!/bin/sh
2set -eu
3
4raz_version=0.21.0
5raz_sha256=a8e2e550e927050d36a7e9731e6de22b094189adea15a984cd921917cbd8d90f
6concha_revision=029289644abee68ddc3c06da526d394939846a41
7robbie_revision=3328bcf7060ef663b309e8a7a5e8a528a7962aee
8robbie_build_raz=0.18.0
9robbie_build_raz_sha256=d05f2adbfddd52eabbf10db275fa69390102f46e40825ae94adaeade219799aa
10rzone_revision=2644afb0827fe5ce1679a386336728183d61db11
11
12mkdir -p /opt/raz /tmp/raz-ci /usr/local/share/raz-ci
13cd /tmp/raz-ci
14curl --fail --location --retry 3 \
15 "https://raz.lucelad.workers.dev/download/raz-$raz_version-linux-x86_64.tar.gz" \
16 -o raz.tar.gz
17printf '%s raz.tar.gz\n' "$raz_sha256" | sha256sum -c -
18tar -xzf raz.tar.gz --strip-components=1 -C /opt/raz
19export PATH="/opt/raz:$PATH"
20raz --version | grep '^raz 0\.21\.0, '
21
22fetch() {
23 git init -q "$1"
24 git -C "$1" remote add origin "https://github.com/ldiaz94/$1.git"
25 attempt=1
26 until git -C "$1" fetch -q --depth=1 origin "$2"; do
27 if [ "$attempt" -ge 3 ]; then return 1; fi
28 attempt=$((attempt + 1))
29 sleep 2
30 done
31 git -C "$1" checkout -q --detach FETCH_HEAD
32 test "$(git -C "$1" rev-parse HEAD)" = "$2"
33}
34
35fetch rzone "$rzone_revision"
36fetch concha "$concha_revision"
37fetch robbie "$robbie_revision"
38make -C rzone check
39make -C concha test
40# robbie's latest commit changes RAZVERSION alone. Its source still uses
41# the 0.18 library's pointer API; use that compiler only in this build stage.
42curl --fail --location --retry 3 \
43 "https://raz.lucelad.workers.dev/download/raz-$robbie_build_raz-linux-x86_64.tar.gz" \
44 -o robbie-raz.tar.gz
45printf '%s robbie-raz.tar.gz\n' "$robbie_build_raz_sha256" | sha256sum -c -
46mkdir robbie-raz
47tar -xzf robbie-raz.tar.gz --strip-components=1 -C robbie-raz
48robbie_raz="$PWD/robbie-raz/raz"
49"$robbie_raz" --version | grep '^raz 0\.18\.0, '
50make -C robbie test RAZ="$robbie_raz" RAZVERSION="$robbie_build_raz"
51make -C concha install PREFIX=/usr/local
52make -C robbie install PREFIX=/usr/local RAZ="$robbie_raz" RAZVERSION="$robbie_build_raz"
53
54cat > /usr/local/share/raz-ci/versions.txt <<EOF
55image=0.21.0-debian12-r1
56raz=$raz_version
57raz_archive_sha256=$raz_sha256
58concha=$concha_revision
59robbie=$robbie_revision
60robbie_build_raz=$robbie_build_raz
61robbie_build_raz_archive_sha256=$robbie_build_raz_sha256
62rzone=$rzone_revision
63EOF
64dpkg-query -W > /usr/local/share/raz-ci/packages.txt
65for project in concha robbie rzone; do
66 if [ -f "$project/LICENSE" ]; then
67 install -Dm644 "$project/LICENSE" "/usr/local/share/licenses/$project/LICENSE"
68 fi
69done