Skip to content

Bump pypa/gh-action-pypi-publish from 1.9.0 to 1.10.1 #243

Bump pypa/gh-action-pypi-publish from 1.9.0 to 1.10.1

Bump pypa/gh-action-pypi-publish from 1.9.0 to 1.10.1 #243

name: Test, build, publish docs and release
on:
push:
tags:
- v*
branches-ignore:
- "gh-pages"
env:
NO_CYTHON_COMPILE: "true"
jobs:
build-and-test:
name: Install, test, build package and build docs
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10"]
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install
run: |
python -m pip install --no-cache-dir -e .[dev]
- name: Build package
run: python -m build
- name: Test import
run: python -m compas_mrr
- name: Test
run: pytest
ironpython-test:
name: windows-ironpython
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Set up CPython 3.8 (RPC tests)
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Install dependencies & package for CPython (RPC tests)
run: |
pip install --no-cache-dir .
- name: Install dependencies
run: |
choco install ironpython --version=2.7.8.1
ipy -X:Frames -m ensurepip
curl -o compas.tar.gz -LJO https://files.pythonhosted.org/packages/db/cb/c58593cef8657a7f6f4007afe44bc0f93c99ab8c6242c51062c70e4618d9/COMPAS-1.17.10.tar.gz
ipy -X:Frames -m pip install --no-deps compas.tar.gz
curl -o ironpython-pytest.tar.gz -LJO https://pypi.debian.net/ironpython-pytest/latest
ipy -X:Frames -m pip install --no-deps ironpython-pytest.tar.gz
- name: Test import
run: |
ipy -m compas_mrr
env:
IRONPYTHONPATH: ./src
- name: Run tests
run: |
ipy tests/ipy_test_runner.py
env:
IRONPYTHONPATH: ./src
publish-docs:
name: Publish docs
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Checkout repo
uses: actions/checkout@v4
- name: Install
run: |
pip install --no-cache-dir -e .[dev]
- name: Build docs
run: |
sphinx-build -b doctest docs build/docs
sphinx-apidoc \
--separate \
--module-first \
--no-toc \
--force \
--no-headings \
-o docs/reference src/compas_mrr
sphinx-build -b html docs dist/docs
# sphinx-build -b linkcheck docs dist/docs
- name: Publish docs on branch gh-pages
uses: crazy-max/ghaction-github-pages@c05ee637ec73429400a359430db8e5629f3f2564
with:
target_branch: gh-pages
build_dir: dist/docs
jekyll: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-package:
name: Publish package
needs: build-and-test
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Get version from tag
id: tag_name
run: |
echo ::set-output name=current_version::${GITHUB_REF#refs/tags/v}
- name: Checkout repo
uses: actions/checkout@v4
- name: Get Changelog Entry
id: changelog_reader
uses: mindsers/changelog-reader-action@v2
with:
version: ${{ steps.tag_name.outputs.current_version }}
path: ./CHANGELOG.md
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install
run: python -m pip install --no-cache-dir -e .[dev]
- name: Build package
run: python -m build .
- name: Upload and release package on PyPi
uses: pypa/gh-action-pypi-publish@v1.10.1
if: steps.changelog_reader.outputs.status == 'released'
with:
user: __token__
password: ${{ secrets.pypi_password }}
- name: Create GitHub release and upload assets
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
dist/*.whl
dist/*.tar.gz
body: ${{ steps.changelog_reader.outputs.changes }}
prerelease: ${{ steps.changelog_reader.outputs.status == 'prereleased' }}
draft: ${{ steps.changelog_reader.outputs.status == 'unreleased' }}