Merge pull request #47 from LSSTDESC/fixpip #5
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: Build, Test, and Publish | |
on: | |
push: | |
tags: | |
- "[0-9]+.[0-9]+.[0-9]+" | |
jobs: | |
build_and_test: | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
# Need to clone everything to determine version from git. | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
cache: "pip" | |
cache-dependency-path: "setup.cfg" | |
- name: Build and install | |
run: | | |
python -m pip install --upgrade pip setuptools | |
python -m pip install pytest | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
python -m pip install . | |
- name: Run tests | |
run: | | |
cd tests | |
pytest | |
pypi_build: | |
runs-on: ubuntu-latest | |
needs: [build_and_test] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
cache: "pip" | |
cache-dependency-path: "setup.cfg" | |
- name: Install dependencies | |
run: | | |
pip install --upgrade setuptools wheel build | |
- name: Build and create distribution | |
run: | | |
python -m build | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: dist/* | |
pypi_upload: | |
needs: [pypi_build] | |
runs-on: ubuntu-latest | |
environment: Publish | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: artifact | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |