Skip to content

Commit

Permalink
internal/ci: re-baseline base from cue-lang/cue@c360ba88
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
myitcv committed Nov 29, 2024
1 parent 1aba5b6 commit fd77373
Show file tree
Hide file tree
Showing 18 changed files with 203 additions and 1,145 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
echo Latest commit: $sha
echo "Trigger workflow on cue-lang/proposal"
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\"}"
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\"}"
# Ensure that the trybot repo has the latest commit for
# this branch. If the force-push results in a commit
Expand Down Expand Up @@ -121,7 +121,7 @@ jobs:
# We are up-to-date, i.e. the push did nothing, hence we need to trigger a workflow_dispatch
# in the trybot repo.
echo "Trigger workflow on cue-lang/proposal-trybot"
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\"}"
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\"}"
else
echo "Force-push to cue-lang/proposal-trybot did work; nothing to do"
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ concurrency: push_tip_to_trybot
jobs:
push:
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
if: ${{github.repository == 'cue-lang/proposal'}}
steps:
- name: Write netrc file for cueckoo Gerrithub
run: |-
Expand Down Expand Up @@ -48,3 +44,7 @@ jobs:
echo "Giving up"
exit 1
fi
defaults:
run:
shell: bash
if: ${{github.repository == 'cue-lang/proposal'}}
69 changes: 23 additions & 46 deletions .github/workflows/trybot.yml → .github/workflows/trybot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ name: TryBot
branches:
- ci/test
- main
pull_request: {}
workflow_dispatch: {}
pull_request: {}
jobs:
test:
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
if: |-
(contains(github.event.head_commit.message, '
Dispatch-Trailer: {"type":"trybot"')) || ! (contains(github.event.head_commit.message, '
Dispatch-Trailer: {"type":"'))
defaults:
run:
shell: bash
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down Expand Up @@ -57,7 +57,13 @@ jobs:
uses: actions/setup-go@v5
with:
cache: false
go-version: 1.20.x
go-version: 1.23.x
- name: Set common go env vars
run: |-
go env -w GOTOOLCHAIN=local
# Dump env for good measure
go env
- id: go-mod-cache-dir
name: Get go mod cache directory
run: echo "dir=$(go env GOMODCACHE)" >> ${GITHUB_OUTPUT}
Expand All @@ -72,8 +78,8 @@ jobs:
path: |-
${{ steps.go-mod-cache-dir.outputs.dir }}/cache/download
${{ steps.go-cache-dir.outputs.dir }}
key: ${{ runner.os }}-1.20.x-${{ github.run_id }}
restore-keys: ${{ runner.os }}-1.20.x
key: ${{ runner.os }}-1.23.x-${{ github.run_id }}
restore-keys: ${{ runner.os }}-1.23.x
- if: |-
! (((github.ref == 'refs/heads/main') && (! (contains(github.event.head_commit.message, '
Dispatch-Trailer: {"type":"')))) || (github.ref == 'refs/heads/ci/test'))
Expand All @@ -82,50 +88,21 @@ jobs:
path: |-
${{ steps.go-mod-cache-dir.outputs.dir }}/cache/download
${{ steps.go-cache-dir.outputs.dir }}
key: ${{ runner.os }}-1.20.x-${{ github.run_id }}
restore-keys: ${{ runner.os }}-1.20.x
key: ${{ runner.os }}-1.23.x-${{ github.run_id }}
restore-keys: ${{ runner.os }}-1.23.x
- if: |-
github.repository == 'cue-lang/proposal' && (((github.ref == 'refs/heads/main') && (! (contains(github.event.head_commit.message, '
Dispatch-Trailer: {"type":"')))) || github.ref == 'refs/heads/ci/test')
run: go clean -testcache
- name: Install CUE
uses: cue-lang/[email protected]
with:
version: latest
- name: Early git and code sanity checks
run: |-
# Ensure that commit messages have a blank second line.
# We know that a commit message must be longer than a single
# line because each commit must be signed-off.
if git log --format=%B -n 1 HEAD | sed -n '2{/^$/{q1}}'; then
echo "second line of commit message must be blank"
exit 1
fi
# All authors, including co-authors, must have a signed-off trailer by email.
# Note that trailers are in the form "Name <email>", so grab the email with sed.
# For now, we require the sorted lists of author and signer emails to match.
# Note that this also fails if a commit isn't signed-off at all.
#
# In Gerrit we already enable a form of this via https://gerrit-review.googlesource.com/Documentation/project-configuration.html#require-signed-off-by,
# but it does not support co-authors nor can it be used when testing GitHub PRs.
commit_authors="$(
{
git log -1 --pretty='%ae'
git log -1 --pretty='%(trailers:key=Co-authored-by,valueonly)' | sed -ne 's/.* <\(.*\)>/\1/p'
} | sort -u
)"
commit_signers="$(
{
git log -1 --pretty='%(trailers:key=Signed-off-by,valueonly)' | sed -ne 's/.* <\(.*\)>/\1/p'
} | sort -u
)"
if [[ "${commit_authors}" != "${commit_signers}" ]]; then
echo "Error: commit author email addresses do not match signed-off-by trailers"
echo
echo "Authors:"
echo "${commit_authors}"
echo
echo "Signers:"
echo "${commit_signers}"
exit 1
fi
run: go run cuelang.org/go/internal/ci/[email protected]
- run: cue login --token=${CUE_TOKEN}
env:
CUE_TOKEN: ${{ secrets.NOTCUECKOO_CUE_TOKEN }}
- name: Generate
run: go generate ./...
- name: Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ name: Dispatch trybot
jobs:
trybot:
runs-on: ubuntu-22.04
if: ${{ ((github.ref == 'refs/heads/ci/test') && false) || github.event.client_payload.type == 'trybot' }}
defaults:
run:
shell: bash
if: ${{ ((github.ref == 'refs/heads/ci/test') && false) || github.event.client_payload.type == 'trybot' }}
steps:
- name: Write netrc file for cueckoo Gerrithub
run: |-
Expand Down
2 changes: 1 addition & 1 deletion codereview.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Code generated internal/ci/ci_tool.cue; DO NOT EDIT.

github: https://github.com/cue-lang/proposal
gerrit: https://review.gerrithub.io/a/cue-lang/proposal
github: https://github.com/cue-lang/proposal
5 changes: 5 additions & 0 deletions cue.mod/module.cue
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
module: "github.com/cue-lang/proposal"
language: version: "v0.8.0"
deps: "github.com/cue-tmp/jsonschema-pub/exp1/githubactions@v0": {
v: "v0.4.0"
default: true
}
Loading

0 comments on commit fd77373

Please sign in to comment.