Skip to content

chore(deps): bump golang from 1.22.5 to 1.23.1 in /.github/go #386

chore(deps): bump golang from 1.22.5 to 1.23.1 in /.github/go

chore(deps): bump golang from 1.22.5 to 1.23.1 in /.github/go #386

name: Test and Release
on:
push:
jobs:
unit-test:
runs-on: ubuntu-22.04
steps:
- uses: actions/[email protected]
- name: Load Go version
id: go-version
run: |
echo go-version=$(sed 's/^.*://' .github/go/Dockerfile) >> $GITHUB_OUTPUT
- uses: actions/setup-go@v5
with:
go-version: ${{ steps.go-version.outputs.go-version }}
- name: Unit tests
run: |
make test race
lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/[email protected]
- uses: actions/setup-go@v5
with:
go-version: 1.17
- name: Lint
uses: golangci/[email protected]
with:
version: v1.31
spec-test:
runs-on: ubuntu-22.04
steps:
- uses: actions/[email protected]
- name: Load Go version
id: go-version
run: |
echo go-version=$(sed 's/^.*://' .github/go/Dockerfile) >> $GITHUB_OUTPUT
- uses: actions/setup-go@v5
with:
go-version: ${{ steps.go-version.outputs.go-version }}
- name: Build executable
run: |
make build
- name: Build spec test suite docker image
run: |
cd spec/test
docker build . -t bbvalabsci/kapow-spec-test-suite:latest
- name: Spec test
run: |
docker run --mount type=bind,source=$(pwd)/build/kapow,target=/usr/bin/kapow bbvalabsci/kapow-spec-test-suite:latest "behave --tags=~@skip"
doc-test:
runs-on: ubuntu-22.04
steps:
- uses: actions/[email protected]
- name: Prepare Python env
run: |
sudo apt install python3
sudo pip install pipenv
cd docs
pipenv sync
- name: Check for warnings & broken links
run: |
cd docs
SPHINXOPTS="-qW --keep-going" pipenv run make linkcheck html
release:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: ubuntu-22.04
needs: [ unit-test, spec-test, doc-test, lint ]
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
- name: Load Go version
id: go-version
run: |
echo go-version=$(sed 's/^.*://' .github/go/Dockerfile) >> $GITHUB_OUTPUT
- uses: actions/setup-go@v5
with:
go-version: ${{ steps.go-version.outputs.go-version }}
- name: Select custom release notes
id: release-notes
run: |
RELNOTES="docs/release-notes/RELEASE-${GITHUB_REF#refs/tags/}.md"
[[ -f "$RELNOTES" ]] && echo ARGS=--release-notes $RELNOTES >> $GITHUB_OUTPUT || true
- name: Check credentials
id: docker-credentials
run: |
echo defined=$(test -n "${{ secrets.DOCKERHUB_USERNAME }}" && echo true || echo false) >> $GITHUB_OUTPUT
- name: Docker Login
if: steps.docker-credentials.outputs.defined == 'true'
run: |
username="${{ secrets.DOCKERHUB_USERNAME }}"
password="${{ secrets.DOCKERHUB_PASSWORD }}"
echo "$password" | docker login --username "$username" --password-stdin
- uses: goreleaser/[email protected]
with:
args: release --rm-dist ${{ steps.release-notes.outputs.ARGS }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Archive binaries as artifacts
uses: actions/upload-artifact@v4
with:
name: binaries
path: |
dist/*
- name: Upload Docker images
if: steps.docker-credentials.outputs.defined == 'true'
run: docker image push --all-tags bbvalabsci/kapow
wininstaller:
runs-on: ubuntu-22.04
needs: release
strategy:
matrix:
binary: ["kapow_windows_386", "kapow_windows_amd64_v1"]
steps:
- uses: actions/[email protected]
- name: Download a single artifact
uses: actions/download-artifact@v4
with:
name: binaries
- name: Install NSIS
run: |
sudo apt-get update -y
DEBIAN_FRONTEND=noninteractive sudo -E apt-get install --no-install-recommends -y nsis nsis-doc nsis-pluginapi
- name: Prepare NSIS files
run: |
mkdir .github/NSIS/install_dir
cp -p ${{ matrix.binary }}/kapow.exe .github/NSIS/install_dir/
wget https://github.com/awaescher/PathEd/releases/download/1.0/PathEd.zip
unzip PathEd.zip -d .github/NSIS/install_dir/
- name: Set variables for the build
id: set-vars
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
release="${GITHUB_REF_NAME}"
upload_url=$(curl -s -u "$GITHUB_TOKEN" https://api.github.com/repos/BBVA/kapow/releases \
| jq -r '.[] | if .tag_name == "'$release'" then . else empty end | .upload_url' \
| tail -n1)
echo "URL: $upload_url"
echo upload_url=$upload_url >> $GITHUB_OUTPUT
no_rc_release=${release%%-[Rr][Cc]*}
echo nsis_version=${no_rc_release#[Vv]} >> $GITHUB_OUTPUT # NSIS version only accepts \d+.\d+.\d+
unversioned_binary=${{ matrix.binary }}_setup.exe
echo nsis_installer_name=${unversioned_binary//kapow_/kapow_${release#v}_} >> $GITHUB_OUTPUT
- name: Create Windows installer
uses: joncloud/[email protected]
env:
NSIS_VERSION: ${{ steps.set-vars.outputs.nsis_version }}
NSIS_INSTALLER_NAME: ${{ steps.set-vars.outputs.nsis_installer_name }}
with:
script-file: .github/NSIS/windows.nsi
- name: Upload Release Asset
id: upload-release-asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
asset_path: .github/NSIS/${{ steps.set-vars.outputs.nsis_installer_name }}
asset_name: ${{ steps.set-vars.outputs.nsis_installer_name }}
asset_content_type: application/octet-stream
upload_url: ${{ steps.set-vars.outputs.upload_url }}