Skip to content

Build

Build #96

Workflow file for this run

name: Build
on:
workflow_run:
workflows: Tests
types: completed
branches:
- main
- '!develop'
jobs:
build:
strategy:
matrix:
include:
- os: ubuntu-latest
arch: x64
- os: windows-latest
arch: x64
- os: macos-13
arch: x64
- os: macos-14
arch: arm64
runs-on: ${{ matrix.os }}
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'main' }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v5
if: ${{ matrix.arch != 'arm64' }}
with:
python-version: '3.12'
cache: 'poetry'
cache-dependency-path: './poetry.lock'
architecture: ${{ matrix.arch }}
- uses: actions/setup-python@v5
if: ${{ matrix.arch == 'arm64' }}
with:
python-version: '3.12'
- name: Setup (Linux)
if: ${{ runner.os == 'Linux' }}
id: setup-linux
run: |
sudo apt-get install tree rpm
mkdir -p ./release
NAME="$(poetry run python -c 'from src.utils.constants import get_name; print(get_name())')"
VERSION="$(poetry run python -c 'from src.utils.constants import get_version; print(get_version())')"
DESCRIPTION="$(poetry run python -c 'from src.utils.constants import get_description; print(get_description())')"
echo "name=${NAME}" >> $GITHUB_OUTPUT
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "description=${DESCRIPTION}" >> $GITHUB_OUTPUT
- name: Setup (MacOS)
if: ${{ runner.os == 'macOS' }}
id: setup-macos
run: |
brew install create-dmg
brew reinstall openssl@3
brew unlink openssl@3 && brew link openssl@3
#OPENSSL_MAJOR_VERSION=`$(which openssl) -version | awk '{ print $2}' | cut -d . -f1`
OPENSSL_FULL_VERSION=`$(which openssl) -version | awk '{ print $2}'`
OPENSSL_PATH="/opt/homebrew/Cellar/openssl@3/${OPENSSL_FULL_VERSION}"
echo "dyld-path=${OPENSSL_PATH}/lib" >> $GITHUB_OUTPUT
- name: Install project and its dependencies
run: poetry install
- name: Build dist (Linux)
if: ${{ runner.os == 'Linux' }}
uses: coactions/setup-xvfb@6b00cf1889f4e1d5a48635647013c0508128ee1a
with:
run: |
poetry add pytest-xvfb
poetry run poe build-linux
- name: Build dist (MacOS)
if: ${{ runner.os == 'macOS' }}
env:
DYLD_LIBRARY_PATH: ${{ steps.setup-macos.outputs.dyld-path }}
run: poetry run poe build-macos
- name: Build dist (Windows)
if: ${{ runner.os == 'Windows' }}
env:
KIVY_GL_BACKEND: 'angle_sdl2'
run: poetry run poe build-win
- name: Build release deb (Linux)
if: ${{ runner.os == 'Linux' }}
id: release-deb
env:
NAME: ${{ steps.setup-linux.outputs.name }}
VERSION: ${{ steps.setup-linux.outputs.version }}
DESCRIPTION: ${{ steps.setup-linux.outputs.description }}
run: |
sh .ci/create-deb.sh \
-a "${NAME}" \
-o ./release \
-v $VERSION \
-A amd64 \
-m qlrd \
-e [email protected] \
-d "${DESCRIPTION}" \
-b "./dist/${NAME}" \
-i ./assets/icon.png
tree ./release
echo "build-path=$(pwd)/release" >> $GITHUB_OUTPUT
echo "pkg=${NAME}_${VERSION}_amd64.deb" >> $GITHUB_OUTPUT
- name: Build release rpm (Linux)
if: ${{ runner.os == 'Linux' }}
id: release-rpm
env:
NAME: ${{ steps.setup-linux.outputs.name }}
VERSION: ${{ steps.setup-linux.outputs.version }}
DESCRIPTION: ${{ steps.setup-linux.outputs.description }}
run: |
RPM_VERSION=$(sed -e 's/-/_/g' <<< $VERSION)
sh .ci/create-rpm.sh \
-a "${NAME}" \
-v $RPM_VERSION \
-m qlrd \
-e [email protected] \
-d "${DESCRIPTION}" \
-c ./CHANGELOG.md \
-r ./README.md \
-b "./dist/${NAME}" \
-i ./assets/icon.png
tree ./release
rpmbuild -vv -bb --define "_bindir /usr/local/bin" $HOME/rpmbuild/SPECS/$NAME.spec
cp $HOME/rpmbuild/RPMS/x86_64/${NAME}-${RPM_VERSION}-1.x86_64.rpm ./release/${NAME}-${RPM_VERSION}-1.x86_64.rpm4
echo "build-path=${HOME}/rpmbuild/RPMS/x86_64" >> $GITHUB_OUTPUT
echo "pkg=${NAME}-${RPM_VERSION}-1.x86_64.rpm" >> $GITHUB_OUTPUT
- name: Build release dmg (MacOS)
if: ${{ runner.os == 'macOS' }}
id: release-macos
run: |
NAME="$(poetry run python -c 'from src.utils.constants import get_name; print(get_name())')"
VER="$(poetry run python -c 'from src.utils.constants import get_version; print(get_version())')"
ARCH="$(uname -m)"
mkdir -p ./release
create-dmg --volname "${NAME}" --volicon ./assets/icon.icns --window-pos 200 120 --window-size 800 400 --icon-size 100 --icon "${NAME}.app" 200 190 --app-drop-link 600 185 "./release/${NAME}_${VER}_${ARCH}.dmg" "./dist/${NAME}.app"
echo "build-path=$(pwd)/release" >> $GITHUB_OUTPUT
echo "pkg=${NAME}_${VER}_${ARCH}.dmg" >> $GITHUB_OUTPUT
- name: Build release NSIS (Windows)
if: ${{ runner.os == 'Windows' }}
id: release-windows
shell: pwsh
run: |
choco --yes install nsis
New-Item ".\release" -Type Directory
$name = poetry run python -c 'from src.utils.constants import get_name; print(get_name())'
$version = poetry run python -c 'from src.utils.constants import get_version; print(get_version())'
$description = poetry run python -c 'from src.utils.constants import get_description; print(get_description())'
poetry run python .ci/create-nsis.py -a $name -b .\dist\krux-installer.exe -o selfcustody -V $version -d "$description" -l .\LICENSE -i .\assets\icon.ico -O .
makensis.exe .\krux-installer.nsi
Move-Item -Path ".\krux-installer Setup.exe" -Destination ".\release\krux-installer_v$version Setup.exe"
echo "build-path=$pwd\release" | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append
echo "pkg=krux-installer_v$version Setup.exe" | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append
- name: Hash (Linux deb)
if: ${{ runner.os == 'Linux' }}
uses: qlrd/sha256sum-action@v3
id: hash-deb
with:
working-directory: ${{ steps.release-deb.outputs.build-path }}
file: ${{ steps.release-deb.outputs.pkg }}
ext: 'sha256.txt'
- name: Hash (Linux rpm)
if: ${{ runner.os == 'Linux' }}
uses: qlrd/sha256sum-action@v3
id: hash-rpm
with:
working-directory: ${{ steps.release-rpm.outputs.build-path }}
file: ${{ steps.release-rpm.outputs.pkg }}
ext: 'sha256.txt'
- name: Hash (MacOS)
if: ${{ runner.os == 'macOS' }}
uses: qlrd/sha256sum-action@v3
id: hash-macos
with:
working-directory: ${{ steps.release-macos.outputs.build-path }}
file: ${{ steps.release-macos.outputs.pkg }}
ext: 'sha256.txt'
- name: Hash (Windows)
if: ${{ runner.os == 'Windows' }}
uses: qlrd/sha256sum-action@v3
id: hash-win
with:
working-directory: ${{ steps.release-windows.outputs.build-path }}
file: ${{ steps.release-windows.outputs.pkg }}
ext: 'sha256.txt'
- name: Upload artifact deb (Linux)
if: ${{ runner.os == 'Linux' }}
uses: actions/upload-artifact@v4
with:
name: ${{ steps.release-deb.outputs.pkg }}
path: |
${{ steps.release-deb.outputs.build-path}}/${{ steps.release-deb.outputs.pkg }}
${{ steps.release-deb.outputs.build-path}}/${{ steps.release-deb.outputs.pkg }}.sha256.txt
- name: Upload artifact rpm (Linux)
if: ${{ runner.os == 'Linux' }}
uses: actions/upload-artifact@v4
with:
name: ${{ steps.release-rpm.outputs.pkg }}
path: |
${{ steps.release-rpm.outputs.build-path}}/${{ steps.release-rpm.outputs.pkg }}
${{ steps.release-rpm.outputs.build-path}}/${{ steps.release-rpm.outputs.pkg }}.sha256.txt
- name: Upload artifacts (MacOS)
if: ${{ runner.os == 'macOS' }}
uses: actions/upload-artifact@v4
with:
name: ${{ steps.release-macos.outputs.pkg }}
path: |
${{ steps.release-macos.outputs.build-path}}/${{ steps.release-macos.outputs.pkg }}
${{ steps.release-macos.outputs.build-path}}/${{ steps.release-macos.outputs.pkg }}.sha256.txt
- name: Upload artifacts (Windows)
if: ${{ runner.os == 'Windows' }}
uses: actions/upload-artifact@v4
with:
name: ${{ steps.release-windows.outputs.pkg }}
path: |
${{ steps.release-windows.outputs.build-path}}/${{ steps.release-windows.outputs.pkg }}
${{ steps.release-windows.outputs.build-path}}/${{ steps.release-windows.outputs.pkg }}.sha256.txt