Skip to content

Commit

Permalink
chore: Run testscript tests in separate job
Browse files Browse the repository at this point in the history
  • Loading branch information
KapJI committed Nov 8, 2024
1 parent 3bbc077 commit ab9b4b0
Show file tree
Hide file tree
Showing 3 changed files with 1,737 additions and 1 deletion.
19 changes: 18 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,14 @@ jobs:
name: chezmoi-windows-amd64
path: dist/chezmoi-nocgo_windows_amd64_v1/chezmoi.exe
test-ubuntu:
name: test-ubuntu-umask${{ matrix.umask }}-${{ matrix.test-index }}
strategy:
fail-fast: false
matrix:
umask:
- "022"
- "002"
test-index: [0, 1]
needs: changes
runs-on: ubuntu-20.04 # use older Ubuntu for older glibc
permissions:
Expand Down Expand Up @@ -314,12 +316,27 @@ jobs:
- name: run
run: |
go run . --version
- name: install-gotestsum
run: go install gotest.tools/gotestsum@latest
- name: split-integration-tests
id: test-split
uses: hashicorp-forge/go-test-split-action@v1
with:
index: ${{ matrix.test-index }}
total: 2
junit-summary: ./tests-summary.xml
- name: test-umask-${{ matrix.umask }}
if: github.event_name == 'push' || needs.changes.outputs.code == 'true'
env:
CHEZMOI_GITHUB_TOKEN: ${{ secrets.CHEZMOI_GITHUB_TOKEN }}
run: |
go test -ldflags="-X github.com/twpayne/chezmoi/v2/internal/chezmoitest.umaskStr=0o${{ matrix.umask }}" -race -timeout=1h ./...
gotestsum --junitfile node-summary.xml --format short-verbose -- -run "${{ steps.test-split.outputs.run }}" -ldflags="-X github.com/twpayne/chezmoi/v2/internal/chezmoitest.umaskStr=0o${{ matrix.umask }}" -race -timeout=1h -count=1
- name: upload-test-artifacts
uses: actions/upload-artifact@v4
with:
name: test-summary-uname${{ matrix.uname }}-${{ matrix.test-index }}
path: node-summary.xml
retention-days: 1
test-website:
runs-on: ubuntu-22.04
permissions:
Expand Down
3 changes: 3 additions & 0 deletions internal/cmd/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ func TestMain(m *testing.M) {
}

func TestScript(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode.")
}
testscript.Run(t, testscript.Params{
Dir: filepath.Join("testdata", "scripts"),
Cmds: map[string]func(*testscript.TestScript, bool, []string){
Expand Down
Loading

0 comments on commit ab9b4b0

Please sign in to comment.