Skip to content

Commit

Permalink
chore: add xBSD pipelines
Browse files Browse the repository at this point in the history
For integration tests.

Signed-off-by: Pranshu Srivastava <[email protected]>

chore: support non-linux GOOS in e2e tests

Signed-off-by: Pranshu Srivastava <[email protected]>

chore: support e2e tests on freebsd

Signed-off-by: Pranshu Srivastava <[email protected]>

chore: support e2e tests on openbsd

Signed-off-by: Pranshu Srivastava <[email protected]>

chore: support e2e tests on netbsd

Signed-off-by: Pranshu Srivastava <[email protected]>

chore: support e2e tests on solaris

Signed-off-by: Pranshu Srivastava <[email protected]>

chore: support e2e tests on dragonfly

Signed-off-by: Pranshu Srivastava <[email protected]>

chore: drop support for e2e tests on solaris

Signed-off-by: Pranshu Srivastava <[email protected]>
  • Loading branch information
rexagod committed Nov 25, 2024
1 parent 49d177b commit 73d54c5
Show file tree
Hide file tree
Showing 13 changed files with 1,760 additions and 32 deletions.
175 changes: 175 additions & 0 deletions .github/workflows/bsd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
name: bsd

on:
push:
branches:
- master
pull_request:
branches:
- master

permissions:
contents: read

env:
GO_VERSION_FREEBSD: "123"
GO_VERSION_OPENBSD: "1.23.1"
GO_VERSION_NETBSD: "123"
GO_VERSION_DRAGONFLY: "1.23.3"
GNU_TAR_VERSION: "1.35"

