Files
x509-certificate-exporter/.github/workflows/pr-code.yml
T

79 lines
2.2 KiB
YAML

name: Code
on:
pull_request:
paths-ignore:
- deploy/**
- "**/*.md"
permissions:
contents: read
pull-requests: read
env:
VERSION_KIND: v0.31.0
VERSION_GOLANGCILINT: latest
VERSION_GOLANG: '1.25.7'
jobs:
static-analysis:
name: Static Analysis
runs-on: ubuntu-22.04
steps:
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up Golang
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
with:
go-version: ${{ env.VERSION_GOLANG }}
- name: Run golangci-lint
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
with:
version: ${{ env.VERSION_GOLANGCILINT }}
only-new-issues: true
args: --timeout 3m --verbose
#args: --issues-exit-code=0
#skip-cache: true
#skip-build-cache: true
#skip-pkg-cache: true
unit-testing:
name: Unit Testing
runs-on: ubuntu-22.04
steps:
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up Golang
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
with:
go-version: ${{ env.VERSION_GOLANG }}
- name: Restore cached Go modules
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go${{ env.VERSION_GOLANG }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go${{ env.VERSION_GOLANG }}-
- name: Run unit tests
run: |
set -euo pipefail
go test -v -failfast -timeout 1m -coverprofile=coverage.cov ./internal
go tool cover -html=coverage.cov -o coverage.html
- name: Archive code coverage results
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: code-coverage-report
path: coverage.html