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-26 16:25:42 +02:00
|
|
|
TEST_SENDMAIL: ${{ vars.TEST_SENDMAIL }}
|
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
|
|
|
|
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
|
|
|
|
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-10-26 16:25:42 +02:00
|
|
|
apt-get -y update >/dev/null && apt-get -y upgrade >/dev/null && apt-get -y install ssmtp >/dev/null && 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()
|
|
|
|
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0
|
|
|
|
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
|
|
|
|
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
|
|
|
|
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
|
|
|
|
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
|
|
|
|
with:
|
|
|
|
egress-policy: audit
|
|
|
|
- name: Checkout Code
|
|
|
|
uses: actions/checkout@61b9e3751b92087fd0b06925ba6dd6314e06f089 # master
|
|
|
|
- name: 'Dependency Review'
|
|
|
|
uses: actions/dependency-review-action@a6993e2c61fd5dc440b409aa1d6904921c5e1894 # v4.3.5
|
|
|
|
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
|
|
|
|
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
|
|
|
|
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 15:58:13 +02:00
|
|
|
go: ['1.21', '1.22', '1.23']
|
2024-10-26 15:33:05 +02:00
|
|
|
steps:
|
|
|
|
- name: Harden Runner
|
|
|
|
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
|
|
|
|
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 ./...
|
|
|
|
reuse:
|
|
|
|
name: REUSE Compliance Check
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
concurrency:
|
|
|
|
group: ci-reuse
|
|
|
|
cancel-in-progress: true
|
|
|
|
steps:
|
|
|
|
- name: Harden Runner
|
|
|
|
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
|
|
|
|
with:
|
|
|
|
egress-policy: audit
|
|
|
|
- name: Checkout Code
|
|
|
|
uses: actions/checkout@61b9e3751b92087fd0b06925ba6dd6314e06f089 # master
|
|
|
|
- name: REUSE Compliance Check
|
|
|
|
uses: fsfe/reuse-action@3ae3c6bdf1257ab19397fab11fd3312144692083 # v4.0.0
|
|
|
|
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 }}
|
|
|
|
TEST_HOST: ${{ secrets.TEST_HOST }}
|
|
|
|
TEST_USER: ${{ secrets.TEST_USER }}
|
|
|
|
TEST_PASS: ${{ secrets.TEST_PASS }}
|
|
|
|
steps:
|
|
|
|
- name: Harden Runner
|
|
|
|
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
|
|
|
|
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
|
|
|
|
uses: sonarsource/sonarqube-scan-action@884b79409bbd464b2a59edc326a4b77dc56b2195 # master
|
|
|
|
if: success()
|
|
|
|
env:
|
|
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
|
|
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|
|
|
|
- name: SonarQube quality gate
|
|
|
|
uses: sonarsource/sonarqube-quality-gate-action@dc2f7b0dd95544cd550de3028f89193576e958b9 # master
|
|
|
|
timeout-minutes: 5
|
|
|
|
env:
|
|
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
|
|
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|