File: test_all_versions.sh

package info (click to toggle)
golang-github-bradenaw-juniper 0.15.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 872 kB
  • sloc: sh: 27; makefile: 2
file content (24 lines) | stat: -rw-r--r-- 556 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash

set -euo pipefail

go_versions=(1.18 1.19 1.20 1.21)

latest="${go_versions[-1]}"
if ! go version | grep "go$latest"; then
    echo >2 "go version expected $latest, got $(go version)"
    exit 1
fi

for go_version in ${go_versions[@]}; do
    if [[ ${go_version} == ${latest} ]]; then
        go version
        go test --race ./...
    else
        go install "golang.org/dl/go${go_version}@latest"
        go_bin="${HOME}/go/bin/go${go_version}"
        $go_bin download
        $go_bin version
        $go_bin test --race ./...
    fi
done