| 1 | #!/bin/sh |
| 2 | set -eu |
| 3 | |
| 4 | raz_version=0.21.0 |
| 5 | raz_sha256=a8e2e550e927050d36a7e9731e6de22b094189adea15a984cd921917cbd8d90f |
| 6 | concha_revision=029289644abee68ddc3c06da526d394939846a41 |
| 7 | robbie_revision=3328bcf7060ef663b309e8a7a5e8a528a7962aee |
| 8 | robbie_build_raz=0.18.0 |
| 9 | robbie_build_raz_sha256=d05f2adbfddd52eabbf10db275fa69390102f46e40825ae94adaeade219799aa |
| 10 | rzone_revision=2644afb0827fe5ce1679a386336728183d61db11 |
| 11 | |
| 12 | mkdir -p /opt/raz /tmp/raz-ci /usr/local/share/raz-ci |
| 13 | cd /tmp/raz-ci |
| 14 | curl --fail --location --retry 3 \ |
| 15 | "https://raz.lucelad.workers.dev/download/raz-$raz_version-linux-x86_64.tar.gz" \ |
| 16 | -o raz.tar.gz |
| 17 | printf '%s raz.tar.gz\n' "$raz_sha256" | sha256sum -c - |
| 18 | tar -xzf raz.tar.gz --strip-components=1 -C /opt/raz |
| 19 | export PATH="/opt/raz:$PATH" |
| 20 | raz --version | grep '^raz 0\.21\.0, ' |
| 21 | |
| 22 | fetch() { |
| 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 | |
| 35 | fetch rzone "$rzone_revision" |
| 36 | fetch concha "$concha_revision" |
| 37 | fetch robbie "$robbie_revision" |
| 38 | make -C rzone check |
| 39 | make -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. |
| 42 | curl --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 |
| 45 | printf '%s robbie-raz.tar.gz\n' "$robbie_build_raz_sha256" | sha256sum -c - |
| 46 | mkdir robbie-raz |
| 47 | tar -xzf robbie-raz.tar.gz --strip-components=1 -C robbie-raz |
| 48 | robbie_raz="$PWD/robbie-raz/raz" |
| 49 | "$robbie_raz" --version | grep '^raz 0\.18\.0, ' |
| 50 | make -C robbie test RAZ="$robbie_raz" RAZVERSION="$robbie_build_raz" |
| 51 | make -C concha install PREFIX=/usr/local |
| 52 | make -C robbie install PREFIX=/usr/local RAZ="$robbie_raz" RAZVERSION="$robbie_build_raz" |
| 53 | |
| 54 | cat > /usr/local/share/raz-ci/versions.txt <<EOF |
| 55 | image=0.21.0-debian12-r1 |
| 56 | raz=$raz_version |
| 57 | raz_archive_sha256=$raz_sha256 |
| 58 | concha=$concha_revision |
| 59 | robbie=$robbie_revision |
| 60 | robbie_build_raz=$robbie_build_raz |
| 61 | robbie_build_raz_archive_sha256=$robbie_build_raz_sha256 |
| 62 | rzone=$rzone_revision |
| 63 | EOF |
| 64 | dpkg-query -W > /usr/local/share/raz-ci/packages.txt |
| 65 | for 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 |
| 69 | done |