Files

49 lines
1.5 KiB
YAML

name: Go worker
on: [workflow_call]
jobs:
worker:
runs-on: ubuntu-latest
defaults:
run:
working-directory: worker
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v6
with:
go-version-file: worker/go.mod
cache-dependency-path: worker/go.sum
- name: Check formatting
run: test -z "$(gofmt -l .)"
- name: Test and vet
run: make test
- uses: goreleaser/goreleaser-action@v7
with:
distribution: goreleaser
version: v2.18.0
install-only: true
- name: Select package version
shell: bash
run: |
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
version="${GITHUB_REF_NAME#v}"
else
version="0.0.0-dev.${GITHUB_RUN_NUMBER}.g${GITHUB_SHA:0:12}"
fi
if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$ ]]; then
echo 'Expected a semantic version after the v tag prefix.' >&2
exit 1
fi
printf 'BUILD_VERSION=%s\n' "$version" >> "$GITHUB_ENV"
- name: Build Linux archives and RPMs
run: make package VERSION="$BUILD_VERSION"
- uses: actions/upload-artifact@v4
with:
name: bec-slurm-worker-packages
if-no-files-found: error
path: |
worker/dist/*.tar.gz
worker/dist/*.rpm
worker/dist/checksums.txt