Skip to content

Commit

Permalink
trying new deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
o-murphy committed Aug 15, 2024
1 parent 851f9ae commit b577c17
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 74 deletions.
114 changes: 114 additions & 0 deletions .github/workflows/python-publish-test-new.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Upload Python Package to Test PyPI

on:
workflow_dispatch:

permissions:
contents: read

jobs:

test-build-deploy:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
python-version: [ "3.9", "3.10", "3.11", "3.12" ]

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install build-essential -y
python -m pip install --upgrade pip
python -m pip install cython twine
python -m pip install -e .[dev]
- name: Run tests in pure python mode
run: |
if pytest tests --no-header --no-summary -v; then
echo "Pytest succeeded."
else
echo "Pytest failed, running without capture"
# Add your additional commands here
pytest tests --no-header --no-summary -v -s
fi
- name: Build cython modules
run: |
cd py_ballisticcalc_exts
python setup.py build_ext --inplace
cd ..
- name: Run tests in binary mode
run: |
if pytest tests --no-header --no-summary -v; then
echo "Pytest succeeded."
else
echo "Pytest failed, running without capture"
# Add your additional commands here
pytest tests --no-header --no-summary -v -s
fi
- name: Build pure python package
run: python -m build

# - name: Build binary python package
# run: |
# cd py_ballisticcalc_exts
# python -m build --outdir ../dist
# cd ..
# ls dist

- name: Publish package to Test PyPI
run: |
python -m twine upload --repository-url https://test.pypi.org/legacy/ dist/* --skip-existing --verbose --non-interactive
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}

deploy-exts:
needs: test-build-deploy
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e .[dev]
python -m pip install twine
- name: Build extensions package
run: |
cd py_ballisticcalc_exts
python -m build --outdir ../dist
cd ..
ls
- name: Publish package to Test PyPI
run: |
python -m twine upload --repository-url https://test.pypi.org/legacy/ dist/* --skip-existing --verbose --non-interactive
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
81 changes: 8 additions & 73 deletions .github/workflows/python-publish-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,101 +14,36 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
python-version: [ "3.9", "3.10", "3.11", "3.12" ]

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
python-version: "3.12"

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install build-essential -y
python -m pip install --upgrade pip
python -m pip install cython twine
python -m pip install -e .[dev]
python -m pip install build cibuildwheel twine
- name: Run tests in pure python mode
run: |
if pytest tests --no-header --no-summary -v; then
echo "Pytest succeeded."
else
echo "Pytest failed, running without capture"
# Add your additional commands here
pytest tests --no-header --no-summary -v -s
fi
- name: Build pure python package
run: python -m build

- name: Build cython modules
- name: Build binary python package
run: |
cd py_ballisticcalc_exts
python setup.py build_ext --inplace
cibuildwheel --output-dir ../dist
cd ..
- name: Run tests in binary mode
run: |
if pytest tests --no-header --no-summary -v; then
echo "Pytest succeeded."
else
echo "Pytest failed, running without capture"
# Add your additional commands here
pytest tests --no-header --no-summary -v -s
fi
- name: Build pure python package
run: python -m build

# - name: Build binary python package
# run: |
# cd py_ballisticcalc_exts
# python -m build --outdir ../dist
# cd ..
# ls dist
ls dist
- name: Publish package to Test PyPI
run: |
python -m twine upload --repository-url https://test.pypi.org/legacy/ dist/* --skip-existing --verbose --non-interactive
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}

deploy-exts:
needs: test-build-deploy
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e .[dev]
python -m pip install twine
- name: Build extensions package
run: |
cd py_ballisticcalc_exts
python -m build --outdir ../dist
cd ..
ls
- name: Publish package to Test PyPI
run: |
python -m twine upload --repository-url https://test.pypi.org/legacy/ dist/* --skip-existing --verbose --non-interactive
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
5 changes: 4 additions & 1 deletion py_ballisticcalc_exts/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,7 @@ where = ["."]
include = ["py_ballisticcalc_exts*"]

[project.optional-dependencies]
dev = ['cython', 'build', 'setuptools']
dev = ['cython', 'build', 'setuptools', 'cibuildwheel']

[tool.cibuildwheel]
before-all = "uname -a"

0 comments on commit b577c17

Please sign in to comment.