Merge pull request #15 from lsst/tickets/DM-48515 #115
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_and_test | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "*" | |
pull_request: | |
jobs: | |
build_and_test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
# Need to clone everything for the git tag tests. | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: "pip" | |
cache-dependency-path: "setup.cfg" | |
- name: Install build tooling | |
run: | | |
python -m pip install --upgrade pip | |
pip install --upgrade setuptools wheel | |
- name: Build and install | |
run: | | |
python -m pip install -v -e ".[dev]" | |
- name: List installed packages | |
shell: bash -l {0} | |
run: | | |
pip list -v | |
- name: Run tests | |
run: | | |
pytest -r a -v --cov=tests --cov=lsst_versions --cov-report=xml --cov-report=term | |
- name: Upload coverage to codecov | |
uses: codecov/codecov-action@v2 | |
with: | |
file: ./coverage.xml | |
pypi: | |
runs-on: ubuntu-latest | |
needs: [build_and_test] | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
# Need to clone everything to embed the version. | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.12" | |
cache: "pip" | |
cache-dependency-path: "setup.cfg" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install --upgrade setuptools wheel | |
- name: Build and create distribution | |
run: | | |
pip install -v -e . | |
python setup.py sdist bdist_wheel | |
- name: Upload | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_UPLOADS }} |