-
Notifications
You must be signed in to change notification settings - Fork 8
162 lines (139 loc) · 6.5 KB
/
continuous_integration.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
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
pull_request:
merge_group:
# run the pipeline on the 0th minute of the 0th hour of day 1 and 15 every month
schedule:
- cron: '0 0 1,15 * *'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
ci:
# The type of runner that the job will run on
runs-on: ubuntu-22.04
# Specify the python versions to test
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
# Environment variables
env:
POETRY_HOME: /opt/poetry
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Print disk space
run: df -h
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: true
swap-storage: true
- name: Print disk space
run: df -h
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
# Runs a set of commands using the runners shell
- name: set up ssh
uses: webfactory/[email protected]
with:
ssh-private-key: |
${{ secrets.WIRC_STARTERPACK_TOKEN }}
- name: install packages with conda
shell: bash -el {0}
run: |
conda install -c conda-forge astromatic-source-extractor astromatic-scamp astromatic-swarp astromatic-psfex astrometry=0.95 gsl wcstools
swarp -v
scamp -v
sex -v
solve-field --version
pip install --upgrade pip
# Poetry install with poetry in an isolated environment
python3 -m venv $POETRY_HOME
$POETRY_HOME/bin/pip install poetry==2.0.0
$POETRY_HOME/bin/poetry --version
$POETRY_HOME/bin/poetry install --with dev
# Set up astrometry.net
- name: astrometry.net index files
run: |
curl -o /usr/share/miniconda/envs/test/data/index-5200-43.fits https://portal.nersc.gov/project/cosmo/temp/dstn/index-5200/LITE/index-5200-43.fits
curl -o /usr/share/miniconda/envs/test/data/index-5201-04.fits https://portal.nersc.gov/project/cosmo/temp/dstn/index-5200/LITE/index-5201-04.fits
curl -o /usr/share/miniconda/envs/test/data/index-5204-13.fits https://portal.nersc.gov/project/cosmo/temp/dstn/index-5200/LITE/index-5204-13.fits
curl -o /usr/share/miniconda/envs/test/data/index-5205-13.fits https://portal.nersc.gov/project/cosmo/temp/dstn/index-5200/LITE/index-5205-13.fits
# WINTER
curl -o /usr/share/miniconda/envs/test/data/index-5205-11.fits https://portal.nersc.gov/project/cosmo/temp/dstn/index-5200/LITE/index-5205-11.fits
curl -o /usr/share/miniconda/envs/test/data/index-5203-11.fits https://portal.nersc.gov/project/cosmo/temp/dstn/index-5200/LITE/index-5203-11.fits
curl -o /usr/share/miniconda/envs/test/data/index-5206-11.fits https://portal.nersc.gov/project/cosmo/temp/dstn/index-5200/LITE/index-5206-11.fits
curl -o /usr/share/miniconda/envs/test/data/index-5204-11.fits https://portal.nersc.gov/project/cosmo/temp/dstn/index-5200/LITE/index-5204-11.fits
# Set up database
- name: postgres
run: |
sudo apt-get update
sudo apt-get install postgresql
sudo apt-get install postgresql-common
sudo apt-get install postgresql-server-dev-14
sudo service postgresql restart
sudo -u postgres psql -c "CREATE USER runner WITH PASSWORD 'runner_password'; GRANT ALL PRIVILEGES ON DATABASE postgres TO runner; ALTER USER runner WITH SUPERUSER;"
git clone https://github.com/segasai/q3c.git
make -C q3c
sudo make -C q3c install
- name: Print disk space
run: df -h
# First make sure the doc tests are up to date
- name: Run doc tests
shell: bash -el {0}
run: |
$POETRY_HOME/bin/poetry run make -C docs/ doctest
# Runs a set of commands using the runners shell
- name: Test the code
shell: bash -el {0}
env:
OUTPUT_DATA_DIR : /home/runner/
PG_ADMIN_USER: runner
PG_ADMIN_PWD: runner_password
DB_USER: runner
DB_PWD: runner_password
WATCHDOG_EMAIL: ${{ secrets.WATCHDOG_EMAIL }}
WATCHDOG_EMAIL_PASSWORD: ${{ secrets.WATCHDOG_EMAIL_PASSWORD }}
WATCHDOG_EMAIL_RECIPIENTS: ${{ secrets.WATCHDOG_EMAIL_RECIPIENTS }}
KOWALSKI_TOKEN: ${{ secrets.KOWALSKI_TOKEN }}
FRITZ_TOKEN: ${{ secrets.FRITZ_TOKEN }}
ANET_INDEX_DIR: /usr/share/miniconda/envs/test/data
run: |
TESTDATA_CHECK="True" $POETRY_HOME/bin/poetry run coverage run -m unittest discover tests/
- name: Run Coveralls
continue-on-error: true
if: ${{ success() }}
shell: bash -el {0}
run: |
$POETRY_HOME/bin/poetry --no-ansi run coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Echo tag name
run: echo "Tag is ${{ github.ref }}, Tagged is ${{ startsWith(github.ref, 'refs/tags/')}}, Python Check is ${{matrix.python-version == 3.11}}, Deploy is ${{ startsWith(github.ref, 'refs/tags/') && matrix.python-version == 3.11}}"
# Build a tarball and push to Pypi if tagged with new version
- name: Build and publish
shell: bash -el {0}
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
# Only run if secrets.PYPI_API_TOKEN exists.
if: ${{ startsWith(github.ref, 'refs/tags/') && success() && matrix.python-version == 3.11 && env.POETRY_PYPI_TOKEN_PYPI != ''}}
run: |
$POETRY_HOME/bin/poetry publish -n --build