PLAMS 2024.104 #17
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
name: Publish to PyPI | |
on: | |
release: | |
types: [published] | |
jobs: | |
build-package: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install setuptools wheel twine | |
- name: Build package | |
run: python setup.py sdist bdist_wheel | |
- name: Upload package artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: package | |
path: dist | |
test-package: | |
needs: build-package | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, macos-latest, windows-latest ] | |
python-version: [ "3.8", "3.9", "3.10", "3.11" ] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set Up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Download package artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: package | |
path: dist | |
- name: Install package and dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install dist/plams-*.whl | |
pip install ".[chem_tools,results]" | |
pip install pytest | |
- name: Run Unit Tests | |
run: | | |
pytest unit_tests | |
publish-package: | |
runs-on: ubuntu-latest | |
needs: test-package | |
environment: release | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Download package artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: package | |
path: dist | |
- name: Publish package to Test PyPI | |
if: ${{ vars.PUBLISH_TO_TEST_PYPI == 'true' }} | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
- name: Publish package to PyPI | |
if: ${{ vars.PUBLISH_TO_PYPI == 'true' }} | |
uses: pypa/gh-action-pypi-publish@release/v1 |