forked from conornally/starbug2
-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (102 loc) · 4.17 KB
/
Copy pathpython-app.yml
File metadata and controls
122 lines (102 loc) · 4.17 KB
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
#This workflow will install Python dependencies, run tests and lint with
# multiple versions of Python
# For more information see:
# (https://help.github.com/actions/language-and-framework-guides/
# using-python-with-github-actions)
name: Python application
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
env:
STARBUG_TEST_DIR: ${{ github.workspace }}/tests/dat/
WEBBPSF_PATH: ${{ github.workspace }}/webbpsf_cache
STARBUG_DATDIR: ${{ github.workspace }}/starbug_data
strategy:
matrix:
# Run across multiple modern versions to ensure starbug2 handles
# updates smoothly
python-version: ["3.12", "3.13"]
steps:
# Upgraded to v4 for speed and security
- uses: actions/checkout@v4
# create directories for these dependency folders in envs
- name: Create DAta and Cache Directories
run: |
mkdir -p ${{ github.workspace }}/webbpsf_cache
mkdir -p ${{ github.workspace }}/starbug_data
# Upgraded to v5 and added automatic pip caching to speed up builds
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
# Standardised dependency installation using modern pyproject.toml
# configuration
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
# Install your core pipeline dependencies from the
# requirements.txt file
if [ -f requirements.txt ]; then \
pip install -r requirements.txt; fi
# Install starbug2 itself in editable mode
pip install -e .
- name: Cache FITS test data
id: cache-fits
uses: actions/cache@v4
with:
path: |
tests/dat/ngc6822_F770W_i2d.fits
tests/dat/image.fits
tests/dat/psf.fits
key: ${{ runner.os }}-fits-cache-v1
- name: Download FITS files from Private Draft Release if cache missed
if: steps.cache-fits.outputs.cache-hit != 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release download TEST_DATA --repo "${{ github.repository }}" --pattern "*.fits" --dir "tests/dat"
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined
# names
flake8 . --count --show-source --statistics --max-line-length=79
# exit-zero treats all errors as warnings. The GitHub editor is
# 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 \
--max-line-length=127 --statistics
# --- LIGHTWEIGHT RAT LICENSE HEADER CHECK ---
- name: Verify License Headers (RAT Check)
run: |
echo "Checking for license headers in starbug2 source files..."
missing_headers=0
# Find all .py files in your source directory, ignoring
# environment folders
for file in $(find starbug2 -name "*.py"); do
if ! grep -q "Copyright (C) 2026 UKATC" "$file"; then
echo "❌ Missing license header in: $file"
missing_headers=$((missing_headers + 1))
fi
done
if [ $missing_headers -gt 0 ]; then
echo "Error: $missing_headers file(s) are missing the" \
" mandatory copyright header block."
exit 1
else
echo "✅ All source files contain valid copyright headers."
fi
- name: Pre-test Filter PSF setup
run: |
echo "Starting pre test filter psf setup"
starbug2 --init -s FILTER=F444W
echo "Command completed successfully!"
- name: Test with pytest
run: |
python -m pytest