Add error handling for missing API key #18
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SPDX-FileCopyrightText: Winni Neessen <wn@neessen.dev> et al | |
# | |
# SPDX-License-Identifier: MIT | |
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: | |
group: ci-codecov-${{ matrix.os }}-${{ matrix.go }} | |
cancel-in-progress: true | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
go: ['1.24'] | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 | |
with: | |
egress-policy: audit | |
- name: Checkout Code | |
uses: actions/checkout@61b9e3751b92087fd0b06925ba6dd6314e06f089 # master | |
- name: Setup go | |
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 | |
with: | |
go-version: ${{ matrix.go }} | |
check-latest: true | |
- name: Run go test | |
env: | |
HIBP_API_KEY: ${{ secrets.HIBP_API_KEY }} | |
if: success() | |
run: | | |
go test -race -shuffle=on --coverprofile=coverage.coverprofile --covermode=atomic ./... | |
- name: Upload coverage to Codecov | |
if: success() | |
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5.1.2 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos | |
lint: | |
name: golangci-lint (${{ matrix.go }}) | |
runs-on: ubuntu-latest | |
concurrency: | |
group: ci-lint-${{ matrix.go }} | |
cancel-in-progress: true | |
strategy: | |
matrix: | |
go: ['1.24'] | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 | |
with: | |
egress-policy: audit | |
- name: Setup go | |
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 | |
with: | |
go-version: ${{ matrix.go }} | |
check-latest: true | |
- name: Checkout Code | |
uses: actions/checkout@61b9e3751b92087fd0b06925ba6dd6314e06f089 # master | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1 | |
with: | |
version: latest | |
dependency-review: | |
name: Dependency review | |
runs-on: ubuntu-latest | |
concurrency: | |
group: ci-dependency-review | |
cancel-in-progress: true | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 | |
with: | |
egress-policy: audit | |
- name: Checkout Code | |
uses: actions/checkout@61b9e3751b92087fd0b06925ba6dd6314e06f089 # master | |
- name: 'Dependency Review' | |
uses: actions/dependency-review-action@3b139cfc5fae8b618d3eae3675e383bb1769c019 # v4.5.0 | |
with: | |
base-ref: ${{ github.event.pull_request.base.sha || 'main' }} | |
head-ref: ${{ github.event.pull_request.head.sha || github.ref }} | |
govulncheck: | |
name: Go vulnerabilities check | |
runs-on: ubuntu-latest | |
concurrency: | |
group: ci-govulncheck | |
cancel-in-progress: true | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 | |
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: | |
group: ci-test-${{ matrix.os }}-${{ matrix.go }} | |
cancel-in-progress: true | |
strategy: | |
matrix: | |
os: [macos-latest, windows-latest] | |
go: ['1.24'] | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 | |
with: | |
egress-policy: audit | |
- name: Checkout Code | |
uses: actions/checkout@61b9e3751b92087fd0b06925ba6dd6314e06f089 # master | |
- name: Setup go | |
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Run go test | |
env: | |
HIBP_API_KEY: ${{ secrets.HIBP_API_KEY }} | |
run: | | |
go test -shuffle=on ./... | |
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: | |
osver: ['14.1', '14.0', '13.4'] | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@61b9e3751b92087fd0b06925ba6dd6314e06f089 # master | |
- name: Run go test on FreeBSD | |
uses: vmactions/freebsd-vm@v1 | |
env: | |
HIBP_API_KEY: ${{ secrets.HIBP_API_KEY }} | |
with: | |
usesh: true | |
copyback: false | |
prepare: | | |
pkg install -y go | |
run: | | |
cd $GITHUB_WORKSPACE; | |
go test -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@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 | |
with: | |
egress-policy: audit | |
- name: Checkout Code | |
uses: actions/checkout@61b9e3751b92087fd0b06925ba6dd6314e06f089 # master | |
- name: REUSE Compliance Check | |
uses: fsfe/reuse-action@bb774aa972c2a89ff34781233d275075cbddf542 # v5.0.0 |