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-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
- name: FreeBSD 12.3
freebsd_instance:
image_family: freebsd-12-3
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
env:
TEST_ALLOW_SEND: 0
TEST_SKIP_SENDMAIL: 1
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 ./...

View file

@ -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)

View file

@ -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")