ci(deps): bump actions/setup-go from 4 to 5 #11
Workflow file for this run
This file contains hidden or 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: | |
push: | |
branches: [ master, main ] | |
pull_request: | |
branches: [ master, main ] | |
jobs: | |
lint: | |
name: Lint and Format Check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.25' | |
- name: Install golangci-lint | |
uses: golangci/golangci-lint-action@v4 | |
with: | |
version: latest | |
args: --timeout=10m | |
- name: Check formatting | |
run: | | |
if [ "$(gofmt -l . | wc -l)" -gt 0 ]; then | |
echo "Code is not formatted. Please run 'make fmt' and commit changes." | |
gofmt -l . | |
exit 1 | |
fi | |
- name: Check imports | |
run: | | |
if [ "$(goimports -l . | wc -l)" -gt 0 ]; then | |
echo "Imports are not properly formatted. Please run 'make fmt' and commit changes." | |
goimports -l . | |
exit 1 | |
fi | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go-version: [ '1.20', '1.21', '1.22', '1.25' ] | |
os: [ ubuntu-latest, macos-latest ] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Go ${{ matrix.go-version }} | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Install dependencies | |
run: go mod download | |
- name: Verify dependencies | |
run: go mod verify | |
- name: Run tests | |
run: go test -v -race -coverprofile=coverage.out -covermode=atomic ./... | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
file: ./coverage.out | |
flags: unittests | |
name: codecov-umbrella | |
fail_ci_if_error: false | |
security: | |
name: Security Scan | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.25' | |
- name: Run gosec security scanner | |
uses: securecodewarrior/github-action-gosec@master | |
with: | |
args: '-fmt sarif -out results.sarif ./...' | |
- name: Upload SARIF file | |
uses: github/codeql-action/upload-sarif@v3 | |
if: always() | |
with: | |
sarif_file: results.sarif | |
- name: Run govulncheck | |
run: | | |
go install golang.org/x/vuln/cmd/govulncheck@latest | |
govulncheck ./... | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
needs: [lint, test] | |
strategy: | |
matrix: | |
goos: [linux, darwin, windows] | |
goarch: [amd64, arm64] | |
exclude: | |
- goos: windows | |
goarch: arm64 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.25' | |
- name: Build for ${{ matrix.goos }}/${{ matrix.goarch }} | |
env: | |
GOOS: ${{ matrix.goos }} | |
GOARCH: ${{ matrix.goarch }} | |
run: | | |
go build -v -ldflags="-s -w -X main.Version=$(cat VERSION)" -o "ssh-aliases-${{ matrix.goos }}-${{ matrix.goarch }}" | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ssh-aliases-${{ matrix.goos }}-${{ matrix.goarch }} | |
path: ssh-aliases-${{ matrix.goos }}-${{ matrix.goarch }} | |
integration: | |
name: Integration Tests | |
runs-on: ubuntu-latest | |
needs: [lint, test] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.25' | |
- name: Install dependencies | |
run: go mod download | |
- name: Run integration tests | |
run: go test -v ./integration_test/... | |
dependency-review: | |
name: Dependency Review | |
runs-on: ubuntu-latest | |
if: github.event_name == 'pull_request' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Dependency Review | |
uses: actions/dependency-review-action@v4 | |
with: | |
fail-on-severity: moderate |