feat(ci): add some unit and integration tests #19
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
name: 'CI' | |
on: | |
pull_request: | |
branches: | |
- main | |
paths-ignore: | |
- '**/*.yaml' | |
- '**/*.md' | |
- LICENSE | |
- CODEOWNERS | |
- '.gitignore' | |
jobs: | |
govulncheck: | |
runs-on: ubuntu-latest | |
name: Run govulncheck | |
steps: | |
- id: govulncheck | |
uses: golang/govulncheck-action@v1 | |
with: | |
go-version-file: go.mod | |
go-package: ./... | |
golangci: | |
name: lint | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 | |
with: | |
go-version-file: 'go.mod' | |
cache: false | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1 | |
with: | |
version: v1.60.3 | |
# Optional: golangci-lint command line arguments. | |
args: --timeout=10m --out-format=colored-line-number | |
unit: | |
name: unit tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 | |
with: | |
go-version-file: 'go.mod' | |
cache: false | |
- name: Install gnome-keyring | |
run: sudo apt-get update && sudo apt-get install -y [email protected] | |
- name: Initialize and Unlock Keyring | |
run: | | |
export DISPLAY=:1 | |
export DBUS_SESSION_BUS_ADDRESS=/tmp/dbus | |
dbus-daemon --session --fork --print-address | |
mkdir -p ~/.config/keyrings | |
echo -n "test" | gnome-keyring-daemon --unlock | |
- name: Unit Tests with the Go CLI | |
# allow gnome-keyring to work in CI | |
env: | |
DISPLAY: ':1' | |
run: go test ./... -short -race -cover |