go-mail/.github/workflows/codecov.yml

64 lines
1.8 KiB
YAML
Raw Normal View History

# SPDX-FileCopyrightText: 2022 Winni Neessen <winni@neessen.dev>
#
# SPDX-License-Identifier: CC0-1.0
2022-03-15 21:32:05 +01:00
name: Codecov workflow
2022-03-15 21:29:26 +01:00
on:
push:
branches:
2022-03-15 21:30:51 +01:00
- main
2022-03-15 21:29:26 +01:00
paths:
- '**.go'
- 'go.*'
- '.github/**'
- 'codecov.yml'
pull_request:
branches:
2022-03-15 21:30:51 +01:00
- main
2022-03-15 21:29:26 +01:00
paths:
- '**.go'
- 'go.*'
- '.github/**'
- 'codecov.yml'
2022-03-16 21:08:34 +01:00
env:
TEST_HOST: ${{ secrets.TEST_HOST }}
2022-03-21 10:15:58 +01:00
TEST_FROM: ${{ secrets.TEST_USER }}
2022-03-21 11:03:55 +01:00
TEST_ALLOW_SEND: "1"
2022-03-16 21:08:34 +01:00
TEST_SMTPAUTH_USER: ${{ secrets.TEST_USER }}
TEST_SMTPAUTH_PASS: ${{ secrets.TEST_PASS }}
2022-03-21 10:15:58 +01:00
TEST_SMTPAUTH_TYPE: "LOGIN"
permissions:
contents: read
2022-03-15 21:29:26 +01:00
jobs:
run:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go: [1.18, 1.19, '1.20', '1.21', '1.22']
2022-03-15 21:29:26 +01:00
steps:
- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
egress-policy: audit
2022-03-15 21:40:04 +01:00
- name: Checkout Code
uses: actions/checkout@61b9e3751b92087fd0b06925ba6dd6314e06f089 # master
- name: Setup go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: ${{ matrix.go }}
2022-09-08 15:33:39 +02:00
- name: Install sendmail
if: matrix.go == '1.22' && matrix.os == 'ubuntu-latest'
2022-09-08 15:33:39 +02:00
run: |
sudo apt-get -y install sendmail; which sendmail
2022-03-15 21:40:04 +01:00
- name: Run Tests
run: |
2022-09-08 15:33:39 +02:00
go test -v -race --coverprofile=coverage.coverprofile --covermode=atomic ./...
2022-03-15 21:40:04 +01:00
- name: Upload coverage to Codecov
if: success() && matrix.go == '1.22' && matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
2022-03-15 21:29:26 +01:00
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos