File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Makefile CI
2+
3+ on :
4+ push :
5+ pull_request :
6+ branches : [ "main" ]
7+
8+ jobs :
9+ build :
10+ runs-on : macos-latest
11+ steps :
12+ - uses : actions/checkout@v4
13+
14+ - name : Install dependencies
15+ run : make build
16+
17+ - name : Upload artifacts
18+ uses : actions/upload-artifact@v4
19+ with :
20+ name : build-artifacts
21+ path : ${{ github.workspace }}/.venv/
22+ if-no-files-found : error
23+ include-hidden-files : true
24+
25+ test-mac :
26+ runs-on : macos-latest
27+ needs : build
28+ steps :
29+ - uses : actions/checkout@v4
30+
31+ - name : Download artifacts
32+ uses : actions/download-artifact@v4
33+ with :
34+ name : build-artifacts
35+ path : ${{ github.workspace }}/.venv/
36+
37+ - name : Restore executable permissions to .venv
38+ run : chmod -R u+x .venv/bin
39+
40+ - name : Bundle Mac App
41+ run : make macapp
42+
43+ - name : Verify Mac App
44+ run : ./dist/ekosuite.app/Contents/MacOS/ekosuite --validate-build
45+
46+ test :
47+ runs-on : macos-latest
48+ needs : build
49+ steps :
50+ - uses : actions/checkout@v4
51+
52+ - name : Download artifacts
53+ uses : actions/download-artifact@v4
54+ with :
55+ name : build-artifacts
56+ path : ${{ github.workspace }}/.venv/
57+
58+ - name : Restore executable permissions to .venv
59+ run : chmod -R u+x .venv/bin
60+
61+ - name : Run Tests
62+ run : make test
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ SHELL := /bin/bash
44# Define variables
55VENV_DIR = .venv
66PYTHON = $(VENV_DIR ) /bin/python3
7+ PYTEST = $(VENV_DIR ) /bin/pytest
78PIP = $(VENV_DIR ) /bin/pip3
89
910# Targets
@@ -30,7 +31,7 @@ macapp:
3031 $(PYTHON ) " $( VENV_DIR) /bin/PyInstaller" ekosuite.spec
3132
3233test :
33- pytest tests/
34+ $( PYTEST ) tests/
3435
3536run :
3637 $(PYTHON ) ekosuite.py
Original file line number Diff line number Diff line change @@ -17,4 +17,8 @@ async def main():
1717 sys .exit ()
1818
1919if __name__ == "__main__" :
20+ args = sys .argv [1 :]
21+ if args :
22+ if '--validate-build' in args :
23+ sys .exit (0 )
2024 asyncio .run (main ())
Original file line number Diff line number Diff line change 66import asyncio
77from datetime import datetime
88
9- def _cleanup ():
10- for filename in os .listdir (testdata .test_data_folder ()):
11- file_path = os .path .join (testdata .test_data_folder (), filename )
12- if os .path .isfile (file_path ):
13- os .remove (file_path )
14-
159@pytest .fixture (autouse = True )
1610def setup_before_each_test ():
17- _cleanup ()
11+ testdata . cleanup ()
1812 yield
1913 # _cleanup()
2014
Original file line number Diff line number Diff line change 11import asyncio
22import os
33import time
4+ import shutil
45import numpy as np
56from datetime import datetime
67from astropy .nddata import CCDData
1213def test_data_folder ():
1314 return os .path .join (os .path .dirname (__file__ ), "__data__" )
1415
16+ def cleanup ():
17+ folder = test_data_folder ()
18+ if not os .path .exists (folder ):
19+ return
20+ for filename in os .listdir (folder ):
21+ file_path = os .path .join (folder , filename )
22+ if os .path .isfile (file_path ):
23+ os .remove (file_path )
24+ elif os .path .isdir (file_path ):
25+ shutil .rmtree (file_path , ignore_errors = True )
26+
1527def create_test_fits (filename = 'test_image.fits' ,
1628 shape = (100 , 100 ),
1729 date = datetime .now (),
You can’t perform that action at this time.
0 commit comments