2024-07-18 11:12:13 +02:00
|
|
|
name: Golang
|
2022-03-28 03:42:42 +02:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
pull_request:
|
2024-07-18 11:12:13 +02:00
|
|
|
release:
|
2022-03-28 03:42:42 +02:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
test:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2023-09-18 10:55:05 +02:00
|
|
|
go-version: [1.21]
|
2022-03-28 03:42:42 +02:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Setup Go ${{ matrix.go-version }}
|
2024-07-18 11:18:55 +02:00
|
|
|
uses: actions/setup-go@v5
|
2022-03-28 03:42:42 +02:00
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go-version }}
|
|
|
|
|
|
|
|
- name: Checkout code
|
2024-07-18 11:18:55 +02:00
|
|
|
uses: actions/checkout@v4
|
2022-03-28 03:42:42 +02:00
|
|
|
|
|
|
|
- name: Cache Go modules
|
2024-07-18 11:18:55 +02:00
|
|
|
uses: actions/cache@v4
|
2022-03-28 03:42:42 +02:00
|
|
|
with:
|
|
|
|
path: ~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-${{ matrix.go-version }}-go-
|
|
|
|
|
|
|
|
- name: Run tests
|
|
|
|
run: make test
|
|
|
|
|
2024-07-18 11:18:55 +02:00
|
|
|
- uses: codecov/codecov-action@v4
|
2022-03-28 03:42:42 +02:00
|
|
|
with:
|
|
|
|
file: coverage.out
|
|
|
|
|
|
|
|
lint:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2023-09-18 10:55:05 +02:00
|
|
|
go-version: [1.21]
|
2022-03-28 03:42:42 +02:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Setup Go ${{ matrix.go-version }}
|
2024-07-18 11:18:55 +02:00
|
|
|
uses: actions/setup-go@v5
|
2022-03-28 03:42:42 +02:00
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go-version }}
|
|
|
|
|
|
|
|
- name: Checkout code
|
2024-07-18 11:18:55 +02:00
|
|
|
uses: actions/checkout@v4
|
2022-03-28 03:42:42 +02:00
|
|
|
|
|
|
|
- name: Cache Go modules
|
2024-07-18 11:18:55 +02:00
|
|
|
uses: actions/cache@v4
|
2022-03-28 03:42:42 +02:00
|
|
|
with:
|
|
|
|
path: ~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-${{ matrix.go-version }}-go-
|
|
|
|
|
|
|
|
- name: Run linter
|
2024-07-18 11:18:55 +02:00
|
|
|
uses: golangci/golangci-lint-action@v6
|
2022-03-28 03:42:42 +02:00
|
|
|
with:
|
|
|
|
version: latest
|
|
|
|
skip-cache: true
|
2023-09-17 01:06:33 +02:00
|
|
|
args: --timeout=5m
|
2024-07-18 11:12:13 +02:00
|
|
|
|
|
|
|
build:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- arch: amd64
|
|
|
|
os: linux
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-07-18 11:18:55 +02:00
|
|
|
- uses: actions/checkout@v4
|
2024-07-18 11:12:13 +02:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2024-07-18 11:18:55 +02:00
|
|
|
- uses: actions/setup-go@v5
|
2024-07-18 11:12:13 +02:00
|
|
|
with:
|
|
|
|
go-version: '1.21'
|
|
|
|
- name: Build
|
|
|
|
run: go build -ldflags "-X github.com/FreifunkBremen/yanic/cmd.VERSION=$(git describe --tags)" -v -o yanic_${{ matrix.arch }}_${{ matrix.os }}
|
|
|
|
env:
|
|
|
|
GOOS: ${{ matrix.os }}
|
|
|
|
GOARCH: ${{ matrix.arch }}
|
|
|
|
CGO_ENABLED: 0
|
|
|
|
- name: Archive build artifacts
|
2024-07-18 11:18:55 +02:00
|
|
|
uses: actions/upload-artifact@v4
|
2024-07-18 11:12:13 +02:00
|
|
|
with:
|
|
|
|
name: build-${{ matrix.arch }}-${{ matrix.os }}
|
|
|
|
path: yanic_*
|