Skip to content

Commit fd77373

Browse files
committed
internal/ci: re-baseline base from cue-lang/cue@c360ba88
Noticed in passing as a result of a now defunct CL 1200735, that this CL will supersede. Includes improvements based on CI setup in cue-lang/vscode-cue, where the presence of cue in PATH is assumed. The setup-cue action is used with a "latest" version. This change moves this repo to be based on the CUE Central Registry for the curated GitHub actions schema. Signed-off-by: Paul Jolly <[email protected]> Change-Id: I10447b2d13dfdbd1fe067a5462fe59e15b1fae8b Reviewed-on: https://review.gerrithub.io/c/cue-lang/proposal/+/1204957 TryBot-Result: CUEcueckoo <[email protected]> Reviewed-by: Daniel Martí <[email protected]>
1 parent 1aba5b6 commit fd77373

File tree

18 files changed

+203
-1145
lines changed

18 files changed

+203
-1145
lines changed

.github/workflows/evict_caches.yml renamed to .github/workflows/evict_caches.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ jobs:
8989
echo Latest commit: $sha
9090
9191
echo "Trigger workflow on cue-lang/proposal"
92-
curl -s -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.CUECKOO_GITHUB_PAT }}" -H "X-GitHub-Api-Version: 2022-11-28" --fail-with-body -X POST https://api.github.com/repos/cue-lang/proposal/actions/workflows/trybot.yml/dispatches -d "{\"ref\":\"$j\"}"
92+
curl -s -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.CUECKOO_GITHUB_PAT }}" -H "X-GitHub-Api-Version: 2022-11-28" --fail-with-body -X POST https://api.github.com/repos/cue-lang/proposal/actions/workflows/trybot.yaml/dispatches -d "{\"ref\":\"$j\"}"
9393
9494
# Ensure that the trybot repo has the latest commit for
9595
# this branch. If the force-push results in a commit
@@ -121,7 +121,7 @@ jobs:
121121
# We are up-to-date, i.e. the push did nothing, hence we need to trigger a workflow_dispatch
122122
# in the trybot repo.
123123
echo "Trigger workflow on cue-lang/proposal-trybot"
124-
curl -s -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.CUECKOO_GITHUB_PAT }}" -H "X-GitHub-Api-Version: 2022-11-28" --fail-with-body -X POST https://api.github.com/repos/cue-lang/proposal-trybot/actions/workflows/trybot.yml/dispatches -d "{\"ref\":\"$j\"}"
124+
curl -s -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.CUECKOO_GITHUB_PAT }}" -H "X-GitHub-Api-Version: 2022-11-28" --fail-with-body -X POST https://api.github.com/repos/cue-lang/proposal-trybot/actions/workflows/trybot.yaml/dispatches -d "{\"ref\":\"$j\"}"
125125
else
126126
echo "Force-push to cue-lang/proposal-trybot did work; nothing to do"
127127
fi

.github/workflows/push_tip_to_trybot.yml renamed to .github/workflows/push_tip_to_trybot.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ concurrency: push_tip_to_trybot
99
jobs:
1010
push:
1111
runs-on: ubuntu-22.04
12-
defaults:
13-
run:
14-
shell: bash
15-
if: ${{github.repository == 'cue-lang/proposal'}}
1612
steps:
1713
- name: Write netrc file for cueckoo Gerrithub
1814
run: |-
@@ -48,3 +44,7 @@ jobs:
4844
echo "Giving up"
4945
exit 1
5046
fi
47+
defaults:
48+
run:
49+
shell: bash
50+
if: ${{github.repository == 'cue-lang/proposal'}}

.github/workflows/trybot.yml renamed to .github/workflows/trybot.yaml

+23-46
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ name: TryBot
66
branches:
77
- ci/test
88
- main
9-
pull_request: {}
109
workflow_dispatch: {}
10+
pull_request: {}
1111
jobs:
1212
test:
1313
runs-on: ubuntu-22.04
14-
defaults:
15-
run:
16-
shell: bash
1714
if: |-
1815
(contains(github.event.head_commit.message, '
1916
Dispatch-Trailer: {"type":"trybot"')) || ! (contains(github.event.head_commit.message, '
2017
Dispatch-Trailer: {"type":"'))
18+
defaults:
19+
run:
20+
shell: bash
2121
steps:
2222
- name: Checkout code
2323
uses: actions/checkout@v4
@@ -57,7 +57,13 @@ jobs:
5757
uses: actions/setup-go@v5
5858
with:
5959
cache: false
60-
go-version: 1.20.x
60+
go-version: 1.23.x
61+
- name: Set common go env vars
62+
run: |-
63+
go env -w GOTOOLCHAIN=local
64+
65+
# Dump env for good measure
66+
go env
6167
- id: go-mod-cache-dir
6268
name: Get go mod cache directory
6369
run: echo "dir=$(go env GOMODCACHE)" >> ${GITHUB_OUTPUT}
@@ -72,8 +78,8 @@ jobs:
7278
path: |-
7379
${{ steps.go-mod-cache-dir.outputs.dir }}/cache/download
7480
${{ steps.go-cache-dir.outputs.dir }}
75-
key: ${{ runner.os }}-1.20.x-${{ github.run_id }}
76-
restore-keys: ${{ runner.os }}-1.20.x
81+
key: ${{ runner.os }}-1.23.x-${{ github.run_id }}
82+
restore-keys: ${{ runner.os }}-1.23.x
7783
- if: |-
7884
! (((github.ref == 'refs/heads/main') && (! (contains(github.event.head_commit.message, '
7985
Dispatch-Trailer: {"type":"')))) || (github.ref == 'refs/heads/ci/test'))
@@ -82,50 +88,21 @@ jobs:
8288
path: |-
8389
${{ steps.go-mod-cache-dir.outputs.dir }}/cache/download
8490
${{ steps.go-cache-dir.outputs.dir }}
85-
key: ${{ runner.os }}-1.20.x-${{ github.run_id }}
86-
restore-keys: ${{ runner.os }}-1.20.x
91+
key: ${{ runner.os }}-1.23.x-${{ github.run_id }}
92+
restore-keys: ${{ runner.os }}-1.23.x
8793
- if: |-
8894
github.repository == 'cue-lang/proposal' && (((github.ref == 'refs/heads/main') && (! (contains(github.event.head_commit.message, '
8995
Dispatch-Trailer: {"type":"')))) || github.ref == 'refs/heads/ci/test')
9096
run: go clean -testcache
97+
- name: Install CUE
98+
uses: cue-lang/[email protected]
99+
with:
100+
version: latest
91101
- name: Early git and code sanity checks
92-
run: |-
93-
# Ensure that commit messages have a blank second line.
94-
# We know that a commit message must be longer than a single
95-
# line because each commit must be signed-off.
96-
if git log --format=%B -n 1 HEAD | sed -n '2{/^$/{q1}}'; then
97-
echo "second line of commit message must be blank"
98-
exit 1
99-
fi
100-
101-
# All authors, including co-authors, must have a signed-off trailer by email.
102-
# Note that trailers are in the form "Name <email>", so grab the email with sed.
103-
# For now, we require the sorted lists of author and signer emails to match.
104-
# Note that this also fails if a commit isn't signed-off at all.
105-
#
106-
# In Gerrit we already enable a form of this via https://gerrit-review.googlesource.com/Documentation/project-configuration.html#require-signed-off-by,
107-
# but it does not support co-authors nor can it be used when testing GitHub PRs.
108-
commit_authors="$(
109-
{
110-
git log -1 --pretty='%ae'
111-
git log -1 --pretty='%(trailers:key=Co-authored-by,valueonly)' | sed -ne 's/.* <\(.*\)>/\1/p'
112-
} | sort -u
113-
)"
114-
commit_signers="$(
115-
{
116-
git log -1 --pretty='%(trailers:key=Signed-off-by,valueonly)' | sed -ne 's/.* <\(.*\)>/\1/p'
117-
} | sort -u
118-
)"
119-
if [[ "${commit_authors}" != "${commit_signers}" ]]; then
120-
echo "Error: commit author email addresses do not match signed-off-by trailers"
121-
echo
122-
echo "Authors:"
123-
echo "${commit_authors}"
124-
echo
125-
echo "Signers:"
126-
echo "${commit_signers}"
127-
exit 1
128-
fi
102+
run: go run cuelang.org/go/internal/ci/[email protected]
103+
- run: cue login --token=${CUE_TOKEN}
104+
env:
105+
CUE_TOKEN: ${{ secrets.NOTCUECKOO_CUE_TOKEN }}
129106
- name: Generate
130107
run: go generate ./...
131108
- name: Test

.github/workflows/trybot_dispatch.yml renamed to .github/workflows/trybot_dispatch.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ name: Dispatch trybot
99
jobs:
1010
trybot:
1111
runs-on: ubuntu-22.04
12+
if: ${{ ((github.ref == 'refs/heads/ci/test') && false) || github.event.client_payload.type == 'trybot' }}
1213
defaults:
1314
run:
1415
shell: bash
15-
if: ${{ ((github.ref == 'refs/heads/ci/test') && false) || github.event.client_payload.type == 'trybot' }}
1616
steps:
1717
- name: Write netrc file for cueckoo Gerrithub
1818
run: |-

codereview.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Code generated internal/ci/ci_tool.cue; DO NOT EDIT.
22

3-
github: https://github.com/cue-lang/proposal
43
gerrit: https://review.gerrithub.io/a/cue-lang/proposal
4+
github: https://github.com/cue-lang/proposal

cue.mod/module.cue

+5
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
11
module: "github.com/cue-lang/proposal"
2+
language: version: "v0.8.0"
3+
deps: "github.com/cue-tmp/jsonschema-pub/exp1/githubactions@v0": {
4+
v: "v0.4.0"
5+
default: true
6+
}

0 commit comments

Comments
 (0)