Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

use msys2 on Windows #221

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 4 additions & 4 deletions templates/.github/workflows/go-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Install staticcheck
run: go install honnef.co/go/tools/cmd/staticcheck@df71e5d0e0ed317ebf43e6e59cf919430fa4b8f2 # 2021.1.1 (v0.2.1)
- name: Check that go.mod is tidy
uses: protocol/multiple-go-modules@v1.2
uses: protocol/multiple-go-modules@v1.3
with:
run: |
go mod tidy
Expand All @@ -45,18 +45,18 @@ jobs:
fi
- name: go vet
if: ${{ success() || failure() }} # run this step even if the previous one failed
uses: protocol/multiple-go-modules@v1.2
uses: protocol/multiple-go-modules@v1.3
with:
run: go vet ./...
- name: staticcheck
if: ${{ success() || failure() }} # run this step even if the previous one failed
uses: protocol/multiple-go-modules@v1.2
uses: protocol/multiple-go-modules@v1.3
with:
run: |
set -o pipefail
staticcheck ./... | sed -e 's@\(.*\)\.go@./\1.go@g'
- name: go generate
uses: protocol/multiple-go-modules@v1.2
uses: protocol/multiple-go-modules@v1.3
if: (success() || failure()) && env.RUNGOGENERATE == 'true'
with:
run: |
Expand Down
24 changes: 15 additions & 9 deletions templates/.github/workflows/go-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ "ubuntu", "windows", "macos" ]
go: [ "1.16.x", "1.17.x" ]
os:
- { name: "ubuntu", shell: "bash" }
- { name: "macos", shell: "bash" }
- { name: "windows", shell: "msys2 {0}" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we could derive the shell by default from the OS name, to reduce verbosity.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not without a separate step I think.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE: this is a breaking change if someone started using os.name in their custom go-test-setup/action.yml. I don't expect there are many (if any) places like this so I can just keep an eye out for failing sync PRs once we propagate this change throughout the repos and fix where needed.

env:
COVERAGES: ""
runs-on: ${{ matrix.os }}-latest
name: ${{ matrix.os}} (go ${{ matrix.go }})
runs-on: ${{ matrix.os.name }}-latest
name: ${{ matrix.os.name }} (go ${{ matrix.go }})
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -27,19 +30,22 @@ jobs:
uses: ./.github/actions/go-test-setup
if: hashFiles('./.github/actions/go-test-setup') != ''
- name: Run tests
uses: protocol/multiple-go-modules@v1.2
uses: protocol/multiple-go-modules@v1.3
shell: ${{ matrix.os.shell }}
with:
run: go test -v -coverprofile module-coverage.txt ./...
- name: Run tests (32 bit)
if: ${{ matrix.os != 'macos' }} # can't run 32 bit tests on OSX.
uses: protocol/multiple-go-modules@v1.2
if: ${{ matrix.os.name != 'macos' }} # can't run 32 bit tests on OSX.
uses: protocol/multiple-go-modules@v1.3
shell: ${{ matrix.os.shell }}
env:
GOARCH: 386
with:
run: go test -v ./...
- name: Run tests with race detector
if: ${{ matrix.os == 'ubuntu' }} # speed things up. Windows and OSX VMs are slow
uses: protocol/multiple-go-modules@v1.2
if: ${{ matrix.os.name == 'ubuntu' }} # speed things up. Windows and OSX VMs are slow
uses: protocol/multiple-go-modules@v1.3
shell: ${{ matrix.os.shell }}
with:
run: go test -v -race ./...
- name: Collect coverage files
Expand All @@ -49,4 +55,4 @@ jobs:
uses: codecov/codecov-action@51d810878be5422784e86451c0e7c14e5860ec47 # v2.0.2
with:
files: '${{ env.COVERAGES }}'
env_vars: OS=${{ matrix.os }}, GO=${{ matrix.go }}
env_vars: OS=${{ matrix.os.name }}, GO=${{ matrix.go }}