Skip to content

Commit

Permalink
internal/ci: only run e2e tests in source repo
Browse files Browse the repository at this point in the history
We already had the condition that the e2e tests should only run on
protected branch for the latest-linux matrix entry, but this condition
needs to be enhanced to limit this further to the source repo and not
the trybot "shadow" repo. There are no credentials available in the
latter, so e2e tests would always fail.

Signed-off-by: Paul Jolly <[email protected]>
Change-Id: I5ab31580ec48c1fac4428de18cf2963913b4bbeb
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1171699
TryBot-Result: CUEcueckoo <[email protected]>
Unity-Result: CUE porcuepine <[email protected]>
Reviewed-by: Daniel Martí <[email protected]>
  • Loading branch information
myitcv committed Nov 4, 2023
1 parent d72997f commit b15fcb0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/trybot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ jobs:
env:
GORACE: atexit_sleep_ms=10
- if: |-
((github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-branch.')) && (! (contains(github.event.head_commit.message, '
github.repository == 'cue-lang/cue' && ((github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-branch.')) && (! (contains(github.event.head_commit.message, '
Dispatch-Trailer: {"type":"')))) && (matrix.go-version == '1.21.x' && matrix.runner == 'ubuntu-22.04')
name: End-to-end test
run: |-
Expand Down
11 changes: 7 additions & 4 deletions internal/ci/github/trybot.cue
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,17 @@ workflows: trybot: _repo.bashWorkflow & {
_e2eTest: json.#step & {
name: "End-to-end test"
// The end-to-end tests require a github token secret and are a bit slow,
// so we only run them on pushes to protected branches and on one environment.
if: "\(_repo.isProtectedBranch) && \(_isLatestLinux)"
// so we only run them on pushes to protected branches and on one
// environment in the source repo.
if: "github.repository == '\(_repo.githubRepositoryPath)' && \(_repo.isProtectedBranch) && \(_isLatestLinux)"

// The secret is the fine-grained access token "cue-lang/cue ci e2e for modules-testing"
// owned by the porcuepine bot account with read+write access to repo administration and code
// on the entire cue-labs-modules-testing org. Note that porcuepine is also an org admin,
// since otherwise the repo admin access to create and delete repos does not work.
env: GITHUB_TOKEN: "${{ secrets.E2E_GITHUB_TOKEN }}"
run: """

run: """
cd internal/e2e
go test
"""
Expand All @@ -146,6 +149,6 @@ workflows: trybot: _repo.bashWorkflow & {
_goTestRace: json.#step & {
name: "Test with -race"
env: GORACE: "atexit_sleep_ms=10" // Otherwise every Go package being tested sleeps for 1s; see https://go.dev/issues/20364.
run: "go test -race ./..."
run: "go test -race ./..."
}
}

0 comments on commit b15fcb0

Please sign in to comment.