Skip to content

Compile with go1.21.1 #56

Compile with go1.21.1

Compile with go1.21.1 #56

Workflow file for this run

name: CI
on: push
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: python3 -m unittest
build:
runs-on: ubuntu-latest
strategy:
matrix:
goos: [windows, linux, darwin]
goarch: [amd64, arm64]
goarm: ['']
include:
- goos: linux
goarch: arm
goarm: 6
- goos: linux
goarch: arm
goarm: 7
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
GOARM: ${{ matrix.goarm }}
CGO_ENABLED: 0 # static binary
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: 1.21.1
- run: make dist
- id: vars
run: echo "distpath=$(make distpath)" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v3
with:
name: ${{ steps.vars.outputs.distpath }}
path: ${{ steps.vars.outputs.distpath }}
- run: sha256sum ${{ steps.vars.outputs.distpath }} > ${{ steps.vars.outputs.distpath }}.sha256
- uses: actions/upload-artifact@v3
with:
name: ${{ steps.vars.outputs.distpath }}.sha256
path: ${{ steps.vars.outputs.distpath }}.sha256
containerise:
runs-on: ubuntu-latest
needs: [test, build] # do not build an image if tests failed
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
path: artifacts
- run: |
mkdir dist
mv artifacts/*/*.linux-*.tar.gz dist/
- run: python3 artifact_docker_reorg.py docker/ dist/
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: gebn
password: ${{ secrets.DOCKERHUB_TOKEN }}
- id: vars
run: echo "tag=$(make tag)" >> $GITHUB_OUTPUT
- uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64,linux/arm64/v8,linux/arm/v6,linux/arm/v7
tags: gebn/bmc_exporter:${{ steps.vars.outputs.tag }}
release:
runs-on: ubuntu-latest
needs: [test, build]
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v3
with:
path: artifacts
- uses: softprops/action-gh-release@v1
with:
draft: true
prerelease: ${{ contains(github.ref, '-') }}
files: |
artifacts/*/*