Update .readthedocs.yaml #24
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
name: Build, test and publish to (test)PyPI | |
on: [push, pull_request, release] | |
jobs: | |
build: | |
name: Build distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@main | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@main | |
with: | |
python-version: "3.x" | |
- name: Install pypa/build | |
run: >- | |
python3 -m | |
pip install | |
build | |
--user | |
- name: Build a binary wheel and a source tarball | |
run: python3 -m build | |
- name: Test | |
run: | | |
python3 -m pip install hypothesis | |
python3 -m pip install dist/elastic*.whl | |
elastic --version | |
python3 -m unittest discover -s test -b | |
elastic -v --cij proc tests/data/calc-cij_*/vasprun.xml | |
elastic -v --eos proc tests/data/calc-eos_*/vasprun.xml | |
- name: Store the distribution packages | |
uses: actions/upload-artifact@main | |
with: | |
name: python-package-distributions | |
path: dist/ | |
publish-to-testpypi: | |
name: Publish to TestPyPI | |
if: ${{ github.event_name == 'push' }} | |
needs: | |
- build | |
runs-on: ubuntu-latest | |
environment: | |
name: testpypi | |
url: https://test.pypi.org/p/elastic | |
permissions: | |
id-token: write # IMPORTANT: mandatory for trusted publishing | |
steps: | |
- name: Download all the dists | |
uses: actions/download-artifact@main | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Publish distribution to TestPyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
publish-to-pypi: | |
name: Publish to PyPI | |
# if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes | |
# only publish on push from master | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} | |
needs: | |
- build | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/elastic | |
permissions: | |
id-token: write # IMPORTANT: mandatory for trusted publishing | |
steps: | |
- name: Download all the dists | |
uses: actions/download-artifact@main | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |