-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tip.cuelang.org: test if site builds successfully
This adds a pair of steps to the end of CI which only run on the repo's default branch (or its pre-submission testing counterpart) in the primary (non-trybot) repo; i.e. after a CL has been submitted. The first step overrides the site's CUE version to be the tip of cue-lang/cue. The second step builds the site to check that the patch we're maintaining to make the site compatible with the CUE tip still does its job and allows the site build to succeed. Later changes will publish the site/source to Netlify/Gerrit, to increase our visibility of any changes. For now, this change just asserts that the site builds successfully. Change-Id: I51f6f7fbada47d6a250ff3ecfb11c212d78b9a70 Signed-off-by: Jonathan Matthews <[email protected]> Dispatch-Trailer: {"type":"trybot","CL":1200891,"patchset":5,"ref":"refs/changes/91/1200891/5","targetBranch":"master"}
- Loading branch information
1 parent
a6a6d58
commit a336089
Showing
3 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
# Usage: | ||
# tipUseAlternativeCUE.bash [CUE_COMMIT_REF] | ||
# | ||
# tipUseAlternativeCUE resolves the version of CUE available via | ||
# cuelang.org/go@$CUE_COMMIT_REF and overrides the site configuration so that | ||
# this version takes the place of all named CUEs (currently only "latest" and | ||
# "prerelease" are directly overridden, with their versions transitively | ||
# dictating those used by "tip", "default", and "playground"). CUE_COMMIT_REF | ||
# defaults to "master", so that invoking the script with no arguments will use | ||
# the tip of cue-lang/cue. | ||
|
||
versionRef=${1:-master} | ||
|
||
# cd to the parent directory to that containing the script | ||
cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/.." | ||
|
||
# Resolve $versionRef to a pseudo-version. Notice this intentionally honours | ||
# GOPROXY rather that setting a specific value in the script, allowing the | ||
# setting to be controlled by this script's invocation. | ||
td=$(mktemp -d) | ||
trap "rm -rf $td" EXIT | ||
pushd $td > /dev/null | ||
go mod init mod.example &> /dev/null | ||
go get cuelang.org/go@$versionRef &> /dev/null | ||
version=$(go list -m -f={{.Version}} cuelang.org/go) | ||
popd > /dev/null | ||
|
||
echo "Will use cuelang.org/go@$version" | ||
|
||
# Override all versions of CUE referenced by the site to be $version. | ||
# This might change if any entries are added to the version matrix that | ||
# deliberately make a previous version of CUE available but, for now, we don't | ||
# need that - and could easily make it configurable later. | ||
go run cuelang.org/go/cmd/cue def \ | ||
-t version="$version" \ | ||
-p site \ | ||
--out cue \ | ||
cue: - <<EOD >tip.cue | ||
_version: _ @tag(version) | ||
versions: cue: [string]: v: _version | ||
EOD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters