Skip to content

Fix packages

Fix packages #18

name: Build + test + release
on:
push:
branches:
- main
tags:
- "*"
pull_request:
permissions:
contents: write
jobs:
lint_test:
name: Lint tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.19'
check-latest: true
- name: Run static analysis tests
shell: bash
run: scripts/lint.sh
unit_test:
name: Unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.19'
- run: go test -v -timeout 10m -race ./...
env:
CGO_CFLAGS: "-O -D__BLST_PORTABLE__" # Set the CGO flags to use the portable version of BLST
e2e_test:
name: e2e tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, macos-12]
steps:
- name: Git checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.19'
- name: Run e2e tests
shell: bash
run: scripts/tests.e2e.sh
- name: Set ubuntu tmpdir into actions env
if: startsWith(matrix.os, 'ubuntu')
run: echo "ANR_TMPDIR=/tmp/" >> $GITHUB_ENV
- name: Set macos tmpdir into actions env
if: startsWith(matrix.os, 'macos')
run: echo "ANR_TMPDIR=$TMPDIR" >> $GITHUB_ENV
- name: "Upload Artifact"
if: always()
uses: actions/upload-artifact@v3
with:
name: anr-logs-${{ matrix.os }}
path: |
${{ env.ANR_TMPDIR }}/network-runner-root-data*/
retention-days: 5
release:
needs: [lint_test, unit_test]
runs-on: ubuntu-20.04
steps:
- name: Git checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
path: metal-network-runner
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.19'
- name: Set up arm64 cross compiler
run: |
sudo apt-get -y update
sudo apt-get -y install gcc-aarch64-linux-gnu
- name: Checkout osxcross
uses: actions/checkout@v3
with:
repository: tpoechtrager/osxcross
path: osxcross
- name: Build osxcross
run: |
sudo apt-get -y install clang llvm-dev libxml2-dev uuid-dev libssl-dev bash patch make tar xz-utils bzip2 gzip sed cpio libbz2-dev
cd osxcross
wget https://github.com/joseluisq/macosx-sdks/releases/download/12.3/$MACOS_SDK_FNAME -O tarballs/$MACOS_SDK_FNAME
echo $MACOS_SDK_CHECKSUM tarballs/$MACOS_SDK_FNAME | sha256sum -c -
UNATTENDED=1 ./build.sh
echo $PWD/target/bin >> $GITHUB_PATH
env:
MACOS_SDK_FNAME: MacOSX12.3.sdk.tar.xz
MACOS_SDK_CHECKSUM: 3abd261ceb483c44295a6623fdffe5d44fc4ac2c872526576ec5ab5ad0f6e26c
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --rm-dist
workdir: ./metal-network-runner/
env:
# https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}