Skip to content

binary building on gh: fixes #6

binary building on gh: fixes

binary building on gh: fixes #6

Workflow file for this run

name: Build binaries
on:
push:
branches: [ 1.4-maint ]
paths:
- '**.py'
- '**.pyx'
- '**.c'
- '**.h'
- '**.yml'
- '**.toml'
- '**.cfg'
- '**.ini'
- 'requirements.d/*'
- 'scripts/**'
pull_request:
branches: [ 1.4-maint ]
paths:
- '**.py'
- '**.pyx'
- '**.c'
- '**.h'
- '**.yml'
- '**.toml'
- '**.cfg'
- '**.ini'
- 'requirements.d/*'
- 'scripts/**'
workflow_dispatch:
jobs:
build-binary-macos:
name: Build (macOS ${{ matrix.os }} / ${{ matrix.arch }})
strategy:
fail-fast: false
matrix:
include:
- os: macos-13
arch: X64
- os: macos-14
arch: ARM64
runs-on: ${{ matrix.os }}
timeout-minutes: 60
# env:
# Support both Homebrew locations (Intel and Apple Silicon)
# PKG_CONFIG_PATH: "/opt/homebrew/opt/[email protected]/lib/pkgconfig:/usr/local/opt/[email protected]/lib/pkgconfig:$PKG_CONFIG_PATH"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# Just fetching one commit is not enough for setuptools-scm, so we fetch all
fetch-depth: 0
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.d/development.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install macOS packages via Homebrew (see Brewfile)
run: |
brew bundle install
- name: Install Python requirements
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements.d/development.txt
- name: Build Borg to compile extensions
#env:
# # Set both paths again to be sure nothing overrides them
# PKG_CONFIG_PATH: "/opt/homebrew/opt/[email protected]/lib/pkgconfig:/usr/local/opt/[email protected]/lib/pkgconfig:${{ env.PKG_CONFIG_PATH }}"
run: |
pip install -ve .
- name: Build Borg fat binaries using PyInstaller
run: |
python -m pip install 'pyinstaller==6.7.0'
mkdir -p dist/binary
pyinstaller --clean --distpath=dist/binary scripts/borg.exe.spec
- name: Smoke-test the built binary (borg -V)
run: |
pushd dist/binary
echo "single-file binary"
chmod +x borg.exe
./borg.exe -V
echo "single-directory binary"
chmod +x borg-dir/borg.exe
./borg-dir/borg.exe -V
tar czf borg.tgz borg-dir
popd
- name: Prepare artifacts
run: |
mkdir -p artifacts
if [ -f dist/binary/borg.exe ]; then
cp dist/binary/borg.exe artifacts/borg-${{ matrix.os }}-${{ matrix.arch }}.exe
fi
if [ -f dist/binary/borg.tgz ]; then
cp dist/binary/borg.tgz artifacts/borg-${{ matrix.os }}-${{ matrix.arch }}.tgz
fi
echo "artifact files"
ls -l artifacts/
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: borg-${{ matrix.os }}-${{ matrix.arch }}
path: artifacts/*
if-no-files-found: error