Skip to content

Merge pull request #51 from devnullvoid/dependabot/go_modules/github.… #258

Merge pull request #51 from devnullvoid/dependabot/go_modules/github.…

Merge pull request #51 from devnullvoid/dependabot/go_modules/github.… #258

Workflow file for this run

name: CI
on:
push:
branches: [master, develop]
pull_request:
branches: [master]
# Set default permissions for all jobs
permissions:
contents: read
packages: read
jobs:
lint:
name: Lint
strategy:
fail-fast: false
matrix:
go-version: ['1.24']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: ${{ matrix.go-version }}
- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
~/go/bin
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run go vet
run: go vet ./...
- name: golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: latest
args: --timeout=5m
test:
name: Test
strategy:
fail-fast: false
matrix:
go-version: ['1.24']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v6
with:
go-version: ${{ matrix.go-version }}
- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
~/go/bin
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run tests
run: |
go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
go tool cover -func=coverage.out
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.out
fail_ci_if_error: false
build:
name: Build
needs: [test] # Only depend on test, not lint
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
go-version: ['1.24']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v6
with:
go-version: ${{ matrix.go-version }}
- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
~/go/bin
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Build binary (Windows)
if: matrix.os == 'windows-latest'
run: |
New-Item -ItemType Directory -Force -Path dist
go build -ldflags="-s -w" -o ./dist/pvetui.exe ./cmd/pvetui
- name: Build binary (Unix)
if: matrix.os != 'windows-latest'
run: |
mkdir -p dist
go build -ldflags="-s -w" -o ./dist/pvetui ./cmd/pvetui
- name: List built files (debug)
if: matrix.os == 'windows-latest'
run: |
Write-Host "Contents of dist directory:"
Get-ChildItem .\dist\
- name: List built files (debug)
if: matrix.os != 'windows-latest'
run: |
echo "Contents of dist directory:"
ls -la dist/
- name: Test binary (Unix)
if: matrix.os != 'windows-latest'
run: ./dist/pvetui --help
- name: Test binary (Windows)
if: matrix.os == 'windows-latest'
run: |
if (Test-Path ".\dist\pvetui.exe") {
.\dist\pvetui.exe --help
} else {
Write-Error "Binary not found at .\dist\pvetui.exe"
Get-ChildItem .\dist\
exit 1
}
- name: Upload artifacts
if: success()
uses: actions/upload-artifact@v5
with:
name: binary-${{ matrix.os }}
path: dist/
if-no-files-found: error