Merge pull request #99 from wneessen/98-set-up-freebsd-tests-via-cirrus-ci

Set up FreeBSD tests via CirrusCI
This commit is contained in:
Winni Neessen 2023-01-12 01:30:17 +01:00 committed by GitHub
commit a7126b4201
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 22 deletions

View file

@ -1,28 +1,28 @@
# SPDX-FileCopyrightText: 2022 Winni Neessen <winni@neessen.dev> # SPDX-FileCopyrightText: 2022 Winni Neessen <winni@neessen.dev>
# #
# SPDX-License-Identifier: CC0-1.0 # SPDX-License-Identifier: MIT
container: freebsd_task:
image: golang:latest name: FreeBSD
env: matrix:
GOPROXY: https://proxy.golang.org - name: FreeBSD 13.1
freebsd_instance:
image_family: freebsd-13-1
- name: FreeBSD 12.4
freebsd_instance:
image_family: freebsd-12-4
- name: FreeBSD 12.3
freebsd_instance:
image_family: freebsd-12-3
lint_task: env:
name: GolangCI Lint TEST_ALLOW_SEND: 0
container: TEST_SKIP_SENDMAIL: 1
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: pkginstall_script:
modules_cache: - pkg update -f
fingerprint_script: cat go.sum - pkg install -y go
folder: $GOPATH/pkg/mod
get_script: go get github.com/wneessen/go-mail test_script:
build_script: go build github.com/wneessen/go-mail - go test -v -race -cover -shuffle=on ./...
test_script: go test -race -v -cover github.com/wneessen/go-mail/...

View file

@ -1088,6 +1088,7 @@ func getTestConnection(auth bool) (*Client, error) {
if th == "" { if th == "" {
return nil, fmt.Errorf("no TEST_HOST set") return nil, fmt.Errorf("no TEST_HOST set")
} }
fmt.Printf("XXX: TEST_HOST: %s\n", th)
tp := 25 tp := 25
if tps := os.Getenv("TEST_PORT"); tps != "" { if tps := os.Getenv("TEST_PORT"); tps != "" {
tpi, err := strconv.Atoi(tps) tpi, err := strconv.Atoi(tps)

View file

@ -16,6 +16,9 @@ import (
// TestMsg_WriteToSendmailWithContext tests the WriteToSendmailWithContext() method of the Msg // TestMsg_WriteToSendmailWithContext tests the WriteToSendmailWithContext() method of the Msg
func TestMsg_WriteToSendmailWithContext(t *testing.T) { 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 { tests := []struct {
name string name string
sp string sp string
@ -42,6 +45,9 @@ func TestMsg_WriteToSendmailWithContext(t *testing.T) {
// TestMsg_WriteToSendmail will test the output to the local sendmail command // TestMsg_WriteToSendmail will test the output to the local sendmail command
func TestMsg_WriteToSendmail(t *testing.T) { 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) _, err := os.Stat(SendmailPath)
if err != nil { if err != nil {
t.Skipf("local sendmail command not found in expected path. Skipping") t.Skipf("local sendmail command not found in expected path. Skipping")