Skip to content

refactor: satisfy recvcheck linter #380

refactor: satisfy recvcheck linter

refactor: satisfy recvcheck linter #380

Workflow file for this run

# SPDX-FileCopyrightText: 2024 Tobias Böhm <code@aibor.de>
#
# SPDX-License-Identifier: GPL-3.0-or-later
name: Test
on:
push:
branches: [ "**" ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
GOPATH: "${{ github.workspace }}/.go"
GOVERSION: "1.23.x"
jobs:
lint-and-test:
name: Go lint and test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "${{ env.GOVERSION }}"
- name: Run go generate
run: go generate -tags testdata ./...
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: "v1.62"
- name: Run vet with all constraints
run: go vet -tags integration,integration_guest,standalone ./...
- name: Run go tests
run: |
go test -v \
-race \
-cover \
-covermode=atomic \
./...
integration-tests:
name: Run integration tests
runs-on: ubuntu-latest
container:
image: alpine:3.20
needs:
- lint-and-test
strategy:
matrix:
arch:
- go: amd64
apk: x86_64
- go: arm64
apk: aarch64
steps:
- name: Install packages
run: apk add tar "qemu-system-${{ matrix.arch.apk }}" gcc musl-dev
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "${{ env.GOVERSION }}"
- name: Run go generate testdata
run: go generate -tags testdata ./...
- name: Run go generate integration tests
env:
GOARCH: ${{ matrix.arch.go }}
run: go generate -tags integration ./testing/...
- name: Fetch kernel files
run: |
sed -i "s/x86_64/${{ matrix.arch.apk }}/" /etc/apk/arch
apk fetch --no-cache --allow-untrusted linux-virt
tar xf linux-virt-* --wildcards -C / boot/vmlinuz-virt
- name: Run tests
run: |
go test -v \
-tags integration \
-covermode atomic \
-coverpkg "$(go list ./internal/... | tr '\n' ,)" \
-coverprofile /tmp/cover.testing.out \
./testing/ \
-kernel.path "/boot/vmlinuz-virt" \
-kernel.arch ${{ matrix.arch.go }} \
-force-pci
integration-tests-modules:
name: Run integration tests for kernel modules
runs-on: ubuntu-latest
container:
image: alpine:3.20
needs:
- lint-and-test
env:
GOCOVERDIR: "/tmp/gocoverdir"
VIRTRUN_ARCH: "${{ matrix.arch.go }}"
VIRTRUN_ARGS: "-kernel /boot/vmlinuz-virt \
-addModule /lib/modules/kernel/drivers/net/tun.ko.gz \
-addModule /lib/modules/kernel/drivers/net/veth.ko.gz \
-transport pci \
-debug"
strategy:
matrix:
arch:
- go: amd64
apk: x86_64
- go: arm64
apk: aarch64
steps:
- name: Install packages
run: apk add tar "qemu-system-${{ matrix.arch.apk }}"
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "${{ env.GOVERSION }}"
- name: Create gocoverdir
run: mkdir -pv "${{ env.GOCOVERDIR }}"
- name: Run go generate
run: go generate ./...
- name: Build virtrun
run: go build -cover -covermode atomic -o /virtrun .
- name: Fetch kernel files
run: |
sed -i "s/x86_64/${{ matrix.arch.apk }}/" /etc/apk/arch
apk fetch --no-cache --allow-untrusted linux-virt
tar xf linux-virt-* --wildcards -C / \
boot/vmlinuz-virt \
lib/modules/*/kernel/drivers/net/veth.ko.gz \
lib/modules/*/kernel/drivers/net/tun.ko.gz
ln -s /lib/modules/*/kernel /lib/modules/
- name: Run test
env:
GOARCH: "${{ matrix.arch.go }}"
run: |
go test -v \
-tags integration_guest \
-exec "env GOCOVERDIR=${{ env.GOCOVERDIR }} /virtrun" \
-cover \
-covermode atomic \
-coverprofile /tmp/cover.out \
./testing/guest/ \
-testModules tun,veth
- name: Run covdata
run: go tool covdata percent -i "${{ env.GOCOVERDIR }}"
reuse-lint:
name: FSFE REUSE Compliance Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: REUSE Compliance Check
uses: fsfe/reuse-action@v4
results:
if: always()
runs-on: ubuntu-latest
name: Test Results
needs:
- lint-and-test
- integration-tests
- integration-tests-modules
- reuse-lint
steps:
- run: exit 1
if: |
contains(needs.*.result, 'failure') ||
contains(needs.*.result, 'cancelled')