From a0eb8a7034e3d7aaea2d02c7d7aec6fd2161e993 Mon Sep 17 00:00:00 2001 From: Jeremy Rand Date: Thu, 17 Jun 2021 04:06:38 +0000 Subject: [PATCH 1/5] Cirrus: Factor out container image for Unit Test task --- .cirrus.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 1b6bc36..296247c 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -75,10 +75,8 @@ 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 @@ -115,13 +113,18 @@ task: - mkdir -p $(go env GOPATH)/src/github.com/hlandau - cd $(go env GOPATH)/src/github.com/hlandau - git clone https://github.com/hlandau/nctestsuite.git + matrix: + - env: + GO_VERSION: latest + CONTAINER_NAME: "Go $GO_VERSION" + container: + image: golang:$GO_VERSION test_script: - cd $(go env GOPATH)/src/github.com/"$CIRRUS_REPO_FULL_NAME" - go install -tags "$GOX_TAGS" -v ./... - 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" From 3db1ee0c33818bbddb7ade8f92f7c25a3a2043e0 Mon Sep 17 00:00:00 2001 From: Jeremy Rand Date: Thu, 17 Jun 2021 04:17:19 +0000 Subject: [PATCH 2/5] Cirrus: Add Fedora Unit Tests task --- .cirrus.yml | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 296247c..4a70a34 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -77,9 +77,21 @@ task: task: name: "Unit Tests $CONTAINER_NAME$MODULES_NAME" alias: Unit Tests - 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: @@ -113,12 +125,6 @@ task: - mkdir -p $(go env GOPATH)/src/github.com/hlandau - cd $(go env GOPATH)/src/github.com/hlandau - git clone https://github.com/hlandau/nctestsuite.git - matrix: - - env: - GO_VERSION: latest - CONTAINER_NAME: "Go $GO_VERSION" - container: - image: golang:$GO_VERSION test_script: - cd $(go env GOPATH)/src/github.com/"$CIRRUS_REPO_FULL_NAME" - go install -tags "$GOX_TAGS" -v ./... From bb369d083c636ed77009d5121f7abdebc80461af Mon Sep 17 00:00:00 2001 From: Jeremy Rand Date: Thu, 17 Jun 2021 04:41:08 +0000 Subject: [PATCH 3/5] Cirrus: Fix error when GOPATH is unset --- testdata/move_to_gopath.bash | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/testdata/move_to_gopath.bash b/testdata/move_to_gopath.bash index 5ecd78e..739ae38 100644 --- a/testdata/move_to_gopath.bash +++ b/testdata/move_to_gopath.bash @@ -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" From 468f40c70e8bda739cf687ff31f843b6a367e1e0 Mon Sep 17 00:00:00 2001 From: Jeremy Rand Date: Thu, 17 Jun 2021 05:32:21 +0000 Subject: [PATCH 4/5] Cirrus: Fix nctestsuite when GOPATH not set --- .cirrus.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.cirrus.yml b/.cirrus.yml index 4a70a34..9538cb6 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -128,6 +128,7 @@ 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: "" From 5e6b643ad683d17af93805620713f31e0c79fc4e Mon Sep 17 00:00:00 2001 From: Jeremy Rand Date: Thu, 17 Jun 2021 06:58:26 +0000 Subject: [PATCH 5/5] Fix go-systemd import with Go modules See https://github.com/coreos/go-systemd/issues/321 --- .cirrus.yml | 9 +++------ .golangci.yml | 1 + README.md | 3 +-- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 9538cb6..b9381b6 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -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/ @@ -118,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 @@ -175,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 diff --git a/.golangci.yml b/.golangci.yml index ef1742a..53e6130 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -5,3 +5,4 @@ linters-settings: replace-local: true replace-allow-list: - "github.com/namecoin/x509-compressed" + - "github.com/coreos/go-systemd" diff --git a/README.md b/README.md index 1c44978..7f4c399 100644 --- a/README.md +++ b/README.md @@ -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 ~~~