change when publish docs #131
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 will upload a Python Package using Twine when a release is created | |
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | |
# 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: segysak actions | |
on: | |
push: | |
branches: [main] | |
tags-ignore: | |
- v* | |
pull_request: | |
branches: [main] | |
release: | |
types: [released] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-test: | |
name: Build and test segysak | |
strategy: | |
max-parallel: 1 | |
fail-fast: true | |
matrix: | |
os: ["windows-latest", "ubuntu-latest", "macos-latest"] | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
exclude: | |
- os: macos-latest | |
python-version: "3.9" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# required for `git describe --tags` to work | |
fetch-depth: 100 | |
# The GitHub token is preserved by default but this job doesn't need | |
# to be able to push to GitHub. | |
persist-credentials: false | |
# get zgy submodule | |
submodules: true | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
#cache: 'pip' | |
- name: Install package and deps | |
run: | | |
python -m pip install --upgrade pip | |
pip install .[test] | |
- name: Run tests | |
run: | | |
pytest -v | |
- name: Build wheels | |
run: pip wheel . -w dist --no-deps | |
- name: Upload wheel as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.os }} Python ${{ matrix.python-version }} wheel | |
path: dist/* | |
publish-test: | |
if: needs.build-test.result == 'success' && github.event_name == 'release' | |
name: Publish to test.PyPI | |
runs-on: ubuntu-latest | |
environment: | |
name: testpypi | |
url: https://test.pypi.org/p/segysak | |
permissions: | |
id-token: write | |
needs: [build-test] | |
steps: | |
- name: Get wheels | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- name: Move to dist/ | |
run: | | |
mkdir dist | |
find artifacts -name "*.whl" -exec mv '{}' dist/ \; | |
- name: Publish package to test.PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository_url: https://test.pypi.org/legacy/ | |
publish: | |
if: needs.build-test.result == 'success' && github.event_name == 'release' | |
name: Publish to PyPI | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/segysak | |
permissions: | |
id-token: write | |
needs: [build-test] | |
steps: | |
- name: Get wheels | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- name: Move to dist/ | |
run: | | |
mkdir dist | |
find artifacts -name "*.whl" -exec mv '{}' dist/ \; | |
- name: Publish package to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |