Skip to content

Commit

Permalink
Windows CI (#244)
Browse files Browse the repository at this point in the history
Add Windows to the test matrix for the generator code.
  • Loading branch information
Porges authored Aug 28, 2020
1 parent d1d18d1 commit d8cc794
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 9 deletions.
35 changes: 26 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
strategy:
matrix:
go-version: [1.14.x]
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v1
Expand All @@ -28,32 +28,49 @@ jobs:
strategy:
matrix:
go-version: [1.14.x]
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go-version }}
- name: Enable long path support for git # sigh
if: ${{ runner.os == 'Windows' }}
run: git config --global core.longpaths true
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: 'true'
- name: Make test generator
- name: Run generator CI (Linux)
if: ${{ runner.os == 'Linux' }}
run: make -C ./hack/generator ci
- name: Coveralls
- name: Test generator (Windows)
if: ${{ runner.os == 'Windows' }}
# Makefile not supported. Linux will run lints so
# we will just run the tests here:
shell: cmd
run: |
cd hack\generator
go get github.com/jandelgado/gcov2lcov@v1.0.2
go test -tags=noexit -race -covermode atomic -coverprofile=cover.out -coverpkg=./... ./...
set exitcode=%ERRORLEVEL%
set PATH=%PATH%;%USERPROFILE%\go\bin
gcov2lcov -infile cover.out -outfile coverage.lcov
EXIT /B %exitcode%
- name: Coverall
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
path-to-lcov: ./hack/generator/coverage.lcov
flag-name: generator
flag-name: generator-${{ runner.os }}
parallel: true
test-controller:
strategy:
matrix:
go-version: [1.14.x]
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
env:
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
Expand Down
2 changes: 2 additions & 0 deletions hack/generator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ test: ; $(info $(M) running go test…)

.PHONY: test-cover
test-cover: $(GCOV2LCOV) ; $(info $(M) running go test…)
# NOTE: if you update the 'test-cover' target, also update ./github/workflows/test.yml
# for the Windows part of the "test-generator" job.
$(Q) $(GO) test -tags=noexit -race -covermode atomic -coverprofile=cover.out -coverpkg=./... ./...
$(Q) $(GCOV2LCOV) -infile cover.out -outfile coverage.lcov

Expand Down
2 changes: 2 additions & 0 deletions hack/generator/pkg/codegen/testdata/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# golden files must not have the platform’s line endings:
*.golden -text
2 changes: 2 additions & 0 deletions tools.mk
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ $(GOX): ## Build gox
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) github.com/mitchellh/gox@v1.0.1

$(GCOV2LCOV): ## Build gcov2lcov
# NOTE: if you update the version here, also update ./github/workflows/test.yml
# for the Windows part of the "test-generator" job.
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) github.com/jandelgado/gcov2lcov@v1.0.2

.PHONY: install-tools
Expand Down

0 comments on commit d8cc794

Please sign in to comment.