vibetunnel/.github/workflows/go.yml
2025-06-19 23:44:28 +02:00

77 lines
No EOL
1.7 KiB
YAML

name: Go CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
lint:
name: Lint
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.21.x'
- name: Check formatting
working-directory: ./linux
run: |
if [ -n "$(gofmt -l .)" ]; then
echo "Go files are not formatted. Please run 'gofmt -w .'"
gofmt -d .
exit 1
fi
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
working-directory: ./linux
args: --timeout=5m
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go-version: ['1.21.x']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
%LocalAppData%\go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Download dependencies
working-directory: ./linux
run: go mod download
- name: Build
working-directory: ./linux
run: go build -v ./...
- name: Test build of main binary
working-directory: ./linux
run: go build -v ./cmd/vibetunnel