Skip to content

Commit d72997f

Browse files
committed
internal/ci: test internal/e2e on protected branches
Only on Linux, since these end-to-end tests are slow, and testing on different platforms or Go versions isn't useful. Only on pushes to protected branches, since they use a github token stored as the secret E2E_GITHUB_TOKEN, and we don't want to worry about PR or CL trybot runs potentially leaking any secrets. Plus, the end-to-end tests being slow means they aren't very well suited to PR or CL trybot runs, where we want to finish relatively quickly. Signed-off-by: Daniel Martí <[email protected]> Change-Id: I7f687dc31010bc0e0005d3385c8388c6657d5362 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1171627 Reviewed-by: Roger Peppe <[email protected]> TryBot-Result: CUEcueckoo <[email protected]> Unity-Result: CUE porcuepine <[email protected]>
1 parent d70007c commit d72997f

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

.github/workflows/trybot.yml

+9
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,15 @@ jobs:
182182
run: go test -race ./...
183183
env:
184184
GORACE: atexit_sleep_ms=10
185+
- if: |-
186+
((github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-branch.')) && (! (contains(github.event.head_commit.message, '
187+
Dispatch-Trailer: {"type":"')))) && (matrix.go-version == '1.21.x' && matrix.runner == 'ubuntu-22.04')
188+
name: End-to-end test
189+
run: |-
190+
cd internal/e2e
191+
go test
192+
env:
193+
GITHUB_TOKEN: ${{ secrets.E2E_GITHUB_TOKEN }}
185194
- if: (matrix.go-version == '1.21.x' && matrix.runner == 'ubuntu-22.04')
186195
name: Check
187196
run: go vet ./...

internal/ci/github/trybot.cue

+17
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ workflows: trybot: _repo.bashWorkflow & {
7575
_goTestRace & {
7676
if: _isLatestLinux
7777
},
78+
_e2eTest,
7879
_goCheck,
7980
_repo.checkGitClean,
8081
]
@@ -114,6 +115,22 @@ workflows: trybot: _repo.bashWorkflow & {
114115
run: "go test ./..."
115116
}
116117

118+
_e2eTest: json.#step & {
119+
name: "End-to-end test"
120+
// The end-to-end tests require a github token secret and are a bit slow,
121+
// so we only run them on pushes to protected branches and on one environment.
122+
if: "\(_repo.isProtectedBranch) && \(_isLatestLinux)"
123+
// The secret is the fine-grained access token "cue-lang/cue ci e2e for modules-testing"
124+
// owned by the porcuepine bot account with read+write access to repo administration and code
125+
// on the entire cue-labs-modules-testing org. Note that porcuepine is also an org admin,
126+
// since otherwise the repo admin access to create and delete repos does not work.
127+
env: GITHUB_TOKEN: "${{ secrets.E2E_GITHUB_TOKEN }}"
128+
run: """
129+
cd internal/e2e
130+
go test
131+
"""
132+
}
133+
117134
_goCheck: json.#step & {
118135
// These checks can vary between platforms, as different code can be built
119136
// based on GOOS and GOARCH build tags.

0 commit comments

Comments
 (0)