Skip to content

Commit

Permalink
chore: support non-linux GOOS in e2e tests
Browse files Browse the repository at this point in the history
Signed-off-by: Pranshu Srivastava <[email protected]>
  • Loading branch information
rexagod committed Nov 23, 2024
1 parent 450b0b7 commit 17a424d
Show file tree
Hide file tree
Showing 9 changed files with 463 additions and 65 deletions.
168 changes: 168 additions & 0 deletions .github/workflows/bsd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
name: e2e-tests-on-bsd

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

permissions:
contents: read

env:
GO_VERSION: "123"

jobs:
test:
name: e2e-tests
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4

- name: Run end-to-end tests on FreeBSD
uses: vmactions/freebsd-vm@v1
with:
envs: 'GO_VERSION'
usesh: true
prepare: |
pkg update -f
pkg install -y bash curl git gmake gsed ggrep go${GO_VERSION} python
run: | # The steps below are executed inside the FreeBSD VM.
set -eux
mkdir bin
ln -s $(which go${GO_VERSION}) bin/go
ls -s $(which gsed) bin/sed
ls -s $(which ggrep) bin/grep
ls -s $(which gmake) bin/make
export PATH=$(pwd)/bin:$PATH
echo "::group::Print environment information"
freebsd-version
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::"
- name: Run end-to-end tests on OpenBSD
uses: vmactions/openbsd-vm@v1
with:
envs: 'GO_VERSION'
usesh: true
prepare: |
pkg_add update -f
pkg_add install -y bash curl git gmake go${GO_VERSION} python
run: | # The steps below are executed inside the FreeBSD VM.
set -eux
mkdir bin
ln -s $(which go${GO_VERSION}) bin/go
ls -s $(which gsed) bin/sed
ls -s $(which ggrep) bin/grep
ls -s $(which gmake) bin/make
export PATH=$PATH:$(pwd)/golang-bin
echo "::group::Print environment information"
freebsd-version
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::"
- name: Run end-to-end tests on NetBSD
uses: vmactions/netbsd-vm@v1
with:
envs: 'GO_VERSION'
usesh: true
prepare: |
/usr/sbin/pkg_add update -f
/usr/sbin/pkg_add install -y bash curl git gmake gsed ggrep go${GO_VERSION} python
run: | # The steps below are executed inside the FreeBSD VM.
set -eux
mkdir bin
ln -s $(which go${GO_VERSION}) bin/go
ls -s $(which gsed) bin/sed
ls -s $(which ggrep) bin/grep
ls -s $(which gmake) bin/make
export PATH=$PATH:$(pwd)/golang-bin
echo "::group::Print environment information"
freebsd-version
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::"
- name: Run end-to-end tests on Solaris
uses: vmactions/solaris-vm@v1
with:
envs: 'GO_VERSION'
usesh: true
prepare: |
pkgutil update -f
pkgutil install -y bash curl git gmake gsed ggrep go${GO_VERSION} python
run: | # The steps below are executed inside the FreeBSD VM.
set -eux
mkdir bin
ln -s $(which go${GO_VERSION}) bin/go
ls -s $(which gsed) bin/sed
ls -s $(which ggrep) bin/grep
ls -s $(which gmake) bin/make
export PATH=$PATH:$(pwd)/golang-bin
echo "::group::Print environment information"
freebsd-version
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::"
- name: Run end-to-end tests on DragonFly
uses: vmactions/dragonflybsd-vm@v1
with:
envs: 'GO_VERSION'
usesh: true
prepare: |
pkg update -f
pkg install -y bash curl git gmake gsed ggrep go${GO_VERSION} python
run: | # The steps below are executed inside the FreeBSD VM.
set -eux
mkdir bin
ln -s $(which go${GO_VERSION}) bin/go
ls -s $(which gsed) bin/sed
ls -s $(which ggrep) bin/grep
ls -s $(which gmake) bin/make
export PATH=$PATH:$(pwd)/golang-bin
echo "::group::Print environment information"
freebsd-version
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::"
49 changes: 0 additions & 49 deletions .github/workflows/freebsd.yml

This file was deleted.

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 ;\
fi; \
fi

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

0 comments on commit 17a424d

Please sign in to comment.