-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This change set addresses #94 and ports baur to Windows. The `make release` command will create a _baur.exe_ file. Things to note: 1. A [breaking change](golang/go#34610) was introduced to golang.org/x/sys that prevents github.com/docker/docker from compiling. This issue in github.com/docker/docker will not be [fixed](moby/moby#40021) until v20 of github.com/docker/docker is released. In the meantime I have pinned golang.org/x/sys to the latest version before the breaking change was introduced. 2. Some of the existing tests used commands specific to Unix. These have either been replaced with equivalent commands available directly on both Unix and Windows or run via `cmd /C` on Windows. 3. Windows does not allow files that are in use to be deleted in the same way as Unix. In some tests files and folders had to be released so the test cleanup succeeds. 4. Expected paths have been updated to use OS specific path separators where required. 5. CircleCI does not provide Windows containers but does provide Windows VMs * The pre-installed version of golang is 1.12.7, this needs to be updated on every build. See [software-pre-installed-in-the-windows-image](https://circleci.com/docs/2.0/hello-world-windows/#software-pre-installed-in-the-windows-image) * I could not access Unix docker containers from within the Windows job so postgres is installed on the VM via chocolatey and the default "postgres" database is used. * The tests are much slower to run on Windows than Unix, the test timeout has been increased to accommodate this. * The `-race` flag has been removed from the Windows `go test` command as a gcc compiler is not installed. I figured this wasn't a problem as it is used in the existing test job. This could be addressed later if necessary.
- Loading branch information
1 parent
7fd2b6c
commit 692dc80
Showing
232 changed files
with
91,053 additions
and
21,740 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
# Golang CircleCI 2.0 configuration file | ||
# Check https://circleci.com/docs/2.0/language-go/ for more details | ||
version: 2 | ||
version: 2.1 | ||
|
||
orbs: | ||
win: circleci/[email protected] | ||
|
||
jobs: | ||
test: | ||
test_linux: | ||
docker: | ||
- image: circleci/golang:1 | ||
environment: | ||
|
@@ -48,7 +52,46 @@ jobs: | |
- store_test_results: | ||
path: /tmp/test-results | ||
|
||
build: | ||
test_windows: | ||
executor: win/default | ||
|
||
environment: | ||
GOFLAGS: -mod=vendor | ||
TEST_RESULTS: ~/test-results | ||
BAUR_TEST_POSTGRESQL_URL: "postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable" | ||
|
||
working_directory: ~/baur | ||
|
||
steps: | ||
- checkout | ||
|
||
- run: | ||
name: Preparing Test Environment | ||
command: | | ||
choco install golang --version=1.15.2 -y | ||
choco install postgresql12 --params '/Password:postgres' -y | ||
New-Item -ItemType Directory -Force -Path $Env:TEST_RESULTS | ||
- run: | ||
name: Run Tests | ||
command: | | ||
$go111module = $Env:GO111MODULE | ||
$Env:GO111MODULE="off" | ||
go get github.com/jstemmer/go-junit-report | ||
$Env:GO111MODULE=$go111module | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "baur" | ||
$testResultDir = Resolve-Path $Env:TEST_RESULTS | ||
$testOutputPath = Join-Path $testResultDir "go-test.out" | ||
$testReportPath = Join-Path $testResultDir "go-test-report.xml" | ||
try { go test --tags=dbtest -v -timeout 5m .\... | Tee-Object -FilePath $testOutputPath } ` | ||
finally { Get-Content -Path $testOutputPath | go-junit-report > $testReportPath; ` | ||
[System.Io.File]::ReadAllText($testReportPath) | Out-File -FilePath $testReportPath -Encoding utf8 } | ||
- store_test_results: | ||
path: ~\test-results | ||
|
||
build_linux: | ||
docker: | ||
- image: circleci/golang:1 | ||
|
||
|
@@ -60,7 +103,7 @@ jobs: | |
name: Building baur | ||
command: make baur | ||
|
||
static_analysis: | ||
static_analysis_linux: | ||
docker: | ||
- image: golangci/golangci-lint:v1.31.0 | ||
|
||
|
@@ -73,9 +116,10 @@ jobs: | |
command: golangci-lint run | ||
|
||
workflows: | ||
version: 2 | ||
version: 2.1 | ||
workflow: | ||
jobs: | ||
- build | ||
- test | ||
- static_analysis | ||
- build_linux | ||
- test_linux | ||
- test_windows | ||
- static_analysis_linux |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.