Skip to content

Commit

Permalink
add pypi
Browse files Browse the repository at this point in the history
  • Loading branch information
ahnaf-tahmid-chowdhury committed Oct 1, 2024
1 parent ac5648c commit db8265f
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docker-publish-manylinux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
- name: Configure docker image tag
run: |
image_base_tag=ghcr.io/${{ github.repository_owner }}/
image_base_tag+=openmc-ci-${{ matrix.manylinux_image }}
image_base_tag+=openmc-${{ matrix.manylinux_image }}
image_base_tag+=-${{ matrix.compiler}}
image_base_tag+=-${{ matrix.python }}
echo "image_base_tag=${image_base_tag}" >> "$GITHUB_ENV"
Expand Down Expand Up @@ -100,7 +100,7 @@ jobs:
if: ${{ github.repository_owner == 'openmc-dev' }}
run: |
image_base_tag=ghcr.io/${{ github.repository_owner }}/
image_base_tag+=openmc-ci-${{ matrix.manylinux_image }}
image_base_tag+=openmc-${{ matrix.manylinux_image }}
image_base_tag+=-${{ matrix.compiler}}
image_base_tag+=-${{ matrix.python }}
echo "image_base_tag=${image_base_tag}" >> "$GITHUB_ENV"
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Publish wheels to PyPI

on:
# allows running workflows manually
workflow_dispatch:

release:
types: [published]

jobs:
main:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
arch: manylinux_x86_64
- os: macos-13
arch: macosx_x86_64
- os: macos-14
arch: macosx_arm64

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: "cp*-${{ matrix.arch }}"
CIBW_ARCHS_LINUX: "x86_64"
CIBW_MANYLINUX_X86_64_IMAGE: ghcr.io/${{ github.repository_owner }}/openmc-manylinux_2_28_x86_64-gcc-cp312-cp312/openmc:latest
CIBW_ARCHS_MACOS: "native"
CIBW_BEFORE_BUILD_MACOS: |
brew install llvm cmake xtensor hdf5 python libomp libpng
CIBW_ENVIRONMENT_MACOS: >
MACOSX_DEPLOYMENT_TARGET=${{ matrix.os == 'macos-14' && '14.0' || '13.0' }}
DYLD_LIBRARY_PATH=/usr/local/opt/gcc/lib/gcc/current/:$DYLD_LIBRARY_PATH
CXX=$(brew --prefix llvm)/bin/clang++
HDF5_ROOT=$(brew --prefix hdf5)
CIBW_BUILD_FRONTEND: "build"
with:
package-dir: openmc
output-dir: wheelhouse
config-file: "{package}/pyproject.toml"

- name: Publish package to PyPI
if: success()
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
twine upload wheelhouse/*.whl

0 comments on commit db8265f

Please sign in to comment.