Skip to content

Merge pull request #64 from lsst/tickets/DM-36927 #331

Merge pull request #64 from lsst/tickets/DM-36927

Merge pull request #64 from lsst/tickets/DM-36927 #331

Workflow file for this run

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"]
steps:
- uses: actions/checkout@v3
with:
# Need to clone everything to determine version from git.
fetch-depth: 0
cache: "pip"
cache-dependency-path: "setup.cfg"
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install packages
run: sudo apt-get install graphviz
# We have two cores so we can speed up the testing with xdist
- name: Install xdist and openfiles
run: pip install pytest-xdist pytest-openfiles pytest-flake8 pytest-cov "flake8<5"
- name: Install dependencies
run: pip install -r requirements.txt
- name: Build and install
run: pip install -v .
- name: Run tests
run: pytest -r a -v -n 3 --open-files --cov=astro_metadata_translator --cov=tests --cov-report=xml --cov-report=term --cov-branch
- name: Upload coverage to codecov
uses: codecov/codecov-action@v2
with:
file: ./coverage.xml
- name: Install documenteer
run: pip install -r doc/requirements.txt
- name: Build documentation
run: package-docs build
- name: Landing page upload
if: ${{ github.event_name == 'push' && matrix.python-version == '3.10' }}
env:
LTD_PASSWORD: ${{ secrets.LTD_PASSWORD }}
LTD_USERNAME: ${{ secrets.LTD_USERNAME }}
run: |
ltd upload --gh --product "astro-metadata-translator" --dir doc/_build/html
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@v3
with:
python-version: 3.8
cache: "pip"
cache-dependency-path: "setup.cfg"
- name: Install dependencies
run: |
python -m pip install --upgrade "pip<22"
pip install --upgrade setuptools wheel build
- name: Build and create distribution
run: |
python -m build --sdist --wheel
- name: Upload
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_UPLOADS }}