From 570ccca98faa3feda44264b8275439fa069f8203 Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Thu, 12 Jan 2023 00:45:40 +0100 Subject: [PATCH 1/8] #98 Set up FreeBSD tests via CirrusCI Since we already used CirrusCI in the beginning, we only need to modify the existing file. --- .cirrus.yml | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index ade4ba2..bced9b8 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -1,28 +1,20 @@ # SPDX-FileCopyrightText: 2022 Winni Neessen # -# SPDX-License-Identifier: CC0-1.0 +# SPDX-License-Identifier: MIT -container: - image: golang:latest +freebsd_task: + name: FreeBSD -env: - GOPROXY: https://proxy.golang.org + matrix: + - name: FreeBSD 13.1 + freebsd_instance: + image_family: freebsd-13-1 + - name: FreeBSD 12.4 + freebsd_instance: + image_family: freebsd-12-4 -lint_task: - name: GolangCI Lint - container: - image: golangci/golangci-lint:latest - run_script: golangci-lint run -v --timeout 5m0s --out-format json > lint-report.json - always: - golangci_artifacts: - path: lint-report.json - type: text/json - format: golangci - -build_task: - modules_cache: - fingerprint_script: cat go.sum - folder: $GOPATH/pkg/mod - get_script: go get github.com/wneessen/go-mail - build_script: go build github.com/wneessen/go-mail - test_script: go test -race -v -cover github.com/wneessen/go-mail/... + pkginstall_script: + - pkg update -f + - pkg install -y go + test_script: + - go test -v -race -cover -shuffle=on ./... \ No newline at end of file From 4198664737665d41fa589712eda7cd2396c6b5c9 Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Thu, 12 Jan 2023 00:52:01 +0100 Subject: [PATCH 2/8] #98 Set up FreeBSD tests via CirrusCI We need the environment also it starts in auth/ which is weird --- .cirrus.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.cirrus.yml b/.cirrus.yml index bced9b8..b122948 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -13,8 +13,18 @@ freebsd_task: freebsd_instance: image_family: freebsd-12-4 + env: + TEST_HOST: ${{ secrets.TEST_HOST }} + TEST_FROM: ${{ secrets.TEST_USER }} + TEST_ALLOW_SEND: "1" + TEST_SMTPAUTH_USER: ${{ secrets.TEST_USER }} + TEST_SMTPAUTH_PASS: ${{ secrets.TEST_PASS }} + TEST_SMTPAUTH_TYPE: "LOGIN" + pkginstall_script: - pkg update -f - pkg install -y go + test_script: + - cd .. - go test -v -race -cover -shuffle=on ./... \ No newline at end of file From 4480a2bfa7cc6194f1c3061f29686a7ba7240b2d Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Thu, 12 Jan 2023 00:54:26 +0100 Subject: [PATCH 3/8] #98 Set up FreeBSD tests via CirrusCI The .. didn't do anything but fail --- .cirrus.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index b122948..a6c95d7 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -26,5 +26,4 @@ freebsd_task: - pkg install -y go test_script: - - cd .. - go test -v -race -cover -shuffle=on ./... \ No newline at end of file From 2f053ed8ab6e4b1021ce4701e5183cb47be52db3 Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Thu, 12 Jan 2023 01:01:33 +0100 Subject: [PATCH 4/8] #98 Set up FreeBSD tests via CirrusCI Need to debug the test-host for cirrus --- client_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/client_test.go b/client_test.go index b3bed52..342ca56 100644 --- a/client_test.go +++ b/client_test.go @@ -1088,6 +1088,7 @@ func getTestConnection(auth bool) (*Client, error) { if th == "" { return nil, fmt.Errorf("no TEST_HOST set") } + fmt.Printf("XXX: TEST_HOST: %s\n", th) tp := 25 if tps := os.Getenv("TEST_PORT"); tps != "" { tpi, err := strconv.Atoi(tps) From d781217f0758df8812fa857a578e50cc94cdb380 Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Thu, 12 Jan 2023 01:05:10 +0100 Subject: [PATCH 5/8] #98 Set up FreeBSD tests via CirrusCI Cirrus does not understand the double {{}} --- .cirrus.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index a6c95d7..a1c765f 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -12,13 +12,16 @@ freebsd_task: - name: FreeBSD 12.4 freebsd_instance: image_family: freebsd-12-4 + - name: FreeBSD 12.3 + freebsd_instance: + image_family: freebsd-12-3 env: - TEST_HOST: ${{ secrets.TEST_HOST }} - TEST_FROM: ${{ secrets.TEST_USER }} + TEST_HOST: ${secrets.TEST_HOST} + TEST_FROM: ${secrets.TEST_USER} TEST_ALLOW_SEND: "1" - TEST_SMTPAUTH_USER: ${{ secrets.TEST_USER }} - TEST_SMTPAUTH_PASS: ${{ secrets.TEST_PASS }} + TEST_SMTPAUTH_USER: ${secrets.TEST_USER} + TEST_SMTPAUTH_PASS: ${secrets.TEST_PASS} TEST_SMTPAUTH_TYPE: "LOGIN" pkginstall_script: From 433980a584b4acdbfa19dcd1c8e5f2fb0233ee79 Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Thu, 12 Jan 2023 01:10:08 +0100 Subject: [PATCH 6/8] #98 Set up FreeBSD tests via CirrusCI Apparently we can't provide the secrets environment to CirrusCI, so we cannot perform the send tests --- .cirrus.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index a1c765f..1438092 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -17,16 +17,11 @@ freebsd_task: image_family: freebsd-12-3 env: - TEST_HOST: ${secrets.TEST_HOST} - TEST_FROM: ${secrets.TEST_USER} - TEST_ALLOW_SEND: "1" - TEST_SMTPAUTH_USER: ${secrets.TEST_USER} - TEST_SMTPAUTH_PASS: ${secrets.TEST_PASS} - TEST_SMTPAUTH_TYPE: "LOGIN" + TEST_ALLOW_SEND: 0 pkginstall_script: - pkg update -f - - pkg install -y go + - pkg install -y go postfix test_script: - go test -v -race -cover -shuffle=on ./... \ No newline at end of file From 64dde76a58bf3ab5fe64281f9dacd14f06370ede Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Thu, 12 Jan 2023 01:19:24 +0100 Subject: [PATCH 7/8] #98 Set up FreeBSD tests via CirrusCI Cirrus seems to kill the sendmail test, let's make it skip-able --- .cirrus.yml | 1 + msg_nowin_test.go | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/.cirrus.yml b/.cirrus.yml index 1438092..4ee1ba7 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -18,6 +18,7 @@ freebsd_task: env: TEST_ALLOW_SEND: 0 + TEST_SKIP_SENDMAIL: 1 pkginstall_script: - pkg update -f diff --git a/msg_nowin_test.go b/msg_nowin_test.go index 9eec2eb..d5dca3d 100644 --- a/msg_nowin_test.go +++ b/msg_nowin_test.go @@ -16,6 +16,9 @@ import ( // TestMsg_WriteToSendmailWithContext tests the WriteToSendmailWithContext() method of the Msg func TestMsg_WriteToSendmailWithContext(t *testing.T) { + if os.Getenv("TEST_SKIP_SENDMAIL") != "" { + t.Skipf("TEST_SKIP_SENDMAIL variable is set. Skipping sendmail test") + } tests := []struct { name string sp string @@ -42,6 +45,9 @@ func TestMsg_WriteToSendmailWithContext(t *testing.T) { // TestMsg_WriteToSendmail will test the output to the local sendmail command func TestMsg_WriteToSendmail(t *testing.T) { + if os.Getenv("TEST_SKIP_SENDMAIL") != "" { + t.Skipf("TEST_SKIP_SENDMAIL variable is set. Skipping sendmail test") + } _, err := os.Stat(SendmailPath) if err != nil { t.Skipf("local sendmail command not found in expected path. Skipping") From 09d7f1a4c4cfb852b881deac78790960f07671cf Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Thu, 12 Jan 2023 01:22:45 +0100 Subject: [PATCH 8/8] #98 Set up FreeBSD tests via CirrusCI Since we skip the sendmail test, we don't need postfix anymore --- .cirrus.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index 4ee1ba7..db9523c 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -22,7 +22,7 @@ freebsd_task: pkginstall_script: - pkg update -f - - pkg install -y go postfix + - pkg install -y go test_script: - go test -v -race -cover -shuffle=on ./... \ No newline at end of file