Skip to content

Commit 27be737

Browse files
authored
[Github Action] cli-test: improve naming summary (#1448)
## Summary **Motivation** The name summary for `cli-tests` in the Github PR page is: ``` test (false, ubuntu-latest, true, 2.12.0) ``` This isn't very helpful. This PR: - removes the `booleans` and changes their true/false states to explicit names - renames `devbox-json-tests` to `project-tests` for brevity. ## How was it tested? will observe the testscripts pass... Now, it looks like: ``` cli-tests / test (not-main, ubuntu-latest, project-tests, 2.12.0) ``` which is much more understandable.
1 parent d219b01 commit 27be737

File tree

3 files changed

+19
-18
lines changed

3 files changed

+19
-18
lines changed

.github/workflows/cli-release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ jobs:
2727
tests:
2828
uses: ./.github/workflows/cli-tests.yaml
2929
with:
30+
# This will run the basic testscript unit tests on MacOS.
31+
# NOTE: cli-tests will NEVER run project-tests on MacOS.
3032
run-mac-tests: true
3133

3234
edge:

.github/workflows/cli-tests.yaml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ on:
1919
type: boolean
2020
workflow_dispatch:
2121
inputs:
22-
run-devbox-json-tests:
23-
type: boolean
2422
run-mac-tests:
2523
type: boolean
2624
# run the example tests with DEVBOX_DEBUG=1
@@ -76,24 +74,25 @@ jobs:
7674
strategy:
7775
matrix:
7876
is-main:
79-
- ${{ github.ref == 'refs/heads/main' }}
77+
- ${{ github.ref == 'refs/heads/main' && 'is-main' || 'not-main' }}
8078
os: [ubuntu-latest, macos-latest]
8179
# This is an optimization that runs tests twice, with and without
8280
# the devbox.json tests. We can require the other tests to complete before
8381
# merging, while keeping the others as an additional non-required signal
84-
run-devbox-json-tests: [true, false]
82+
run-project-tests: ["project-tests", "project-tests-off"]
8583
# Run tests on:
8684
# 1. the oldest supported nix version (which is 2.9.0? But determinate-systems installer has 2.12.0)
8785
# 2. nix version 2.17.0 which introduces a new code path that minimizes nixpkgs downloads.
8886
# 3. latest nix version (currently, that is 2.17.0, so omitted)
8987
nix-version: ["2.12.0", "2.17.0"]
9088
exclude:
91-
- is-main: false
89+
- is-main: "not-main"
9290
os: "${{ inputs.run-mac-tests && 'dummy' || 'macos-latest' }}"
93-
- is-main: true
94-
run-devbox-json-tests: false
95-
- run-devbox-json-tests: true
91+
- is-main: "is-main"
92+
run-project-tests: "project-tests-off"
93+
- run-project-tests: "project-tests"
9694
os: macos-latest
95+
9796
runs-on: ${{ matrix.os }}
9897
timeout-minutes: ${{ (github.ref == 'refs/heads/main' || inputs.run-mac-tests) && 37 || 25 }}
9998
steps:
@@ -132,8 +131,8 @@ jobs:
132131
env:
133132
# For devbox.json tests, we default to non-debug mode since the debug output is less useful than for unit testscripts.
134133
# But we allow overriding via inputs.example-debug
135-
DEVBOX_DEBUG: ${{ (!matrix.run-devbox-json-tests || inputs.example-debug) && '1' || '0' }}
136-
DEVBOX_RUN_DEVBOX_JSON_TESTS: ${{ matrix.run-devbox-json-tests }}
134+
DEVBOX_DEBUG: ${{ (matrix.run-project-tests == 'project-tests-off' || inputs.example-debug) && '1' || '0' }}
135+
DEVBOX_RUN_PROJECT_TESTS: ${{ matrix.run-project-tests == 'project-tests' && '1' || '0' }}
137136
# Used in `go test -timeout` flag. Needs a value that time.ParseDuration can parse.
138137
DEVBOX_GOLANG_TEST_TIMEOUT: "${{ (github.ref == 'refs/heads/main' || inputs.run-mac-tests) && '35m' || '30m' }}"
139138
run: |

testscripts/testscripts_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import (
88
"go.jetpack.io/devbox/testscripts/testrunner"
99
)
1010

11-
// When true, tests that `devbox run run_test` succeeds on every devbox.json
11+
// When true, tests that `devbox run run_test` succeeds on every project (i.e. having devbox.json)
1212
// found in examples/.. and testscripts/..
13-
const runDevboxJSONTests = "DEVBOX_RUN_DEVBOX_JSON_TESTS"
13+
const runProjectTests = "DEVBOX_RUN_PROJECT_TESTS"
1414

1515
func TestScripts(t *testing.T) {
1616
// To run a specific test, say, testscripts/foo/bar.test.text, then run
@@ -24,21 +24,21 @@ func TestMain(m *testing.M) {
2424

2525
// TestExamples runs testscripts on the devbox-projects in the examples folder.
2626
func TestExamples(t *testing.T) {
27-
isOn, err := strconv.ParseBool(os.Getenv(runDevboxJSONTests))
27+
isOn, err := strconv.ParseBool(os.Getenv(runProjectTests))
2828
if err != nil || !isOn {
29-
t.Skipf("Skipping TestExamples. To enable, set %s=1.", runDevboxJSONTests)
29+
t.Skipf("Skipping TestExamples. To enable, set %s=1.", runProjectTests)
3030
}
3131

3232
// To run a specific test, say, examples/foo/bar, then run
3333
// go test ./testscripts -run TestExamples/foo_bar_run_test
3434
testrunner.RunDevboxTestscripts(t, "../examples")
3535
}
3636

37-
// TestScriptsWithDevboxJSON runs testscripts on the devbox-projects in the testscripts folder.
38-
func TestScriptsWithDevboxJSON(t *testing.T) {
39-
isOn, err := strconv.ParseBool(os.Getenv(runDevboxJSONTests))
37+
// TestScriptsWithProjects runs testscripts on the devbox-projects in the testscripts folder.
38+
func TestScriptsWithProjects(t *testing.T) {
39+
isOn, err := strconv.ParseBool(os.Getenv(runProjectTests))
4040
if err != nil || !isOn {
41-
t.Skipf("Skipping TestExamples. To enable, set %s=1.", runDevboxJSONTests)
41+
t.Skipf("Skipping TestScriptsWithProjects. To enable, set %s=1.", runProjectTests)
4242
}
4343

4444
testrunner.RunDevboxTestscripts(t, ".")

0 commit comments

Comments
 (0)