Skip to content

fix windows tests

fix windows tests #205

Workflow file for this run

name: Test, Build, Package, Release
on:
push:
branches:
- "*"
tags:
- "*"
jobs:
get-version:
runs-on: ubuntu-latest
outputs:
minor: ${{ steps.get-minor-version.outputs.minor }}
major: ${{ steps.get-major-version.outputs.major }}
revision: ${{ steps.get-total-revision.outputs.revision }}
sha: ${{ steps.get-short-sha.outputs.sha }}
version: ${{ steps.get-version.outputs.version }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- id: get-major-version
run: echo "major=$(./buildtools/get_version | cut -d . -f 1 | sed -e 's/[^0-9]*//g')" >> $GITHUB_OUTPUT
- id: get-minor-version
run: echo "minor=$(./buildtools/get_version | cut -d . -f 2 | sed -e 's/[^0-9]*//g')" >> $GITHUB_OUTPUT
- id: get-total-revision
run: REV=$(./buildtools/get_version | cut -d . -f 3 | sed -e 's/[^0-9]*//g'); echo "revision=${REV:-0}" >> $GITHUB_OUTPUT
- id: get-short-sha
run: echo "sha=$( git rev-parse --short HEAD )" >> $GITHUB_OUTPUT
- id: get-version
run: echo "version=$(./buildtools/get_version)" >> $GITHUB_OUTPUT
test:
strategy:
fail-fast: false
matrix:
go-version: [1.20.x]
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- run: make citest
test-win:
strategy:
fail-fast: false
matrix:
go-version: [1.20.x]
os: [windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- run: go test -v pkg/... ; if ($LASTEXITCODE -ne 0) { exit 1 }
build:
strategy:
fail-fast: false
matrix:
go-version: [1.20.x]
go-os: [linux, freebsd, darwin]
go-arch: [386, amd64, arm64]
exclude:
- go-os: darwin
go-arch: 386
needs: [test, test-win, get-version]
runs-on: ubuntu-latest
env:
BIN: "snclient-${{needs.get-version.outputs.version}}-${{ matrix.go-os }}-${{ matrix.go-arch }}"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- run: |
echo "Building ${{ env.BIN }}"
make GOOS=${{ matrix.go-os }} GOARCH=${{ matrix.go-arch }} build
- uses: actions/upload-artifact@v3
with:
name: "${{ env.BIN }}"
path: "snclient"
if-no-files-found: error
build-win:
strategy:
fail-fast: false
matrix:
go-version: [1.20.x]
go-os: [windows]
go-arch: [386, amd64]
needs: [test, test-win, get-version]
runs-on: ubuntu-latest
env:
BIN: "snclient-${{needs.get-version.outputs.version}}-${{ matrix.go-os }}-${{ matrix.go-arch }}"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- run: |
echo "Building ${{ env.BIN }}.exe"
make GOOS=${{ matrix.go-os }} GOARCH=${{ matrix.go-arch }} build
mv snclient snclient.exe
- uses: actions/upload-artifact@v3
with:
name: "${{ env.BIN }}"
path: "snclient.exe"
if-no-files-found: error
dist-win:
strategy:
matrix:
go-version: [1.20.x]
needs: [test, test-win, get-version]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- run: sudo apt-get install help2man
- run: |
echo "Creating dist folder for windows"
make windist
- uses: actions/upload-artifact@v3
with:
name: "windist"
path: "dist"
if-no-files-found: error
pkg-msi:
strategy:
matrix:
go-version: [1.20.x]
go-os: [windows]
go-arch: [386, amd64]
needs: [get-version, build-win, dist-win]
runs-on: windows-latest
env:
BIN: "snclient-${{needs.get-version.outputs.version}}-${{ matrix.go-os }}-${{ matrix.go-arch }}"
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: "${{ env.BIN }}"
- uses: actions/download-artifact@v3
with:
name: "windist"
- run: |
Write-Host "Building ${{ env.BIN }}.msi"
& .\packaging\windows\build_msi.ps1 `
-out "${{ env.BIN }}.msi" `
-arch "${{ matrix.go-arch }}" `
-major "${{needs.get-version.outputs.major}}" `
-minor "${{needs.get-version.outputs.minor}}" `
-rev "${{needs.get-version.outputs.revision}}" `
-sha "${{ needs.get-version.outputs.sha }}"
- uses: actions/upload-artifact@v3
with:
name: "${{ env.BIN }}.msi"
path: "${{ env.BIN }}.msi"
if-no-files-found: error
- uses: geekyeggo/delete-artifact@v2
with:
name: ${{ env.BIN }}
pkg-deb:
strategy:
matrix:
go-version: [1.20.x]
go-os: [linux]
go-arch: [386, amd64, arm64]
runs-on: ubuntu-latest
needs: [get-version, build]
env:
BIN: "snclient-${{needs.get-version.outputs.version}}-${{ matrix.go-os }}-${{ matrix.go-arch }}"
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: "${{ env.BIN }}"
- run: sudo apt-get install help2man
- run: |
echo "Building ${{ env.BIN }}.deb"
make VERSION=${{needs.get-version.outputs.version}} ARCH=${{ matrix.go-arch }} DEBFILE=${{ env.BIN }}.deb deb
- uses: actions/upload-artifact@v3
with:
name: "${{ env.BIN }}.deb"
path: "${{ env.BIN }}.deb"
if-no-files-found: error
pkg-osx:
strategy:
matrix:
go-version: [1.20.x]
go-os: [darwin]
go-arch: [amd64, arm64]
runs-on: macos-latest
needs: [get-version, build]
env:
BIN: "snclient-${{needs.get-version.outputs.version}}-${{ matrix.go-os }}-${{ matrix.go-arch }}"
DIST: "snclient-${{needs.get-version.outputs.version}}-osx-${{ matrix.go-arch }}"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/download-artifact@v3
with:
name: "${{ env.BIN }}"
- run: |
echo "Building ${{ env.DIST }}.pkg"
brew install help2man
make osx
mv snclient*.pkg ${{ env.DIST }}.pkg
- uses: actions/upload-artifact@v3
with:
name: "${{ env.DIST }}.pkg"
path: "${{ env.DIST }}.pkg"
if-no-files-found: error
- uses: geekyeggo/delete-artifact@v2
with:
name: "${{ env.BIN }}"
pkg-rpm:
strategy:
matrix:
go-version: [1.20.x]
go-os: [linux]
go-arch: [386, amd64, arm64]
runs-on: ubuntu-latest
needs: [get-version, build]
env:
BIN: "snclient-${{needs.get-version.outputs.version}}-${{ matrix.go-os }}-${{ matrix.go-arch }}"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/download-artifact@v3
with:
name: "${{ env.BIN }}"
- run: sudo apt-get install help2man
- run: |
echo "Building ${{ env.BIN }}.rpm"
make rpm
mv snclient*.rpm ${{ env.BIN }}.rpm
- uses: actions/upload-artifact@v3
with:
name: "${{ env.BIN }}.rpm"
path: "${{ env.BIN }}.rpm"
if-no-files-found: error
# remove those artifacts which have been converted to .deb or .rpm files
clean-tmp-files:
strategy:
matrix:
go-version: [1.20.x]
go-os: [linux]
go-arch: [386, amd64, arm64]
runs-on: ubuntu-latest
needs: [pkg-rpm,pkg-deb]
env:
BIN: "snclient-${{needs.get-version.outputs.version}}-${{ matrix.go-os }}-${{ matrix.go-arch }}"
steps:
- uses: geekyeggo/delete-artifact@v2
with:
name: "${{ env.BIN }}"
# remove those artifacts use for msi files
clean-tmp-windist:
runs-on: ubuntu-latest
needs: [pkg-msi]
steps:
- uses: geekyeggo/delete-artifact@v2
with:
name: "windist"
make-release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: [get-version,pkg-msi,pkg-deb,pkg-rpm]
outputs:
release-upload-url: ${{ steps.create-release.outputs.upload_url }}
steps:
- uses: actions/checkout@v3
- run: make release_notes.txt
- id: create-release
uses: softprops/action-gh-release@v1
with:
name: "v${{needs.get-version.outputs.version}}"
tag_name: "v${{needs.get-version.outputs.version}}"
draft: true
body_path: "release_notes.txt"
upload-windows-release-assets:
if: startsWith(github.ref, 'refs/tags/')
strategy:
matrix:
go-version: [1.20.x]
go-os: [windows]
go-arch: [386, amd64]
runs-on: ubuntu-latest
needs: [get-version,make-release]
env:
BIN: "snclient-${{needs.get-version.outputs.version}}-${{ matrix.go-os }}-${{ matrix.go-arch }}"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: "${{ env.BIN }}.msi"
- run: gh release upload v${{needs.get-version.outputs.version}} ${{ env.BIN }}.msi
upload-linux-deb-assets:
if: startsWith(github.ref, 'refs/tags/')
strategy:
matrix:
go-version: [1.20.x]
go-os: [linux]
go-arch: [386, amd64, arm64]
runs-on: ubuntu-latest
needs: [get-version,make-release]
env:
BIN: "snclient-${{needs.get-version.outputs.version}}-${{ matrix.go-os }}-${{ matrix.go-arch }}"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: "${{ env.BIN }}.deb"
- run: gh release upload v${{needs.get-version.outputs.version}} ${{ env.BIN }}.deb
upload-linux-rpm-assets:
if: startsWith(github.ref, 'refs/tags/')
strategy:
matrix:
go-version: [1.20.x]
go-os: [linux]
go-arch: [386, amd64, arm64]
runs-on: ubuntu-latest
needs: [get-version,make-release]
env:
BIN: "snclient-${{needs.get-version.outputs.version}}-${{ matrix.go-os }}-${{ matrix.go-arch }}"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: "${{ env.BIN }}.rpm"
- run: gh release upload v${{needs.get-version.outputs.version}} ${{ env.BIN }}.rpm
upload-osx-pkg-assets:
if: startsWith(github.ref, 'refs/tags/')
strategy:
matrix:
go-version: [1.20.x]
go-os: [darwin]
go-arch: [amd64, arm64]
runs-on: ubuntu-latest
needs: [get-version,make-release]
env:
BIN: "snclient-${{needs.get-version.outputs.version}}-osx-${{ matrix.go-arch }}"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: "${{ env.BIN }}.pkg"
- run: gh release upload v${{needs.get-version.outputs.version}} ${{ env.BIN }}.pkg
upload-binary-release-assets:
if: startsWith(github.ref, 'refs/tags/')
strategy:
matrix:
go-version: [1.20.x]
go-os: [freebsd]
go-arch: [386, amd64, arm64]
runs-on: ubuntu-latest
needs: [get-version,make-release]
env:
BIN: "snclient-${{needs.get-version.outputs.version}}-${{ matrix.go-os }}-${{ matrix.go-arch }}"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: "${{ env.BIN }}"
- run: tar cvzf ./${{ env.BIN }}.tar.gz ./*
- run: gh release upload v${{needs.get-version.outputs.version}} ${{ env.BIN }}.tar.gz