Skip to content

ci: make release step idempotent and untrack technical report #9

ci: make release step idempotent and untrack technical report

ci: make release step idempotent and untrack technical report #9

Workflow file for this run

name: Build macOS wheels
on:
push:
tags: ["v*"]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
runs-on: macos-14
name: "arm64 — Python ${{ matrix.python-version }}"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.21"
cache-dependency-path: dpi_bridge/go.sum
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Decode DPI headers
env:
DPI_HEADERS_TAR_B64: ${{ secrets.DPI_HEADERS_TAR_B64 }}
run: |
mkdir -p dpi_include
echo "$DPI_HEADERS_TAR_B64" | base64 -d | tar xzf - -C dpi_include/
- name: Build Go bridge library
run: |
cd dpi_bridge && go build -buildmode=c-shared -o libdmdpi.dylib .
install_name_tool -id @rpath/libdmdpi.dylib libdmdpi.dylib
- name: Install build tools
run: pip install build delocate
- name: Build wheel
env:
MACOSX_DEPLOYMENT_TARGET: "14.0"
_PYTHON_HOST_PLATFORM: "macosx-14.0-arm64"
run: DMPYTHON_SKIP_GO_BUILD=1 python -m build --wheel
- name: Delocate wheel
run: |
mkdir -p dist_fixed
DYLD_LIBRARY_PATH=dpi_bridge delocate-wheel -w dist_fixed dist/*.whl -v
- name: Verify wheel
run: |
python -m venv /tmp/test_venv
/tmp/test_venv/bin/pip install dist_fixed/*.whl
/tmp/test_venv/bin/python -c "import dmPython; print('dmPython version:', dmPython.version)"
- name: Build extension for optional integration tests
if: ${{ secrets.DM_TEST_HOST != '' && secrets.DM_TEST_PORT != '' && secrets.DM_TEST_USER != '' && secrets.DM_TEST_PASSWORD != '' }}
run: DMPYTHON_SKIP_GO_BUILD=1 python setup.py build_ext --inplace
- name: Run optional DM integration tests
if: ${{ secrets.DM_TEST_HOST != '' && secrets.DM_TEST_PORT != '' && secrets.DM_TEST_USER != '' && secrets.DM_TEST_PASSWORD != '' }}
env:
DYLD_LIBRARY_PATH: ${{ github.workspace }}/dpi_bridge
DM_TEST_HOST: ${{ secrets.DM_TEST_HOST }}
DM_TEST_PORT: ${{ secrets.DM_TEST_PORT }}
DM_TEST_USER: ${{ secrets.DM_TEST_USER }}
DM_TEST_PASSWORD: ${{ secrets.DM_TEST_PASSWORD }}
DM_TEST_BOUNDARY_SIZES: ${{ secrets.DM_TEST_BOUNDARY_SIZES }}
DM_TEST_STRESS_ROWS: ${{ secrets.DM_TEST_STRESS_ROWS }}
DM_TEST_STRESS_WORKERS: ${{ secrets.DM_TEST_STRESS_WORKERS }}
DM_TEST_CHURN_LOOPS: ${{ secrets.DM_TEST_CHURN_LOOPS }}
DM_TEST_GC_LOOPS: ${{ secrets.DM_TEST_GC_LOOPS }}
run: |
python -m pip install pytest pytest-timeout pytest-cov
python -m pytest -q -m requires_dm tests --cov=. --cov-report=term-missing --cov-report=xml:coverage.xml
- name: Upload optional integration coverage
if: ${{ secrets.DM_TEST_HOST != '' && secrets.DM_TEST_PORT != '' && secrets.DM_TEST_USER != '' && secrets.DM_TEST_PASSWORD != '' }}
uses: actions/upload-artifact@v4
with:
name: coverage-wheel-py${{ matrix.python-version }}
path: coverage.xml
- name: Skip optional integration tests (missing DM secrets)
if: ${{ secrets.DM_TEST_HOST == '' || secrets.DM_TEST_PORT == '' || secrets.DM_TEST_USER == '' || secrets.DM_TEST_PASSWORD == '' }}
run: echo "Skipping requires_dm tests: DM_TEST_HOST/PORT/USER/PASSWORD secrets not fully configured."

Check failure on line 94 in .github/workflows/build-wheels.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/build-wheels.yml

Invalid workflow file

You have an error in your yaml syntax on line 94
- uses: actions/upload-artifact@v4
with:
name: wheel-arm64-py${{ matrix.python-version }}
path: dist_fixed/*.whl
release:
needs: build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: macos-14
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: dist_fixed
pattern: wheel-*
merge-multiple: true
- name: Upsert GitHub Release
env:
GH_TOKEN: ${{ github.token }}
TAG_NAME: ${{ github.ref_name }}
run: |
if gh release view "$TAG_NAME" >/dev/null 2>&1; then
echo "Release $TAG_NAME already exists, uploading artifacts with --clobber"
gh release upload "$TAG_NAME" dist_fixed/*.whl --clobber
else
echo "Creating release $TAG_NAME"
gh release create "$TAG_NAME" --generate-notes dist_fixed/*.whl
fi