2024-10-26 15:57:27 +02:00
|
|
|
# SPDX-FileCopyrightText: 2024 The go-mail Authors
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
|
2024-10-26 15:33:05 +02:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
|
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref_name }}
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
codecov:
|
|
|
|
name: Test with Codecov coverage (${{ matrix.os }} / ${{ matrix.go }})
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
concurrency:
|
2024-10-26 15:52:27 +02:00
|
|
|
group: ci-codecov-${{ matrix.os }}-${{ matrix.go }}
|
2024-10-26 15:33:05 +02:00
|
|
|
cancel-in-progress: true
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest]
|
|
|
|
go: ['1.23']
|
|
|
|
env:
|
|
|
|
PERFORM_ONLINE_TEST: ${{ vars.PERFORM_ONLINE_TEST }}
|
2024-10-28 16:32:24 +01:00
|
|
|
PERFORM_UNIX_OPEN_WRITE_TESTS: ${{ vars.PERFORM_UNIX_OPEN_WRITE_TESTS }}
|
|
|
|
PERFORM_SENDMAIL_TESTS: ${{ vars.PERFORM_SENDMAIL_TESTS }}
|
2024-11-14 10:41:10 +01:00
|
|
|
TEST_BASEPORT: ${{ vars.TEST_BASEPORT }}
|
2024-11-14 10:45:35 +01:00
|
|
|
TEST_BASEPORT_SMTP: ${{ vars.TEST_BASEPORT_SMTP }}
|
2024-10-26 15:33:05 +02:00
|
|
|
TEST_HOST: ${{ secrets.TEST_HOST }}
|
|
|
|
TEST_USER: ${{ secrets.TEST_USER }}
|
|
|
|
TEST_PASS: ${{ secrets.TEST_PASS }}
|
|
|
|
steps:
|
|
|
|
- name: Harden Runner
|
2024-11-19 14:32:14 +01:00
|
|
|
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
|
2024-10-26 15:33:05 +02:00
|
|
|
with:
|
|
|
|
egress-policy: audit
|
|
|
|
- name: Checkout Code
|
|
|
|
uses: actions/checkout@61b9e3751b92087fd0b06925ba6dd6314e06f089 # master
|
|
|
|
- name: Setup go
|
|
|
|
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
|
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go }}
|
|
|
|
check-latest: true
|
|
|
|
- name: Install sendmail
|
|
|
|
run: |
|
2024-11-01 16:36:06 +01:00
|
|
|
sudo apt-get -y update && sudo DEBIAN_FRONTEND=noninteractive apt-get -y install nullmailer && which sendmail
|
2024-10-26 15:33:05 +02:00
|
|
|
- name: Run go test
|
2024-10-26 16:25:42 +02:00
|
|
|
if: success()
|
2024-10-26 15:33:05 +02:00
|
|
|
run: |
|
|
|
|
go test -race -shuffle=on --coverprofile=coverage.coverprofile --covermode=atomic ./...
|
|
|
|
- name: Upload coverage to Codecov
|
|
|
|
if: success()
|
2024-11-21 15:02:09 +01:00
|
|
|
uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a # v5.0.7
|
2024-10-26 15:33:05 +02:00
|
|
|
with:
|
|
|
|
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
|
|
|
|
lint:
|
|
|
|
name: golangci-lint (${{ matrix.go }})
|
2024-10-26 15:48:10 +02:00
|
|
|
runs-on: ubuntu-latest
|
2024-10-26 15:33:05 +02:00
|
|
|
concurrency:
|
2024-10-26 15:52:27 +02:00
|
|
|
group: ci-lint-${{ matrix.go }}
|
2024-10-26 15:33:05 +02:00
|
|
|
cancel-in-progress: true
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
go: ['1.23']
|
|
|
|
steps:
|
|
|
|
- name: Harden Runner
|
2024-11-19 14:32:14 +01:00
|
|
|
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
|
2024-10-26 15:33:05 +02:00
|
|
|
with:
|
|
|
|
egress-policy: audit
|
|
|
|
- name: Setup go
|
|
|
|
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
|
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go }}
|
|
|
|
check-latest: true
|
2024-10-26 15:50:14 +02:00
|
|
|
- name: Checkout Code
|
|
|
|
uses: actions/checkout@61b9e3751b92087fd0b06925ba6dd6314e06f089 # master
|
2024-10-26 15:33:05 +02:00
|
|
|
- name: golangci-lint
|
|
|
|
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1
|
|
|
|
with:
|
|
|
|
version: latest
|
|
|
|
dependency-review:
|
|
|
|
name: Dependency review
|
2024-10-26 15:47:04 +02:00
|
|
|
runs-on: ubuntu-latest
|
2024-10-26 15:33:05 +02:00
|
|
|
concurrency:
|
|
|
|
group: ci-dependency-review
|
|
|
|
cancel-in-progress: true
|
|
|
|
steps:
|
|
|
|
- name: Harden Runner
|
2024-11-19 14:32:14 +01:00
|
|
|
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
|
2024-10-26 15:33:05 +02:00
|
|
|
with:
|
|
|
|
egress-policy: audit
|
|
|
|
- name: Checkout Code
|
|
|
|
uses: actions/checkout@61b9e3751b92087fd0b06925ba6dd6314e06f089 # master
|
|
|
|
- name: 'Dependency Review'
|
2024-10-29 14:16:58 +01:00
|
|
|
uses: actions/dependency-review-action@4081bf99e2866ebe428fc0477b69eb4fcda7220a # v4.4.0
|
2024-10-28 22:59:16 +01:00
|
|
|
with:
|
|
|
|
base-ref: ${{ github.event.pull_request.base.sha || 'main' }}
|
|
|
|
head-ref: ${{ github.event.pull_request.head.sha || github.ref }}
|
2024-10-26 15:33:05 +02:00
|
|
|
govulncheck:
|
|
|
|
name: Go vulnerabilities check
|
2024-10-26 15:48:10 +02:00
|
|
|
runs-on: ubuntu-latest
|
2024-10-26 15:33:05 +02:00
|
|
|
concurrency:
|
|
|
|
group: ci-govulncheck
|
|
|
|
cancel-in-progress: true
|
|
|
|
steps:
|
|
|
|
- name: Harden Runner
|
2024-11-19 14:32:14 +01:00
|
|
|
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
|
2024-10-26 15:33:05 +02:00
|
|
|
with:
|
|
|
|
egress-policy: audit
|
|
|
|
- name: Run govulncheck
|
|
|
|
uses: golang/govulncheck-action@b625fbe08f3bccbe446d94fbf87fcc875a4f50ee # v1.0.4
|
|
|
|
test:
|
|
|
|
name: Test (${{ matrix.os }} / ${{ matrix.go }})
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
concurrency:
|
2024-10-26 15:52:27 +02:00
|
|
|
group: ci-test-${{ matrix.os }}-${{ matrix.go }}
|
2024-10-26 15:33:05 +02:00
|
|
|
cancel-in-progress: true
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
2024-10-26 17:11:21 +02:00
|
|
|
go: ['1.19', '1.20', '1.21', '1.22', '1.23']
|
2024-11-14 10:41:10 +01:00
|
|
|
env:
|
|
|
|
TEST_BASEPORT: ${{ vars.TEST_BASEPORT }}
|
2024-11-14 10:45:35 +01:00
|
|
|
TEST_BASEPORT_SMTP: ${{ vars.TEST_BASEPORT_SMTP }}
|
2024-10-26 15:33:05 +02:00
|
|
|
steps:
|
|
|
|
- name: Harden Runner
|
2024-11-19 14:32:14 +01:00
|
|
|
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
|
2024-10-26 15:33:05 +02:00
|
|
|
with:
|
|
|
|
egress-policy: audit
|
|
|
|
- name: Checkout Code
|
|
|
|
uses: actions/checkout@61b9e3751b92087fd0b06925ba6dd6314e06f089 # master
|
|
|
|
- name: Setup go
|
|
|
|
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
|
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go }}
|
|
|
|
- name: Run go test
|
|
|
|
run: |
|
|
|
|
go test -race -shuffle=on ./...
|
2024-10-27 17:49:04 +01:00
|
|
|
test-fbsd:
|
|
|
|
name: Test on FreeBSD ${{ matrix.osver }}
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
concurrency:
|
|
|
|
group: ci-test-freebsd-${{ matrix.osver }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-10-27 20:59:24 +01:00
|
|
|
osver: ['14.1', '14.0', 13.4']
|
2024-11-14 10:41:10 +01:00
|
|
|
env:
|
|
|
|
TEST_BASEPORT: ${{ vars.TEST_BASEPORT }}
|
2024-11-14 10:45:35 +01:00
|
|
|
TEST_BASEPORT_SMTP: ${{ vars.TEST_BASEPORT_SMTP }}
|
2024-10-27 17:49:04 +01:00
|
|
|
steps:
|
|
|
|
- name: Checkout Code
|
|
|
|
uses: actions/checkout@61b9e3751b92087fd0b06925ba6dd6314e06f089 # master
|
|
|
|
- name: Run go test on FreeBSD
|
|
|
|
uses: vmactions/freebsd-vm@v1
|
|
|
|
with:
|
|
|
|
usesh: true
|
2024-10-27 18:22:22 +01:00
|
|
|
copyback: false
|
2024-10-27 17:49:04 +01:00
|
|
|
prepare: |
|
|
|
|
pkg install -y go
|
|
|
|
run: |
|
2024-10-27 18:22:22 +01:00
|
|
|
cd $GITHUB_WORKSPACE;
|
2024-10-27 17:49:04 +01:00
|
|
|
go test -race -shuffle=on ./...
|
2024-10-26 15:33:05 +02:00
|
|
|
reuse:
|
|
|
|
name: REUSE Compliance Check
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
concurrency:
|
|
|
|
group: ci-reuse
|
|
|
|
cancel-in-progress: true
|
|
|
|
steps:
|
|
|
|
- name: Harden Runner
|
2024-11-19 14:32:14 +01:00
|
|
|
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
|
2024-10-26 15:33:05 +02:00
|
|
|
with:
|
|
|
|
egress-policy: audit
|
|
|
|
- name: Checkout Code
|
|
|
|
uses: actions/checkout@61b9e3751b92087fd0b06925ba6dd6314e06f089 # master
|
|
|
|
- name: REUSE Compliance Check
|
2024-11-14 14:50:11 +01:00
|
|
|
uses: fsfe/reuse-action@bb774aa972c2a89ff34781233d275075cbddf542 # v5.0.0
|
2024-10-26 15:33:05 +02:00
|
|
|
sonarqube:
|
|
|
|
name: Test with SonarQube review (${{ matrix.os }} / ${{ matrix.go }})
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
concurrency:
|
2024-10-26 15:52:27 +02:00
|
|
|
group: ci-codecov-${{ matrix.go }}
|
2024-10-26 15:33:05 +02:00
|
|
|
cancel-in-progress: true
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest]
|
|
|
|
go: ['1.23']
|
|
|
|
env:
|
|
|
|
PERFORM_ONLINE_TEST: ${{ vars.PERFORM_ONLINE_TEST }}
|
2024-11-14 10:41:10 +01:00
|
|
|
TEST_BASEPORT: ${{ vars.TEST_BASEPORT }}
|
2024-11-14 10:45:35 +01:00
|
|
|
TEST_BASEPORT_SMTP: ${{ vars.TEST_BASEPORT_SMTP }}
|
2024-10-26 15:33:05 +02:00
|
|
|
TEST_HOST: ${{ secrets.TEST_HOST }}
|
|
|
|
TEST_USER: ${{ secrets.TEST_USER }}
|
|
|
|
TEST_PASS: ${{ secrets.TEST_PASS }}
|
|
|
|
steps:
|
|
|
|
- name: Harden Runner
|
2024-11-19 14:32:14 +01:00
|
|
|
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
|
2024-10-26 15:33:05 +02:00
|
|
|
with:
|
|
|
|
egress-policy: audit
|
|
|
|
- name: Checkout Code
|
|
|
|
uses: actions/checkout@61b9e3751b92087fd0b06925ba6dd6314e06f089 # master
|
|
|
|
- name: Setup go
|
|
|
|
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
|
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go }}
|
|
|
|
check-latest: true
|
|
|
|
- name: Run go test
|
|
|
|
run: |
|
|
|
|
go test -shuffle=on -race --coverprofile=./cov.out ./...
|
|
|
|
- name: SonarQube scan
|
2024-11-13 14:31:45 +01:00
|
|
|
uses: sonarsource/sonarqube-scan-action@94d4f8ac4aaefccd7fb84bff00b0aeb2d65fcd49 # master
|
2024-10-26 15:33:05 +02:00
|
|
|
if: success()
|
|
|
|
env:
|
|
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
|
|
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|
|
|
|
- name: SonarQube quality gate
|
2024-10-29 14:17:03 +01:00
|
|
|
uses: sonarsource/sonarqube-quality-gate-action@8406f4f1edaffef38e9fb9c53eb292fc1d7684fa # master
|
2024-10-26 15:33:05 +02:00
|
|
|
timeout-minutes: 5
|
|
|
|
env:
|
|
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
|
|
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|