mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
ci: refactor CI to use mise for shared tool setup (#25727)
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
# - go.mod
|
||||
# - mise.toml (the dogfood image installs from this manifest)
|
||||
# - flake.nix
|
||||
# - .github/actions/setup-go/action.yml
|
||||
# The version of Go in go.mod is considered the source of truth.
|
||||
|
||||
set -euo pipefail
|
||||
@@ -19,23 +18,17 @@ IGNORE_NIX=${IGNORE_NIX:-false}
|
||||
|
||||
GO_VERSION_GO_MOD=$(grep -Eo 'go [0-9]+\.[0-9]+\.[0-9]+' ./go.mod | cut -d' ' -f2)
|
||||
GO_VERSION_MISE_TOML=$(grep -Eo '^go = "[0-9]+\.[0-9]+\.[0-9]+"' ./mise.toml | sed -E 's/.*"([^"]+)"/\1/')
|
||||
GO_VERSION_SETUP_GO=$(yq '.inputs.version.default' .github/actions/setup-go/action.yaml)
|
||||
GO_VERSION_FLAKE_NIX=$(grep -Eo '\bgo_[0-9]+_[0-9]+\b' ./flake.nix)
|
||||
# Convert to major.minor format.
|
||||
GO_VERSION_FLAKE_NIX_MAJOR_MINOR=$(echo "$GO_VERSION_FLAKE_NIX" | cut -d '_' -f 2-3 | tr '_' '.')
|
||||
log "INFO : go.mod : $GO_VERSION_GO_MOD"
|
||||
log "INFO : mise.toml : $GO_VERSION_MISE_TOML"
|
||||
log "INFO : setup-go/action.yaml : $GO_VERSION_SETUP_GO"
|
||||
log "INFO : flake.nix : $GO_VERSION_FLAKE_NIX_MAJOR_MINOR"
|
||||
|
||||
if [ "$GO_VERSION_GO_MOD" != "$GO_VERSION_MISE_TOML" ]; then
|
||||
error "Go version mismatch between go.mod and mise.toml"
|
||||
fi
|
||||
|
||||
if [ "$GO_VERSION_GO_MOD" != "$GO_VERSION_SETUP_GO" ]; then
|
||||
error "Go version mismatch between go.mod and .github/actions/setup-go/action.yaml"
|
||||
fi
|
||||
|
||||
# At the time of writing, Nix only constrains the major.minor version.
|
||||
# We need to check that specifically.
|
||||
if [ "$IGNORE_NIX" = "false" ]; then
|
||||
|
||||
Reference in New Issue
Block a user