-
Notifications
You must be signed in to change notification settings - Fork 1
129 lines (113 loc) · 3.74 KB
/
test_and_build.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Run CI
on:
# Run job at the end of each day
schedule:
- cron: "0 0 * * *"
# Run job on push to main
push:
branches:
- main
# Run job on pull request to main
pull_request:
branches:
- main
# Run job manually on request
workflow_dispatch:
jobs:
tests:
name: Run 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@v3
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
auto-update-conda: true
channels: conda-forge,defaults
miniforge-variant: Mambaforge
use-mamba: true
channel-priority: strict
show-channel-urls: true
- name: configure conda and install requirements
id: rs-install
shell: bash -l {0}
run: |
mamba install --quiet --file=requirements.txt
mamba install --quiet --file=test-requirements.txt
mamba list rubin-sim | grep -v "#" | awk '{print $2}' > ${{ github.workspace }}/rs_version
echo "rs-version" `cat ${{ github.workspace }}/rs_version`
echo "rs-version=`cat ${{ github.workspace }}/rs_version`" >> $GITHUB_OUTPUT
- 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 }}-v${{ steps.rs-install.outputs.rs-version }}
restore-keys: |
${{ env.cache-name }}-v
- if: ${{ steps.cache-rs.outputs.cache-hit == 'true' }}
name: List cache contents.
shell: bash -l {0}
run: |
export RUBIN_SIM_DATA_DIR=~/rubin_sim_data
echo $RUBIN_SIM_DATA_DIR
ls $RUBIN_SIM_DATA_DIR
echo "__contents of versions.txt__"
cat $RUBIN_SIM_DATA_DIR/versions.txt
- if: ${{ steps.cache-rs.outputs.cache-hit != 'true' }}
name: Download data.
shell: bash -l {0}
run: |
export RUBIN_SIM_DATA_DIR=~/rubin_sim_data
rs_download_data --force --dirs scheduler,site_models,skybrightness_pre,throughputs,tests --tdqm_disable
- name: install schedview
shell: bash -l {0}
run: |
echo `pwd`
python -m pip install . --no-deps
- name: conda list
shell: bash -l {0}
run: conda list
- name: run unit tests
shell: bash -l {0}
run: |
export RUBIN_SIM_DATA_DIR=~/rubin_sim_data
pytest -r a -v --cov=schedview --cov=tests --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 upload 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
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 }}