Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,24 +85,22 @@ jobs:
mise run
${{ matrix.cover && 'cover:default' || 'test:default' }}
${{ matrix.race && '--race' || '' }}
--format github-actions-fails
# NB:
# Windows tests are already slow.
# Run them without race detection to avoid slowing them further.
shell: bash
env:
GOTESTSUM_FORMAT: github-actions

- name: Script tests
if: ${{ matrix.suite == 'script' }}
run: |
mise run \
${{ matrix.cover && 'cover:script' || 'test:script' }} \
${{ matrix.race && '--race' || '' }} \
--format github-actions-fails \
--shard-index "${{ matrix.shard-index || '0' }}" \
--shard-count "${{ matrix.shard-count || '1' }}"
shell: bash
env:
GOTESTSUM_FORMAT: github-actions

- name: Upload coverage
uses: codecov/codecov-action@v6.0.0
Expand Down
71 changes: 39 additions & 32 deletions mise.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 10 additions & 8 deletions mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
experimental = true

[env]
GOTESTSUM_FORMAT = "testname"
GOBIN = "{{ config_root }}/bin"
PROJECT_ROOT = "{{ config_root }}"
_.path = ["{{ config_root }}/bin"]
Expand All @@ -18,7 +17,8 @@ requiredfield = "github:abhinav/requiredfield"
go = "latest"

# Test runner with prettier output.
gotestsum = "latest"
# https://github.com/gotestyourself/gotestsum/pull/568
"github:abhinav/gotestsum" = "v1.14.0-beta.1+github-actions-fails"

# Collection of linters.
golangci-lint = "latest"
Expand All @@ -43,8 +43,9 @@ wait_for = ["generate"]
description = "Run default tests"
usage = '''
flag "--race" default="false" help="Enable data race detection"
flag "--format <format>" default="standard-verbose" help="gotestsum output format"
'''
run = "gotestsum -- ./... -race={{usage.race}}"
run = "gotestsum --format={{usage.format}} -- ./... -race={{usage.race}}"

[tasks."test:script"]
wait_for = ["generate"]
Expand All @@ -54,6 +55,7 @@ flag "-v --verbose" default="false" help="Enable verbose output"
flag "--race" default="false" help="Enable data race detection"
flag "--update" default="false" help="Update expected results"
flag "--count <count>" default="1" help="Number of times to run tests"
flag "--format <format>" default="standard-verbose" help="gotestsum output format"

flag "--shard-index <shard_index>" default="0" help="Shard index to run"
flag "--shard-count <shard_count>" default="1" help="Total number of shards"
Expand All @@ -62,9 +64,7 @@ flag "--run <script>" default="" help="Regex to select which script tests to run
complete "script" run="ls testdata/script/*.txt | cut -d/ -f3 | sed 's/.txt$//'"
'''
run = """
gotestsum
{%- if usage.verbose %} --format=standard-verbose
{%- endif %} -- {# -#}
gotestsum --format={{usage.format}} -- {# -#}
-tags=script {# enable script tests -#}
-run TestScript/{{usage.run}} {# run only script tests -#}
-count {{usage.count}} {# number of times to run tests -#}
Expand All @@ -83,9 +83,10 @@ depends_post = ["_cover_report"]
description = "Run default tests with coverage"
usage = '''
flag "--race" default="false" help="Enable data race detection"
flag "--format <format>" default="standard-verbose" help="gotestsum output format"
'''
run = """
gotestsum -- {# -#}
gotestsum --format={{usage.format}} -- {# -#}
./... {# run all tests -#}
-race={{usage.race}} {# race detection -#}
-coverpkg=./... {# cover all packages -#}
Expand All @@ -98,12 +99,13 @@ depends_post = ["_cover_report"]
description = "Run script tests with coverage"
usage = '''
flag "--race" default="false" help="Enable data race detection"
flag "--format <format>" default="standard-verbose" help="gotestsum output format"

flag "--shard-index <shard_index>" default="0" help="Shard index to run"
flag "--shard-count <shard_count>" default="1" help="Total number of shards"
'''
run = """
gotestsum -- {# -#}
gotestsum --format={{usage.format}} -- {# -#}
-tags=script {# enable script tests -#}
-run '^TestScript$' {# run only script tests -#}
-race={{usage.race}} {# race detection -#}
Expand Down
2 changes: 0 additions & 2 deletions script_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ func TestScript(t *testing.T) {
continue
}

t.Logf("Selected script: %s", script)

bs, err := os.ReadFile(script)
require.NoError(t, err)
dst := filepath.Join(shardScriptDir, filepath.Base(script))
Expand Down
Loading