-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add go workflow, update actions (#1)
- Loading branch information
1 parent
49e3687
commit c59fbc4
Showing
2 changed files
with
76 additions
and
23 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# Copyright (c) 2024 Joshua Sing <joshua@joshuasing.dev> | ||
# Use of this source code is governed by the MIT License, | ||
# which can be found in the LICENSE file. | ||
|
||
# GitHub Actions workflow to build and test. | ||
name: "Go" | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
env: | ||
GO_VERSION: "1.23.x" | ||
|
||
jobs: | ||
vulncheck: | ||
name: "Vulnerability Check" | ||
runs-on: "ubuntu-latest" | ||
permissions: | ||
contents: read | ||
steps: | ||
- name: "Checkout repository" | ||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
||
- name: "Setup Go ${{ env.GO_VERSION }}" | ||
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 | ||
with: | ||
go-version: "${{ env.GO_VERSION }}" | ||
cache: true | ||
check-latest: true | ||
|
||
- name: "Install govulncheck" | ||
run: go install golang.org/x/vuln/cmd/govulncheck@latest | ||
|
||
- name: "Run govulncheck" | ||
run: govulncheck ./... | ||
|
||
build: | ||
name: "Build (${{ matrix.os }})" | ||
runs-on: "${{ matrix.os }}" | ||
permissions: | ||
contents: read | ||
strategy: | ||
matrix: | ||
os: ["ubuntu-latest"] | ||
steps: | ||
- name: "Checkout repository" | ||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
||
- name: "Setup Go ${{ env.GO_VERSION }}" | ||
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 | ||
with: | ||
go-version: "${{ env.GO_VERSION }}" | ||
cache: true | ||
check-latest: true | ||
|
||
- name: "Download dependencies" | ||
run: go mod download | ||
|
||
- name: "Verify dependencies" | ||
run: go mod verify | ||
|
||
- name: "Build" | ||
run: go build ./... | ||
|
||
- name: "Test" | ||
run: go test ./... |
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