Skip to content

Commit

Permalink
internal/e2e: join into the root Go module
Browse files Browse the repository at this point in the history
The only reason we split up the e2e tests into their own module,
as described in https://cuelang.org/cl/1171435,
was because they depended on the go-github Go library,
and we didn't want to add it as a requirement to the root module.

After https://cuelang.org/cl/1178251, go-github is no longer required,
so we can join the modules and avoid the pain caused by needing to
remember to run `go mod tidy` in internal/e2e as well.

Note that we rename the directory to internal/_e2e so that
`go test ./...` continues skipping over the package entirely,
as the end-to-end tests require secrets to function.
Not just $CUE_LOGINS for the tests against registry.cue.works,
but also `gcloud` to be authorized with the artifact repository we use.

Rather than have the tests silently skip themselves if the secrets
aren't properly set up, causing issues in CI if we don't notice,
leave the tests to fail when the necessary secrets aren't set up,
and allow explicitly runnint the e2e tests via:

    cd internal/_e2e
    export CUE_LOGINS={...}
    go test

The CI setup is also simplified slightly, as we go back to only needing
to worry about running tool checks on a single Go module.

Signed-off-by: Daniel Martí <[email protected]>
Change-Id: I400280822b06d6fad9e2bfae5c2560083182ae80
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1178256
Reviewed-by: Paul Jolly <[email protected]>
TryBot-Result: CUEcueckoo <[email protected]>
Unity-Result: CUE porcuepine <[email protected]>
  • Loading branch information
mvdan committed Mar 13, 2024
1 parent d1104bd commit 31e47e2
Show file tree
Hide file tree
Showing 11 changed files with 7 additions and 133 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/trybot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,17 +186,12 @@ jobs:
env:
CUE_LOGINS: ${{ secrets.E2E_CUE_LOGINS }}
run: |-
cd internal/e2e
cd internal/_e2e
go test -race
- if: (matrix.go-version == '1.22.x' && matrix.runner == 'ubuntu-22.04')
name: Check
run: |-
for module in . internal/e2e; do
(
cd $module
go vet ./...
go mod tidy
)
done
go vet ./...
go mod tidy
- name: Check that git is clean at the end of the job
run: test -z "$(git status --porcelain)" || (git status; git diff; false)
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ cmd/cue/cue
!**/*mod.test

# Ignore generated credentials from google-github-actions/auth,
# a GitHub Actions step used in CI for the tests in internal/e2e.
# a GitHub Actions step used in CI for the tests in internal/_e2e.
# Note that CI requires a clean git repo when it finishes,
# so we don't want it to think the credentials file is untracked.
gha-creds-*.json
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 3 additions & 10 deletions internal/ci/github/trybot.cue
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ workflows: trybot: _repo.bashWorkflow & {
// We want to catch any data races they spot as soon as possible, and they aren't CPU-bound,
// so running them only with -race seems reasonable.
run: """
cd internal/e2e
cd internal/_e2e
go test -race
"""
},
Expand All @@ -161,19 +161,12 @@ workflows: trybot: _repo.bashWorkflow & {
// However, CUE does not have any such build tags yet, and we don't use
// dependencies that vary wildly between platforms.
// For now, to save CI resources, just run the checks on one matrix job.
// We loop over all Go modules and use a subshell to run the commands in each directory;
// note that this still makes the script stop at the first command failure.
// TODO: consider adding more checks as per https://github.com/golang/go/issues/42119.
if: "\(_isLatestLinux)"
name: "Check"
run: """
for module in . internal/e2e; do
(
cd $module
go vet ./...
go mod tidy
)
done
go vet ./...
go mod tidy
"""
}

Expand Down
35 changes: 0 additions & 35 deletions internal/e2e/go.mod

This file was deleted.

79 changes: 0 additions & 79 deletions internal/e2e/go.sum

This file was deleted.

0 comments on commit 31e47e2

Please sign in to comment.