From 8476589e0d5638fb318e481d1bedbf69042f2a82 Mon Sep 17 00:00:00 2001 From: Yuri Norwood <106889957+norwd@users.noreply.github.com> Date: Mon, 31 Oct 2022 08:43:22 +1300 Subject: [PATCH 1/4] Separate windows step from *nix runners MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows `bash` and `pwsh` syntax to be used separately to avoid having to write the test as a polyglot 😬 Also added `secrets.GITHUB_TOKEN` as a fallback in case the repo secret `secrets.GH_TOKEN` is not set up, e.g. in a fork. Signed-off-by: Yuri Norwood <106889957+norwd@users.noreply.github.com> --- .github/workflows/selftest.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/selftest.yml b/.github/workflows/selftest.yml index e7c2699..01e4a4e 100644 --- a/.github/workflows/selftest.yml +++ b/.github/workflows/selftest.yml @@ -24,11 +24,19 @@ jobs: - name: Install gotestfmt uses: ./ with: - token: ${{ secrets.GH_TOKEN }} + token: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }} - name: Run gotestfmt + if: matrix.os != 'windows' working-directory: testdata - run: go test -json -v ./... 2>&1 | tee /tmp/gotest.${{ matrix.os }}.log | gotestfmt + run: | + go test -json -v ./... 2>&1 | tee /tmp/gotest.${{ matrix.os }}.log | gotestfmt + + - name: Run gotestfmt (Windows) + if: matrix.os == 'windows' + working-directory: testdata + run: | + go test -json -v ./... 2>&1 | Tee-Object /tmp/gotest.${{ matrix.os }}.log | gotestfmt - name: Upload test log uses: actions/upload-artifact@v3 From d31d8ad0fa5b4f18a0f3197f0c9702f02bd336d3 Mon Sep 17 00:00:00 2001 From: Yuri Norwood <106889957+norwd@users.noreply.github.com> Date: Mon, 31 Oct 2022 09:05:21 +1300 Subject: [PATCH 2/4] Remove `/tmp` directory for artifacts On MacOS, this results in: ``` Error: Provided rootDirectory /tmp is not a valid directory ``` On Windows this results in: ``` Error: No files were found with the provided path: /tmp/gotest.windows.log. No artifacts will be uploaded. ``` Both seem to be unhappy with `/tmp`, since the workspace is implicitly cleaned up at the end of the workflow, there shouldn't be a need to specify `/tmp`. Signed-off-by: Yuri Norwood <106889957+norwd@users.noreply.github.com> --- .github/workflows/selftest.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/selftest.yml b/.github/workflows/selftest.yml index 01e4a4e..1794c62 100644 --- a/.github/workflows/selftest.yml +++ b/.github/workflows/selftest.yml @@ -30,18 +30,18 @@ jobs: if: matrix.os != 'windows' working-directory: testdata run: | - go test -json -v ./... 2>&1 | tee /tmp/gotest.${{ matrix.os }}.log | gotestfmt + go test -json -v ./... 2>&1 | tee gotest.${{ matrix.os }}.log | gotestfmt - name: Run gotestfmt (Windows) if: matrix.os == 'windows' working-directory: testdata run: | - go test -json -v ./... 2>&1 | Tee-Object /tmp/gotest.${{ matrix.os }}.log | gotestfmt + go test -json -v ./... 2>&1 | Tee-Object gotest.${{ matrix.os }}.log | gotestfmt - name: Upload test log uses: actions/upload-artifact@v3 if: always() with: name: test-log-${{ matrix.os }} - path: /tmp/gotest.${{ matrix.os }}.log + path: gotest.${{ matrix.os }}.log if-no-files-found: error From b5ad6db9f33e094cacb28fb9f63d067a93423d1b Mon Sep 17 00:00:00 2001 From: Yuri Norwood <106889957+norwd@users.noreply.github.com> Date: Mon, 31 Oct 2022 09:07:38 +1300 Subject: [PATCH 3/4] Name each workflow run of the matrix Signed-off-by: Yuri Norwood <106889957+norwd@users.noreply.github.com> --- .github/workflows/selftest.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/selftest.yml b/.github/workflows/selftest.yml index 1794c62..58406fd 100644 --- a/.github/workflows/selftest.yml +++ b/.github/workflows/selftest.yml @@ -10,6 +10,7 @@ jobs: matrix: os: ['ubuntu', 'macos', 'windows'] + name: on ${{ matrix.os }} runs-on: ${{ matrix.os }}-latest steps: From d8476f19772629ef6488ba605f0d75f28e5b39e5 Mon Sep 17 00:00:00 2001 From: Yuri Norwood <106889957+norwd@users.noreply.github.com> Date: Mon, 31 Oct 2022 09:08:57 +1300 Subject: [PATCH 4/4] Fix artifact path Signed-off-by: Yuri Norwood <106889957+norwd@users.noreply.github.com> --- .github/workflows/selftest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/selftest.yml b/.github/workflows/selftest.yml index 58406fd..2474bd3 100644 --- a/.github/workflows/selftest.yml +++ b/.github/workflows/selftest.yml @@ -44,5 +44,5 @@ jobs: if: always() with: name: test-log-${{ matrix.os }} - path: gotest.${{ matrix.os }}.log + path: testdata/gotest.${{ matrix.os }}.log if-no-files-found: error