From 6bcd2e67e8f9d5ad2f26d00aecea44eb9835ac9f Mon Sep 17 00:00:00 2001 From: Mateusz Szostok Date: Tue, 20 Sep 2022 22:55:58 +0200 Subject: [PATCH] Run colored test on CI --- .github/workflows/testing.yml | 32 +++++++++++++++++++ tests/e2e/e2e_test.go | 6 ---- ...ersion_in_default_Pretty_format.golden.txt | 16 +++++----- ...ra_version_when_alias_v_is_used.golden.txt | 16 +++++----- ..._version_when_alias_ver_is_used.golden.txt | 16 +++++----- ..._return_default_printer_version.golden.txt | 16 +++++----- ...rsion_with_custom_Pretty_layout.golden.txt | 16 +++++----- ...ion_with_custom_Pretty_renderer.golden.txt | 16 +++++----- ...fields_in_default_Pretty_format.golden.txt | 22 ++++++------- ...notice_in_default_Pretty_format.golden.txt | 16 +++++----- ...t_hook_in_default_Pretty_format.golden.txt | 16 +++++----- ...notice_in_default_Pretty_format.golden.txt | 16 +++++----- 12 files changed, 115 insertions(+), 89 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 75796d8..c37e7bc 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -67,6 +67,38 @@ jobs: timezoneWindows: "Central European Standard Time" - name: "E2E tests" uses: magefile/mage-action@5f7a9a23cfef763949ca41834b868167adbd1b59 # v2.0.0 + env: + TEST_NAME: '[^TestExamplesColorOutput]' + with: + version: latest + args: test:e2e + + colored-e2e-test: + strategy: + matrix: + os: [ macos-latest, ubuntu-latest, windows-latest ] + runs-on: ${{matrix.os}} + steps: + - name: "Set git to use LF" + run: | + git config --global core.autocrlf false + git config --global core.eol lf + - name: "Checkout code" + uses: actions/checkout@v3 + - name: "Set up Go" + uses: actions/setup-go@v3 + with: + go-version: '1.19.1' # must be hardcoded as it's expected in tests + cache: true + - uses: szenius/set-timezone@a5c1676bd4e141779a42a699cc086f3c5ddd1a6c + with: + timezoneLinux: "Europe/Warsaw" + timezoneMacos: "Europe/Warsaw" + timezoneWindows: "Central European Standard Time" + - name: "Colored E2E tests" + uses: magefile/mage-action@5f7a9a23cfef763949ca41834b868167adbd1b59 # v2.0.0 + env: + TEST_NAME: 'TestExamplesColorOutput' with: version: latest args: test:e2e diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index 2ebb94a..51b6190 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -4,7 +4,6 @@ package integration import ( "fmt" - "os" "os/exec" "path/filepath" "runtime" @@ -205,11 +204,6 @@ var cases = []TestCases{ // // UPDATE_GOLDEN=true TEST_NAME=TestExamplesColorOutput mage test:e2e func TestExamplesColorOutput(t *testing.T) { - if os.Getenv("CI") == "true" { - t.Skip("Those tests are not stable on CI yet") - } - t.Parallel() - for _, tc := range cases { tc := tc t.Run(tc.name, func(t *testing.T) { diff --git a/tests/e2e/testdata/TestExamplesColorOutput/Should_return_cobra_version_in_default_Pretty_format.golden.txt b/tests/e2e/testdata/TestExamplesColorOutput/Should_return_cobra_version_in_default_Pretty_format.golden.txt index 5a570a9..3f8ed04 100644 --- a/tests/e2e/testdata/TestExamplesColorOutput/Should_return_cobra_version_in_default_Pretty_format.golden.txt +++ b/tests/e2e/testdata/TestExamplesColorOutput/Should_return_cobra_version_in_default_Pretty_format.golden.txt @@ -1,11 +1,11 @@ ▓▓▓ example - Version 0.6.1 - Git Commit 324d022 - Build Date 01 Apr 22 14:22 CEST (5 months ago) - Commit Date 28 Mar 22 17:32 CEST (5 months ago) - Dirty Build no - Go version 1.19.1 - Compiler gc - Platform normalized + Version 0.6.1 + Git Commit 324d022 + Build Date 01 Apr 22 14:22 CEST (5 months ago) + Commit Date 28 Mar 22 17:32 CEST (5 months ago) + Dirty Build no + Go version 1.19.1 + Compiler gc + Platform normalized diff --git a/tests/e2e/testdata/TestExamplesColorOutput/Should_return_cobra_version_when_alias_v_is_used.golden.txt b/tests/e2e/testdata/TestExamplesColorOutput/Should_return_cobra_version_when_alias_v_is_used.golden.txt index 5a570a9..3f8ed04 100644 --- a/tests/e2e/testdata/TestExamplesColorOutput/Should_return_cobra_version_when_alias_v_is_used.golden.txt +++ b/tests/e2e/testdata/TestExamplesColorOutput/Should_return_cobra_version_when_alias_v_is_used.golden.txt @@ -1,11 +1,11 @@ ▓▓▓ example - Version 0.6.1 - Git Commit 324d022 - Build Date 01 Apr 22 14:22 CEST (5 months ago) - Commit Date 28 Mar 22 17:32 CEST (5 months ago) - Dirty Build no - Go version 1.19.1 - Compiler gc - Platform normalized + Version 0.6.1 + Git Commit 324d022 + Build Date 01 Apr 22 14:22 CEST (5 months ago) + Commit Date 28 Mar 22 17:32 CEST (5 months ago) + Dirty Build no + Go version 1.19.1 + Compiler gc + Platform normalized diff --git a/tests/e2e/testdata/TestExamplesColorOutput/Should_return_cobra_version_when_alias_ver_is_used.golden.txt b/tests/e2e/testdata/TestExamplesColorOutput/Should_return_cobra_version_when_alias_ver_is_used.golden.txt index 5a570a9..3f8ed04 100644 --- a/tests/e2e/testdata/TestExamplesColorOutput/Should_return_cobra_version_when_alias_ver_is_used.golden.txt +++ b/tests/e2e/testdata/TestExamplesColorOutput/Should_return_cobra_version_when_alias_ver_is_used.golden.txt @@ -1,11 +1,11 @@ ▓▓▓ example - Version 0.6.1 - Git Commit 324d022 - Build Date 01 Apr 22 14:22 CEST (5 months ago) - Commit Date 28 Mar 22 17:32 CEST (5 months ago) - Dirty Build no - Go version 1.19.1 - Compiler gc - Platform normalized + Version 0.6.1 + Git Commit 324d022 + Build Date 01 Apr 22 14:22 CEST (5 months ago) + Commit Date 28 Mar 22 17:32 CEST (5 months ago) + Dirty Build no + Go version 1.19.1 + Compiler gc + Platform normalized diff --git a/tests/e2e/testdata/TestExamplesColorOutput/Should_return_default_printer_version.golden.txt b/tests/e2e/testdata/TestExamplesColorOutput/Should_return_default_printer_version.golden.txt index 5a570a9..3f8ed04 100644 --- a/tests/e2e/testdata/TestExamplesColorOutput/Should_return_default_printer_version.golden.txt +++ b/tests/e2e/testdata/TestExamplesColorOutput/Should_return_default_printer_version.golden.txt @@ -1,11 +1,11 @@ ▓▓▓ example - Version 0.6.1 - Git Commit 324d022 - Build Date 01 Apr 22 14:22 CEST (5 months ago) - Commit Date 28 Mar 22 17:32 CEST (5 months ago) - Dirty Build no - Go version 1.19.1 - Compiler gc - Platform normalized + Version 0.6.1 + Git Commit 324d022 + Build Date 01 Apr 22 14:22 CEST (5 months ago) + Commit Date 28 Mar 22 17:32 CEST (5 months ago) + Dirty Build no + Go version 1.19.1 + Compiler gc + Platform normalized diff --git a/tests/e2e/testdata/TestExamplesColorOutput/Should_return_version_with_custom_Pretty_layout.golden.txt b/tests/e2e/testdata/TestExamplesColorOutput/Should_return_version_with_custom_Pretty_layout.golden.txt index 1a05a95..89af25d 100644 --- a/tests/e2e/testdata/TestExamplesColorOutput/Should_return_version_with_custom_Pretty_layout.golden.txt +++ b/tests/e2e/testdata/TestExamplesColorOutput/Should_return_version_with_custom_Pretty_layout.golden.txt @@ -1,13 +1,13 @@  ╭ ▓▓▓ example ─────────────────────────────────────────────────╮  │ │ - │ Version 0.6.1 │ - │ Git Commit 324d022 │ - │ Build Date 01 Apr 22 14:22 CEST (5 months ago) │ - │ Commit Date 28 Mar 22 17:32 CEST (5 months ago) │ - │ Dirty Build no │ - │ Go Version 1.19.1 │ - │ Compiler gc │ - │ Platform normalized  │ + │ Version 0.6.1 │ + │ Git Commit 324d022 │ + │ Build Date 01 Apr 22 14:22 CEST (5 months ago) │ + │ Commit Date 28 Mar 22 17:32 CEST (5 months ago) │ + │ Dirty Build no │ + │ Go Version 1.19.1 │ + │ Compiler gc │ + │ Platform normalized  │  │ │  ╰──────────────────────────────────────────────────────────────╯ diff --git a/tests/e2e/testdata/TestExamplesColorOutput/Should_return_version_with_custom_Pretty_renderer.golden.txt b/tests/e2e/testdata/TestExamplesColorOutput/Should_return_version_with_custom_Pretty_renderer.golden.txt index c993c97..550d9e5 100644 --- a/tests/e2e/testdata/TestExamplesColorOutput/Should_return_version_with_custom_Pretty_renderer.golden.txt +++ b/tests/e2e/testdata/TestExamplesColorOutput/Should_return_version_with_custom_Pretty_renderer.golden.txt @@ -2,13 +2,13 @@ │ │ │▓▓▓ example │ │ │ -│ Version 0.6.1 │ -│ Git Commit 324d022 │ -│ Build Date 01 Apr 22 14:22 CEST (5 months ago)│ -│ Commit Date 28 Mar 22 17:32 CEST (5 months ago)│ -│ Dirty Build no │ -│ Go version 1.19.1 │ -│ Compiler gc │ -│ Platform normalized  │ +│ Version 0.6.1 │ +│ Git Commit 324d022 │ +│ Build Date 01 Apr 22 14:22 CEST (5 months ago)│ +│ Commit Date 28 Mar 22 17:32 CEST (5 months ago)│ +│ Dirty Build no │ +│ Go version 1.19.1 │ +│ Compiler gc │ +│ Platform normalized  │ │ │ ╰────────────────────────────────────────────────────────╯ diff --git a/tests/e2e/testdata/TestExamplesColorOutput/Should_return_version_with_custom_fields_in_default_Pretty_format.golden.txt b/tests/e2e/testdata/TestExamplesColorOutput/Should_return_version_with_custom_fields_in_default_Pretty_format.golden.txt index bf82b60..68a41e7 100644 --- a/tests/e2e/testdata/TestExamplesColorOutput/Should_return_version_with_custom_fields_in_default_Pretty_format.golden.txt +++ b/tests/e2e/testdata/TestExamplesColorOutput/Should_return_version_with_custom_fields_in_default_Pretty_format.golden.txt @@ -1,14 +1,14 @@ ▓▓▓ example - Version 0.6.1 - Git Commit 324d022 - Build Date 01 Apr 22 14:22 CEST (5 months ago) - Commit Date 28 Mar 22 17:32 CEST (5 months ago) - Dirty Build no - Go version 1.19.1 - Compiler gc - Platform normalized - Built By GoReleaser - Repository URL https://github.com/mszostok/version - Documentation URL https://szostok.io/projects/version + Version 0.6.1 + Git Commit 324d022 + Build Date 01 Apr 22 14:22 CEST (5 months ago) + Commit Date 28 Mar 22 17:32 CEST (5 months ago) + Dirty Build no + Go version 1.19.1 + Compiler gc + Platform normalized + Built By GoReleaser + Repository URL https://github.com/mszostok/version + Documentation URL https://szostok.io/projects/version diff --git a/tests/e2e/testdata/TestExamplesColorOutput/Should_return_version_with_custom_upgrade_notice_in_default_Pretty_format.golden.txt b/tests/e2e/testdata/TestExamplesColorOutput/Should_return_version_with_custom_upgrade_notice_in_default_Pretty_format.golden.txt index fd874e5..9f0e072 100644 --- a/tests/e2e/testdata/TestExamplesColorOutput/Should_return_version_with_custom_upgrade_notice_in_default_Pretty_format.golden.txt +++ b/tests/e2e/testdata/TestExamplesColorOutput/Should_return_version_with_custom_upgrade_notice_in_default_Pretty_format.golden.txt @@ -1,14 +1,14 @@ ▓▓▓ example - Version 0.6.1 - Git Commit 324d022 - Build Date 01 Apr 22 14:22 CEST (5 months ago) - Commit Date 28 Mar 22 17:32 CEST (5 months ago) - Dirty Build no - Go version 1.19.1 - Compiler gc - Platform normalized + Version 0.6.1 + Git Commit 324d022 + Build Date 01 Apr 22 14:22 CEST (5 months ago) + Commit Date 28 Mar 22 17:32 CEST (5 months ago) + Dirty Build no + Go version 1.19.1 + Compiler gc + Platform normalized  ╭──────────────────────────────────────────────────────────────────────╮  │ A new release is available: 0.6.1 → v0.7.4 │  │ https://github.com/mszostok/codeowners-validator/releases/tag/v0.7.4 │ diff --git a/tests/e2e/testdata/TestExamplesColorOutput/Should_return_version_with_executed_post_hook_in_default_Pretty_format.golden.txt b/tests/e2e/testdata/TestExamplesColorOutput/Should_return_version_with_executed_post_hook_in_default_Pretty_format.golden.txt index cecc4c3..2d66594 100644 --- a/tests/e2e/testdata/TestExamplesColorOutput/Should_return_version_with_executed_post_hook_in_default_Pretty_format.golden.txt +++ b/tests/e2e/testdata/TestExamplesColorOutput/Should_return_version_with_executed_post_hook_in_default_Pretty_format.golden.txt @@ -1,14 +1,14 @@ ▓▓▓ example - Version 0.6.1 - Git Commit 324d022 - Build Date 01 Apr 22 14:22 CEST (5 months ago) - Commit Date 28 Mar 22 17:32 CEST (5 months ago) - Dirty Build no - Go version 1.19.1 - Compiler gc - Platform normalized + Version 0.6.1 + Git Commit 324d022 + Build Date 01 Apr 22 14:22 CEST (5 months ago) + Commit Date 28 Mar 22 17:32 CEST (5 months ago) + Dirty Build no + Go version 1.19.1 + Compiler gc + Platform normalized │ A new release is available: 0.6.1 → v0.7.4 │ https://github.com/mszostok/codeowners-validator/releases/tag/v0.7.4 diff --git a/tests/e2e/testdata/TestExamplesColorOutput/Should_return_version_with_upgrade_notice_in_default_Pretty_format.golden.txt b/tests/e2e/testdata/TestExamplesColorOutput/Should_return_version_with_upgrade_notice_in_default_Pretty_format.golden.txt index cecc4c3..2d66594 100644 --- a/tests/e2e/testdata/TestExamplesColorOutput/Should_return_version_with_upgrade_notice_in_default_Pretty_format.golden.txt +++ b/tests/e2e/testdata/TestExamplesColorOutput/Should_return_version_with_upgrade_notice_in_default_Pretty_format.golden.txt @@ -1,14 +1,14 @@ ▓▓▓ example - Version 0.6.1 - Git Commit 324d022 - Build Date 01 Apr 22 14:22 CEST (5 months ago) - Commit Date 28 Mar 22 17:32 CEST (5 months ago) - Dirty Build no - Go version 1.19.1 - Compiler gc - Platform normalized + Version 0.6.1 + Git Commit 324d022 + Build Date 01 Apr 22 14:22 CEST (5 months ago) + Commit Date 28 Mar 22 17:32 CEST (5 months ago) + Dirty Build no + Go version 1.19.1 + Compiler gc + Platform normalized │ A new release is available: 0.6.1 → v0.7.4 │ https://github.com/mszostok/codeowners-validator/releases/tag/v0.7.4