# To spin up one of the VMs below, see the "Debug Shell" section here: https://github.com/vmactions
jobs:
test_freebsd:
name: Run end-to-end tests on FreeBSD
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: test-e2e
uses: vmactions/freebsd-vm@v1
with:
copyback: false
envs: 'GO_VERSION_FREEBSD GNU_TAR_VERSION'
usesh: true
prepare: |
pkg update -f
pkg install -y bash curl gtar git gmake gsed gnugrep go${GO_VERSION_FREEBSD} python
run: |
echo "::group::Setup prerequisites"
set -eu
mkdir bin
ln -s $(which go${GO_VERSION_FREEBSD}) $(pwd)/bin/go
ln -s $(which ggrep) $(pwd)/bin/grep
ln -s $(which gmake) $(pwd)/bin/make
ln -s $(which gsed) $(pwd)/bin/sed
ln -s $(which gtar) $(pwd)/bin/tar
export PATH=$(pwd)/bin:$PATH
echo "::endgroup::"
echo "::group::Print environment information"
uname -a
echo "GOOS: $(go env GOOS)"
echo "GOARCH: $(go env GOARCH)"
echo "::endgroup::"
echo "::group::Run End-to-End Tests"
git config --global --add safe.directory $(pwd)
gmake test-e2e
echo "::endgroup::"
test_openbsd:
name: Run end-to-end tests on OpenBSD
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: test-e2e
uses: vmactions/openbsd-vm@v1
with:
copyback: false
envs: 'GO_VERSION_OPENBSD GNU_TAR_VERSION'
usesh: true
prepare: |
pkg_add -u
pkg_add bash curl gtar-${GNU_TAR_VERSION}p0-static git gmake gsed ggrep go-${GO_VERSION_OPENBSD} python
run: |
echo "::group::Setup prerequisites"
set -eu
mkdir bin
ln -s $(which ggrep) $(pwd)/bin/grep
ln -s $(which gmake) $(pwd)/bin/make
ln -s $(which gsed) $(pwd)/bin/sed
ln -s $(which gtar) $(pwd)/bin/tar
export PATH=$(pwd)/bin:$PATH
echo "::endgroup::"
echo "::group::Print environment information"
uname -a
echo "GOOS: $(go env GOOS)"
echo "GOARCH: $(go env GOARCH)"
echo "::endgroup::"
echo "::group::Run End-to-End Tests"
git config --global --add safe.directory $(pwd)
make test-e2e
echo "::endgroup::"
test_netbsd:
name: Run end-to-end tests on NetBSD
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: test-e2e
uses: vmactions/netbsd-vm@v1
with:
copyback: false
envs: 'GO_VERSION_NETBSD GNU_TAR_VERSION'
usesh: true
prepare: |
/usr/sbin/pkg_add -u
/usr/sbin/pkg_add curl gtar-base-${GNU_TAR_VERSION} git gmake gsed grep go${GO_VERSION_NETBSD} python312
run: |
echo "::group::Setup prerequisites"
set -eu
mkdir bin
ln -s $(which go${GO_VERSION_NETBSD}) $(pwd)/bin/go
ln -s $(which ggrep) $(pwd)/bin/grep
ln -s $(which gmake) $(pwd)/bin/make
ln -s $(which gsed) $(pwd)/bin/sed
ln -s $(which gtar) $(pwd)/bin/tar
export PATH=$(pwd)/bin:$PATH
echo "::endgroup::"
echo "::group::Print environment information"
uname -a
echo "GOOS: $(go env GOOS)"
echo "GOARCH: $(go env GOARCH)"
echo "::endgroup::"
echo "::group::Run End-to-End Tests"
git config --global --add safe.directory $(pwd)
make test-e2e
echo "::endgroup::"
test_dragonfly:
name: Run end-to-end tests on DragonFly
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: test-e2e
uses: vmactions/dragonflybsd-vm@v1
with:
copyback: false
envs: 'GO_VERSION_DRAGONFLY'
usesh: true
prepare: |
pkg update && pkg upgrade -y
pkg install -y bash wget gtar git gmake gsed gnugrep python3
run: |
echo "::group::Setup prerequisites"
set -eu
mkdir bin
export PATH=$(pwd)/bin:$PATH
wget https://go.dev/dl/go${GO_VERSION_DRAGONFLY}.dragonfly-amd64.tar.gz
gtar xzf go${GO_VERSION_DRAGONFLY}.dragonfly-amd64.tar.gz
ln -s $(pwd)/go/bin/go $(pwd)/bin/go
ln -s $(which ggrep) $(pwd)/bin/grep
ln -s $(which gmake) $(pwd)/bin/make
ln -s $(which gsed) $(pwd)/bin/sed
ln -s $(which gtar) $(pwd)/bin/tar
ln -s $(which python3) $(pwd)/bin/python
echo "::endgroup::"
echo "::group::Print environment information"
uname -a
echo "GOOS: $(go env GOOS)"
echo "GOARCH: $(go env GOARCH)"
echo "::endgroup::"
echo "::group::Run End-to-End Tests"
git config --global --add safe.directory $(pwd)
gmake test-e2e
echo "::endgroup::"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ dependencies-stamp
/.release
/.tarballs

tools/tools

# Intellij

/.idea
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,13 @@ update_fixtures:
rm -vf collector/fixtures/udev/.unpacked
./ttar -C collector/fixtures -c -f collector/fixtures/udev.ttar udev

.PHONY: tools
tools:
@rm ./tools/tools >/dev/null 2>&1 || true
@$(GO) build -o tools ./tools/...

.PHONY: test-e2e
test-e2e: build collector/fixtures/sys/.unpacked collector/fixtures/udev/.unpacked
test-e2e: build collector/fixtures/sys/.unpacked collector/fixtures/udev/.unpacked tools
@echo ">> running end-to-end tests"
./end-to-end-test.sh

Expand Down
8 changes: 7 additions & 1 deletion Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,13 @@ common-unused:
.PHONY: common-build
common-build: promu
@echo ">> building binaries"
$(PROMU) build --prefix $(PREFIX) $(PROMU_BINARIES)
@$(PROMU) build --prefix $(PREFIX) $(PROMU_BINARIES)
@# Use the codesign binary directly instead of `promu codesign` as it depends on an image that doesn't support linux/arm64 (w.r.t. darwin's rosetta emulation) yet.
@if [ "$(GOHOSTOS)" = "darwin" ]; then \
if command -v codesign > /dev/null 2>&1; then \
codesign --sign - --force --preserve-metadata=entitlements,requirements,flags,runtime node_exporter >/dev/null 2>&1; \
fi; \
fi

.PHONY: common-tarball
common-tarball: promu
Expand Down
Loading

0 comments on commit 73d54c5

Please sign in to comment.