OPSIM-1111: feature - Add altitude and azimuth limits to Conditions, along with new basis function + shadow mask #59
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: Run Tests and Publish PyPI | |
on: | |
# Trigger the workflow on push (to main) or pull request | |
push: | |
tags: | |
- "*" | |
branches: | |
- "main" | |
pull_request: | |
branches: | |
- "main" | |
workflow_dispatch: | |
jobs: | |
tests: | |
name: Run Unit Tests (${{ matrix.python-version }}, ${{ matrix.os }}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ["ubuntu-latest", "macos-latest"] | |
python-version: ["3.11"] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
python-version: ${{ matrix.python-version }} | |
miniforge-variant: Mambaforge | |
channels: conda-forge,defaults | |
use-mamba: true | |
channel-priority: strict | |
show-channel-urls: true | |
- name: configure conda and install requirements | |
shell: bash -l {0} | |
run: | | |
mamba install --quiet --file=requirements.txt | |
mamba install --quiet --file=test-requirements.txt | |
- name: install rubin_scheduler | |
shell: bash -l {0} | |
run: | | |
echo `pwd` | |
ls ${{ github.workspace }} | |
python -m pip install . --no-deps | |
- name: Access rubin-sim-data cache | |
id: cache-rs | |
uses: actions/cache@v3 | |
env: | |
cache-name: cached-rubin-sim-data | |
with: | |
path: ~/rubin_sim_data | |
key: ${{ env.cache-name }} | |
restore-keys: | | |
${{ env.cache-name }} | |
- name: Update rubin-sim-data if needed | |
shell: bash -l {0} | |
run: | | |
export RUBIN_SIM_DATA_DIR=~/rubin_sim_data | |
# Download anything that is not current | |
scheduler_download_data --tdqm_disable --update | |
- name: conda list | |
shell: bash -l {0} | |
run: conda list | |
- name: run tests | |
shell: bash -l {0} | |
run: | | |
export RUBIN_SIM_DATA_DIR=~/rubin_sim_data | |
#pytest -r a -v | |
pytest -r a -v --cov=rubin_scheduler --cov-report=xml --cov-report=term --cov-branch | |
- name: Upload coverage to codecov | |
uses: codecov/codecov-action@v2 | |
with: | |
file: coverage.xml | |
pypi: | |
name: Build and Publish to PyPI | |
runs-on: ubuntu-latest | |
needs: [tests] | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- uses: actions/checkout@v4 | |
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.11 | |
cache: "pip" | |
- name: Install dependencies for build | |
run: | | |
python -m pip install --upgrade pip | |
pip install --upgrade setuptools build | |
- name: Build and create distribution | |
run: | | |
python -m build --skip-dependency-check | |
- name: Upload to lsst-sp PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.SP_PYPI_UPLOADS }} |