-
Notifications
You must be signed in to change notification settings - Fork 7
189 lines (165 loc) · 5.28 KB
/
ci.yml
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
name: Continuous Integration
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
schedule:
# run this every week at 12 noon on Monday
- cron: '0 12 * * 1'
env:
EXAMPLE_DATA_FILE_VERSION: v5
# Setting this did not appear to work. Instead will need to
# find/replace when changing it.
# CONTAINER_IMAGE: ghcr.io/lsstdesc/txpipe:latest
jobs:
# Run a download step first so that it is in
# the cache, because all the other jobs will be running
# at the same time and so might miss it.
Download_Data:
runs-on: ubuntu-latest
steps:
- name: Cache example data
id: cache-example
uses: actions/cache@v4
env:
cache-name: cache-example-data
with:
path: example.tar.gz
# update this when we change package contents and want
# to force an update
key: example-data-${{ env.EXAMPLE_DATA_FILE_VERSION }}
- name: Download test data
if: steps.cache-example.outputs.cache-hit != 'true'
run: |
wget -O example.tar.gz "https://portal.nersc.gov/cfs/lsst/txpipe/data/example.tar.gz"
Run_Installer:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-14]
include:
- os: ubuntu-latest
INSTALL_DEPS: sudo apt-get update && sudo apt-get -y install wget
- os: macos-14
INSTALL_DEPS: echo nothing to do
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: Install wget
run: |
${{ matrix.INSTALL_DEPS }}
- name: Cache conda environment
id: cache-conda
uses: actions/cache@v4
env:
cache-name: cache-conda-environment
with:
path: ./conda
key: ${{ matrix.os }}-conda-${{ hashFiles('bin/install.sh','environment*.yml' ) }}
fail-on-cache-miss: false
- name: Run installer
if: steps.cache-conda.outputs.cache-hit != 'true'
run: |
./bin/install.sh
Unit_Tests:
runs-on: ${{ matrix.os }}
needs: Run_Installer
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-14]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: Restore conda environment
id: restore-conda
uses: actions/cache@v4
env:
cache-name: cache-conda-environment
with:
path: ./conda
key: ${{ matrix.os }}-conda-${{ hashFiles('bin/install.sh','environment*.yml' ) }}
fail-on-cache-miss: true
- name: Test with pytest
run: |
source conda/bin/activate
ceci --version
pytest txpipe
Pipelines:
runs-on: ${{ matrix.os }}
needs: [Run_Installer, Download_Data]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-14]
pipeline: [metadetect, metacal, redmagic, lensfit, metadetect_source_only, mock_shear]
include:
- os: ubuntu-latest
INSTALL_DEPS: echo nothing to do
- os: macos-14
INSTALL_DEPS: brew update-reset && brew install --cask basictex && eval "$(/usr/libexec/path_helper)" && pdflatex --version
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: Install dependencies
run: |
${{ matrix.INSTALL_DEPS }}
- name: Restore conda environment
id: restore-conda
uses: actions/cache@v4
env:
cache-name: cache-conda-environment
with:
path: ./conda
key: ${{ matrix.os }}-conda-${{ hashFiles('bin/install.sh','environment*.yml' ) }}
fail-on-cache-miss: true
- name: Restore example data
uses: actions/cache@v4
with:
path: example.tar.gz
key: example-data-${{ env.EXAMPLE_DATA_FILE_VERSION }}
fail-on-cache-miss: true
- name: Extract test data
run: |
tar -zxvf example.tar.gz
- name: Run pipeline
run: |
mkdir -p cache/workspaces
source ./conda/bin/activate
# Just for the metadetect source pipeline
# we activate the debug mode with an env var
if [ "${{ matrix.pipeline }}" == "metadetect_source_only" ]; then
export TX_DASK_DEBUG=1
fi
ceci examples/${{ matrix.pipeline }}/pipeline.yml
if [ "${{ matrix.pipeline }}" == "mock_shear" ]; then
test -f data/example/outputs_mock_shear/binned_shear_catalog.hdf5
else
test -f data/example/outputs_${{ matrix.pipeline }}/shear_xi_plus.png
fi
- name: Show logs
if: always()
run: |
# always run
cat data/example/logs_${{ matrix.pipeline }}/*
- name: Create output report
if: matrix.os == 'macos-14'
run: |
source ./conda/bin/activate
eval "$(/usr/libexec/path_helper)"
python bin/make_output_report.py data/example/outputs_${{ matrix.pipeline }} ${{ matrix.pipeline }}-report.md
pandoc ${{ matrix.pipeline }}-report.md -o ${{ matrix.pipeline }}-report.pdf
- name: Upload output report
if: matrix.os == 'macos-14'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.pipeline }}-report
path: ${{ matrix.pipeline }}-report.pdf