Skip to content

Commit

Permalink
FIXME: testing GA
Browse files Browse the repository at this point in the history
  • Loading branch information
javiber committed Mar 22, 2024
1 parent 006a0e1 commit 5a8dbdf
Showing 1 changed file with 46 additions and 99 deletions.
145 changes: 46 additions & 99 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: publish

on:
release:
types: [published] # Runs both for releases and prereleases
# FIXME
on: [push]
# release:
# types: [published] # Runs both for releases and prereleases

jobs:
test:
Expand Down Expand Up @@ -34,10 +35,18 @@ jobs:
# macos-XXX-large are Intel runners, macos-XXX-xlarge are arm64 runners
# https://docs.github.com/en/actions/using-github-hosted-runners/about-larger-runners/about-larger-runners
build-macos-intel:
runs-on: macos-13-large
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
platform:
[
{ runner: macos-12-large, artifact: macos12-intel },
{ runner: macos-13-large, artifact: macos13-intel },
{ runner: macos-14-large, artifact: macos14-intel },
{ runner: macos-13-xlarge, artifact: macos-13-arm },
{ runner: macos-14-xlarge, artifact: macos-14-arm },
]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -56,41 +65,7 @@ jobs:
- name: Save package for following jobs
uses: actions/upload-artifact@v3
with:
name: dist-macos-intel-${{ matrix.python-version }}
path: dist

build-macos-arm:
runs-on: macos-13-xlarge
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: Checkout
uses: actions/checkout@v4

# actions/setup-python doesn't support py < 3.10 on macos arm
# https://github.com/actions/setup-python/issues/696#issuecomment-1637587760

- name: Install Python
run: |
brew update
brew install python@${{ matrix.python-version }}
- name: Install pip
run: |
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python${{ matrix.python-version }} get-pip.py
- name: Install poetry
run: pip install poetry

- name: Build package
run: poetry build

- name: Save package for following jobs
uses: actions/upload-artifact@v3
with:
name: dist-macos-arm-${{ matrix.python-version }}
name: dist-${{ matrix.platform.artifact }}-intel-${{ matrix.python-version }}
path: dist

test-install:
Expand All @@ -101,7 +76,11 @@ jobs:
platform:
[
{ runner: ubuntu-latest, artifact: ubuntu },
{ runner: macos-13-large, artifact: macos-intel },
{ runner: macos-12-large, artifact: macos12-intel },
{ runner: macos-13-large, artifact: macos13-intel },
{ runner: macos-14-large, artifact: macos14-intel },
{ runner: macos-13-xlarge, artifact: macos-13-arm },
{ runner: macos-14-xlarge, artifact: macos-14-arm },
]
runs-on: ${{ matrix.platform.runner }}
env:
Expand Down Expand Up @@ -129,62 +108,30 @@ jobs:
- name: Test installation
run: python tools/check_install.py

test-macos-arm-install:
needs: [build-macos-arm]
runs-on: macos-13-xlarge
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Python
run: |
brew update
brew install python@${{ matrix.python-version }}
- name: Install pip
run: |
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python${{ matrix.python-version }} get-pip.py
- name: Download build
uses: actions/download-artifact@v3
with:
name: dist-macos-arm-${{ matrix.python-version }}
path: dist

- name: Install from wheel
run: pip install dist/*.whl

- name: Test installation
run: python${{ matrix.python-version }} tools/check_install.py

publish:
needs: [test, test-install, test-macos-arm-install]
runs-on: ubuntu-latest
environment: pypi
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install poetry
run: pip install poetry

- name: Download builds for all Python versions and platforms
uses: actions/download-artifact@v3
with:
# Skipping `name` key to download all artifacts from this workflow
# Artifacts are downloaded to dist/<artifact-name>
path: dist

- name: Move wheels and sources to dist/
run: |
mv dist/*/*.whl dist/
mv -n dist/*/*.tar.gz dist/
- name: Publish to PyPI
run: poetry publish --no-interaction --skip-existing
# publish:
# needs: [test, test-install, test-macos-arm-install]
# runs-on: ubuntu-latest
# environment: pypi
# env:
# POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
# steps:
# - name: Checkout
# uses: actions/checkout@v3

# - name: Install poetry
# run: pip install poetry

# - name: Download builds for all Python versions and platforms
# uses: actions/download-artifact@v3
# with:
# # Skipping `name` key to download all artifacts from this workflow
# # Artifacts are downloaded to dist/<artifact-name>
# path: dist

# - name: Move wheels and sources to dist/
# run: |
# mv dist/*/*.whl dist/
# mv -n dist/*/*.tar.gz dist/

# - name: Publish to PyPI
# run: poetry publish --no-interaction --skip-existing

0 comments on commit 5a8dbdf

Please sign in to comment.