Fix pr commenter bug (#1479) #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish compas-popsynth to PyPI | |
| on: | |
| push: | |
| branches: | |
| - dev | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| mode: | |
| description: Build only or publish to PyPI | |
| required: true | |
| default: dry-run | |
| type: choice | |
| options: | |
| - dry-run | |
| - publish | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-linux-wheel: | |
| name: Build and verify Linux wheel | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Build Linux wheel with cibuildwheel | |
| uses: pypa/cibuildwheel@v3.1.2 | |
| env: | |
| CIBW_BUILD: cp311-manylinux_x86_64 | |
| CIBW_ARCHS_LINUX: x86_64 | |
| CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28 | |
| CIBW_ENVIRONMENT_LINUX: COMPAS_BINARY_WHEEL=1 | |
| CIBW_BEFORE_ALL_LINUX: > | |
| bash {project}/misc/cicd-scripts/manylinux-dependencies && | |
| make -C {project}/src DOCKER_BUILD=1 CPP=g++ -j "$(nproc)" -f Makefile && | |
| {project}/src/COMPAS -v && | |
| bash {project}/misc/cicd-scripts/package-linux-bundle.sh {project}/src/COMPAS {project}/dist/COMPAS-linux-x86_64 && | |
| rm -rf {project}/compas_python_utils/bundled/COMPAS-linux-x86_64 && | |
| mkdir -p {project}/compas_python_utils/bundled && | |
| cp -a {project}/dist/COMPAS-linux-x86_64 {project}/compas_python_utils/bundled/ && | |
| test -f {project}/compas_python_utils/bundled/COMPAS-linux-x86_64/run_compas.sh | |
| CIBW_TEST_COMMAND_LINUX: > | |
| compas_run --print-path && | |
| compas_run -v && | |
| WHEEL_SMOKE_DIR="$(mktemp -d)" && | |
| compas_run -n 1 --initial-mass-1 35 --initial-mass-2 31 -a 3.5 --random-seed 0 --metallicity 0.001 --quiet -o "$WHEEL_SMOKE_DIR" && | |
| test -d "$WHEEL_SMOKE_DIR" | |
| - name: Upload wheel artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: compas-popsynth-wheel-linux | |
| path: wheelhouse/*.whl | |
| if-no-files-found: error | |
| build-macos-arm64-wheel: | |
| name: Build and verify macOS arm64 wheel | |
| runs-on: macos-14 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Build macOS arm64 wheel with cibuildwheel | |
| uses: pypa/cibuildwheel@v3.1.2 | |
| env: | |
| CIBW_BUILD: cp311-macosx_arm64 | |
| CIBW_ARCHS_MACOS: arm64 | |
| CIBW_ENVIRONMENT_MACOS: COMPAS_BINARY_WHEEL=1 MACOSX_DEPLOYMENT_TARGET=14.0 | |
| CIBW_REPAIR_WHEEL_COMMAND_MACOS: "" | |
| CIBW_BEFORE_ALL_MACOS: > | |
| bash {project}/misc/cicd-scripts/macos-wheel-dependencies && | |
| make -C {project}/src CPP=clang++ -j "$(sysctl -n hw.logicalcpu)" -f Makefile && | |
| test -x {project}/src/COMPAS && | |
| bash {project}/misc/cicd-scripts/package-macos-bundle.sh {project}/src/COMPAS arm64 {project}/dist/COMPAS-macos-arm64 && | |
| rm -rf {project}/compas_python_utils/bundled/COMPAS-macos-arm64 && | |
| mkdir -p {project}/compas_python_utils/bundled && | |
| cp -R {project}/dist/COMPAS-macos-arm64 {project}/compas_python_utils/bundled/ && | |
| test -f {project}/compas_python_utils/bundled/COMPAS-macos-arm64/run_compas.sh | |
| CIBW_TEST_COMMAND_MACOS: > | |
| compas_run --print-path && | |
| compas_run -v && | |
| WHEEL_SMOKE_DIR="$(mktemp -d)" && | |
| compas_run -n 1 --initial-mass-1 35 --initial-mass-2 31 -a 3.5 --random-seed 0 --metallicity 0.001 --quiet -o "$WHEEL_SMOKE_DIR" && | |
| test -d "$WHEEL_SMOKE_DIR" | |
| - name: Upload wheel artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: compas-popsynth-wheel-macos-arm64 | |
| path: wheelhouse/*.whl | |
| if-no-files-found: error | |
| build-macos-x86_64-wheel: | |
| name: Build and verify macOS x86_64 wheel | |
| runs-on: macos-15-intel | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Build macOS x86_64 wheel with cibuildwheel | |
| uses: pypa/cibuildwheel@v3.1.2 | |
| env: | |
| CIBW_BUILD: cp311-macosx_x86_64 | |
| CIBW_ARCHS_MACOS: x86_64 | |
| CIBW_ENVIRONMENT_MACOS: COMPAS_BINARY_WHEEL=1 MACOSX_DEPLOYMENT_TARGET=14.0 | |
| CIBW_REPAIR_WHEEL_COMMAND_MACOS: "" | |
| CIBW_BEFORE_ALL_MACOS: > | |
| bash {project}/misc/cicd-scripts/macos-wheel-dependencies && | |
| make -C {project}/src CPP=clang++ -j "$(sysctl -n hw.logicalcpu)" -f Makefile && | |
| test -x {project}/src/COMPAS && | |
| bash {project}/misc/cicd-scripts/package-macos-bundle.sh {project}/src/COMPAS x86_64 {project}/dist/COMPAS-macos-x86_64 && | |
| rm -rf {project}/compas_python_utils/bundled/COMPAS-macos-x86_64 && | |
| mkdir -p {project}/compas_python_utils/bundled && | |
| cp -R {project}/dist/COMPAS-macos-x86_64 {project}/compas_python_utils/bundled/ && | |
| test -f {project}/compas_python_utils/bundled/COMPAS-macos-x86_64/run_compas.sh | |
| CIBW_TEST_COMMAND_MACOS: > | |
| compas_run --print-path && | |
| compas_run -v && | |
| WHEEL_SMOKE_DIR="$(mktemp -d)" && | |
| compas_run -n 1 --initial-mass-1 35 --initial-mass-2 31 -a 3.5 --random-seed 0 --metallicity 0.001 --quiet -o "$WHEEL_SMOKE_DIR" && | |
| test -d "$WHEEL_SMOKE_DIR" | |
| - name: Upload wheel artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: compas-popsynth-wheel-macos-x86_64 | |
| path: wheelhouse/*.whl | |
| if-no-files-found: error | |
| publish-pypi: | |
| name: Publish wheel to PyPI | |
| runs-on: ubuntu-22.04 | |
| needs: | |
| - build-linux-wheel | |
| - build-macos-arm64-wheel | |
| - build-macos-x86_64-wheel | |
| if: ${{ (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) || (github.event_name == 'workflow_dispatch' && github.event.inputs.mode == 'publish') }} | |
| environment: pypi | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Download Linux wheel artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: compas-popsynth-wheel-linux | |
| path: dist | |
| - name: Download macOS arm64 wheel artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: compas-popsynth-wheel-macos-arm64 | |
| path: dist | |
| - name: Download macOS x86_64 wheel artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: compas-popsynth-wheel-macos-x86_64 | |
| path: dist | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: dist/ | |
| verbose: true | |
| attestations: false |