whole-mapel-pub #56
Workflow file for this run
This file contains 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
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
name: whole-mapel-pub | |
on: | |
push: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]*' | |
env: | |
WHL_HOUSE: wheelhouse | |
MAPEL_EL_ARTS: mapel-election-artifacts | |
MAPEL_REST_ARTS: mapel-rest-artifacts | |
permissions: | |
contents: read | |
jobs: | |
build-python-wheels-and-sdists: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
- name: make sdists | |
run: | | |
mkdir -p $WHL_HOUSE | |
python -m pip install build | |
python -m build --sdist --outdir $WHL_HOUSE ./mapel-all/ | |
python -m build --sdist --outdir $WHL_HOUSE ./mapel-core/ | |
python -m build --sdist --outdir $WHL_HOUSE ./mapel-elections/ | |
python -m build --sdist --outdir $WHL_HOUSE ./mapel-roommates/ | |
python -m build --sdist --outdir $WHL_HOUSE ./mapel-marriages/ | |
ls ./$WHL_HOUSE # Listing the contents of ./$WHL_HOUSE for a sanity check | |
- name: Build pure-Python wheels | |
run: | | |
pip wheel ./mapel-all --no-deps -w $WHL_HOUSE | |
pip wheel ./mapel-core --no-deps -w $WHL_HOUSE | |
pip wheel ./mapel-roommates --no-deps -w $WHL_HOUSE | |
pip wheel ./mapel-marriages --no-deps -w $WHL_HOUSE | |
ls ./$WHL_HOUSE # Listing the contents of ./$WHL_HOUSE for a sanity check | |
- name: Artifactize pure-python wheels and sdists | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.MAPEL_REST_ARTS }} | |
path: ${{ env.WHL_HOUSE }} | |
build-compiled-python-wheels: | |
# The manylinyux action (the following one) runs everything as root. So it | |
# is not predicatble how this interacts with other actions (e.g., it might | |
# create a directory accessible only for root so that subsequent actions | |
# cannot use it). | |
# Hence, it is very convenient to thave this action in a separate job | |
# and publish the outcome as artifacts. | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build mapel-elections wheels | |
uses: pypa/cibuildwheel@v2.16.5 | |
# env: | |
# CIBW_SOME_OPTION: value | |
# ... | |
with: | |
package-dir: 'mapel-elections' | |
output-dir: '${{ env.WHL_HOUSE }}' | |
- name: Artifactize compiled-python wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.MAPEL_EL_ARTS }} | |
path: ${{ env.WHL_HOUSE }} | |
publish: | |
needs: [build-compiled-python-wheels, build-python-wheels-and-sdists] | |
name: Publishing to PyPI | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
path: ${{ env.WHL_HOUSE }} | |
- name: Display structure of downloaded files | |
run: ls -R | |
working-directory: ${{ env.WHL_HOUSE }} | |
- name: Prepare the distrib directory | |
run: | | |
mv $MAPEL_EL_ARTS/* . | |
mv $MAPEL_REST_ARTS/* . | |
rm -r $MAPEL_EL_ARTS | |
rm -r $MAPEL_REST_ARTS | |
working-directory: ${{ env.WHL_HOUSE }} | |
- name: Display all artifacts | |
run: ls -R | |
working-directory: ${{ env.WHL_HOUSE }} | |
- name: Publish distribution 📦 to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
packages_dir: ${{ env.WHL_HOUSE }}/ | |
verbose: true |