Skip to content

Commit 0d952e8

Browse files
committed
refactor: scrap yaml rather than html
1 parent c8baf51 commit 0d952e8

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,29 @@ jobs:
5656
- name: Install and Start Cockroachdb
5757
run: |
5858
# Download CockroachDB
59-
readonly patch=$(
60-
ruby -rnet/http -ruri -e 'puts Net::HTTP.get(
61-
URI("https://www.cockroachlabs.com/docs/releases/${{ matrix.crdb }}")
62-
)[%r(https://binaries.cockroachdb.com/cockroach-${{ matrix.crdb }}.(\d+).linux-amd64.tgz), 1]'
63-
)
59+
readonly full_version=$(ruby -rnet/http -ruri -ryaml -e '
60+
link = "https://raw.githubusercontent.com/cockroachdb/docs/main/src/current/_data/releases.yml"
61+
puts YAML.safe_load(Net::HTTP.get(URI(link))).reverse.find {
62+
_1["major_version"] == "${{ matrix.crdb }}" &&
63+
_1["release_type"] == "Production" &&
64+
_1["linux"] && _1["linux"]["linux_intel_fips"] &&
65+
!_1["cloud_only"] &&
66+
!_1["withdrawn"] &&
67+
!_1["release_name"].include?("-") # Pre-release
68+
}["release_name"]
69+
')
6470
65-
echo "Downloading ${{ matrix.crdb }}.$patch"
66-
wget -qO- "https://binaries.cockroachdb.com/cockroach-${{ matrix.crdb }}.$patch.linux-amd64.tgz" | tar xvz
71+
echo "Downloading $full_version..."
72+
wget -qO- "https://binaries.cockroachdb.com/cockroach-$full_version.linux-amd64.tgz" | tar xvz
6773
68-
export PATH=./cockroach-${{ matrix.crdb }}.$patch.linux-amd64/:$PATH
74+
export PATH=./cockroach-$full_version.linux-amd64/:$PATH
6975
readonly urlfile=cockroach-url
7076
7177
# Start a CockroachDB server and wait for it to become ready.
7278
rm -f "$urlfile"
7379
rm -rf cockroach-data
7480
# Start CockroachDB.
75-
cockroach start-single-node --max-sql-memory=25% --cache=25% --insecure --host=localhost --spatial-libs=./cockroach-${{ matrix.crdb }}.$patch.linux-amd64/lib --listening-url-file="$urlfile" >/dev/null 2>&1 &
81+
cockroach start-single-node --max-sql-memory=25% --cache=25% --insecure --host=localhost --spatial-libs=./cockroach-$full_version.linux-amd64/lib --listening-url-file="$urlfile" >/dev/null 2>&1 &
7682
# Ensure CockroachDB is stopped on script exit.
7783
# Wait until CockroachDB has started.
7884
for i in {0..3}; do

0 commit comments

Comments
 (0)