Skip to content

Commit

Permalink
Updated Github Actions (#67)
Browse files Browse the repository at this point in the history
* Some potential improvements to the workflow

* Specifying ARM arch for macos

* Upped setuptools version to protect against url injections
  • Loading branch information
okkevaneck authored Feb 10, 2025
1 parent 56b7f84 commit 2963e32
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 18 deletions.
25 changes: 8 additions & 17 deletions .github/workflows/build_deploy.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
name: CI-CD

on:
push:
inputs:
allowDeploy:
description: "Whether to deploy."
required: true
default: true
type: boolean
push: {}
pull_request:
types: [opened, edited, synchronize, reopened]
inputs:
allowDeploy:
description: "Whether to deploy."
required: true
default: true
type: boolean
workflow_dispatch:
inputs:
allowDeploy:
Expand All @@ -29,7 +17,8 @@ jobs:
name: Prepare Matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
# Default to a single Linux build.
matrix: ${{ steps.set-matrix.outputs.matrix || '{"os":["ubuntu-latest"],"cibw_build":"cp39-manylinux_x86_64"}' }}
steps:
- uses: actions/checkout@v4.2.2

Expand Down Expand Up @@ -94,7 +83,6 @@ jobs:
pytest -k 'not TestBeamSearch'; \
pytest -k '_no_bw or _bw_m1'
fi
shell: bash
build_wheels:
name: Build wheels
Expand All @@ -116,9 +104,11 @@ jobs:
CIBW_BUILD: ${{ matrix.cibw_build }}
CIBW_SKIP: ${{ matrix.cibw_skip }}
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9"
CIBW_ARCHS_MACOS: "x86_64 arm64"

- uses: actions/upload-artifact@v4
with:
name: my-artifact-${{ matrix.os }}
path: ./wheelhouse/*.whl

build_sdist:
Expand Down Expand Up @@ -147,7 +137,7 @@ jobs:
path: dist/*.tar.gz

deploy:
if: github.ref == 'refs/heads/master' && ${{ inputs.allowDeploy }} == 'true'
if: github.ref == 'refs/heads/master' && (github.event_name != 'workflow_dispatch' || inputs.allowDeploy == 'true')
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
steps:
Expand All @@ -157,8 +147,9 @@ jobs:

- uses: actions/download-artifact@v4
with:
name: artifact
path: dist
pattern: my-artifact-*
merge-multiple: true

- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pybind11==2.11.1
pytest==7.4.0
pytest-order==1.1.0
seaborn==0.12.2
setuptools==68.0.0
setuptools==75.8.0
sphinx==7.0.1
twine>=4.0.2
wheel==0.40.0

0 comments on commit 2963e32

Please sign in to comment.