Merge #148: Cirrus: Also run unit tests on Fedora

5e6b643ad6 Fix go-systemd import with Go modules (Jeremy Rand)
468f40c70e Cirrus: Fix nctestsuite when GOPATH not set (Jeremy Rand)
bb369d083c Cirrus: Fix error when GOPATH is unset (Jeremy Rand)
3db1ee0c33 Cirrus: Add Fedora Unit Tests task (Jeremy Rand)
a0eb8a7034 Cirrus: Factor out container image for Unit Test task (Jeremy Rand)

Pull request description:

  Requested by Stuart Gathman for Fedora packaging.

Top commit has no ACKs.

Tree-SHA512: c09b0d7505821abd721c768cf9a13da48566004937087e0ff0eef7ab78ecf337dbc4935b7e64f3a9783a8991e23432813ac543b3578e2b4f9c34f7b7e65991e0
pull/142/head
Jeremy Rand 3 years ago
commit 86ccd0cbbc
No known key found for this signature in database
GPG Key ID: FD7550C2EB800711

@ -37,8 +37,7 @@ task:
fetch_script:
- cd $(go env GOPATH)/src/github.com/"$CIRRUS_REPO_FULL_NAME"
- go mod init
- go mod tidy
- go mod edit -replace github.com/namecoin/x509-compressed=../x509-compressed
- go mod edit -replace github.com/coreos/go-systemd=github.com/coreos/go-systemd/v22@latest -replace github.com/namecoin/x509-compressed=../x509-compressed
- go mod tidy
lint_script:
- cd $(go env GOPATH)/src/github.com/$CIRRUS_REPO_FULL_NAME/
@ -75,13 +74,23 @@ task:
lint_script: bash testdata/shellcheck.bash
task:
name: "Unit Tests Go $GO_VERSION$MODULES_NAME"
name: "Unit Tests $CONTAINER_NAME$MODULES_NAME"
alias: Unit Tests
container:
image: golang:$GO_VERSION
install_script:
- apt-get update
- apt-get install -y libcap-dev
matrix:
- env:
GO_VERSION: latest
CONTAINER_NAME: "Go $GO_VERSION"
container:
image: golang:$GO_VERSION
install_script:
- apt-get update
- apt-get install -y libcap-dev
- env:
CONTAINER_NAME: "Fedora latest"
container:
image: fedora:latest
install_script:
- dnf install -y golang libcap-devel
path_script:
- source testdata/move_to_gopath.bash
matrix:
@ -108,8 +117,7 @@ task:
fetch_script:
- cd $(go env GOPATH)/src/github.com/"$CIRRUS_REPO_FULL_NAME"
- go mod init
- go mod tidy
- go mod edit -replace github.com/namecoin/x509-compressed=../x509-compressed
- go mod edit -replace github.com/coreos/go-systemd=github.com/coreos/go-systemd/v22@latest -replace github.com/namecoin/x509-compressed=../x509-compressed
- go mod tidy
# Get the test suite
- mkdir -p $(go env GOPATH)/src/github.com/hlandau
@ -118,10 +126,10 @@ task:
test_script:
- cd $(go env GOPATH)/src/github.com/"$CIRRUS_REPO_FULL_NAME"
- go install -tags "$GOX_TAGS" -v ./...
- export GOPATH=$(go env GOPATH)
- go test -tags "$GOX_TAGS" -v github.com/$CIRRUS_REPO_FULL_NAME/...
env:
GOX_TAGS: ""
GO_VERSION: latest
task:
name: "Cross-Compile Go $GO_VERSION$MODULES_NAME"
@ -165,8 +173,7 @@ task:
fetch_script:
- cd $(go env GOPATH)/src/github.com/"$CIRRUS_REPO_FULL_NAME"
- go mod init
- go mod tidy
- go mod edit -replace github.com/namecoin/x509-compressed=../x509-compressed
- go mod edit -replace github.com/coreos/go-systemd=github.com/coreos/go-systemd/v22@latest -replace github.com/namecoin/x509-compressed=../x509-compressed
- go mod tidy
build_script:
- rm -rf idist

@ -5,3 +5,4 @@ linters-settings:
replace-local: true
replace-allow-list:
- "github.com/namecoin/x509-compressed"
- "github.com/coreos/go-systemd"

@ -113,8 +113,7 @@ Option B: Using Go build commands with Go modules (works on any platform with Ba
~~~
go mod init
go mod tidy
go mod edit -replace github.com/namecoin/x509-compressed=../x509-compressed
go mod edit -replace github.com/coreos/go-systemd=github.com/coreos/go-systemd/v22@latest -replace github.com/namecoin/x509-compressed=../x509-compressed
go mod tidy
~~~

@ -4,10 +4,8 @@ set -euxo pipefail
shopt -s nullglob globstar
# set GOPATH if empty (travis sets it, but useful for humans)
if [ -z "$GOPATH" ]; then
GOPATH=$(go env GOPATH)
GOPATH="$(go env GOPATH)"
export GOPATH
fi
mkdir -p "$GOPATH"/src/github.com/"$CIRRUS_REPO_OWNER"
cp -av "$PWD" "$GOPATH"/src/github.com/"$CIRRUS_REPO_FULL_NAME"

Loading…
Cancel
Save