@@ -5,12 +5,11 @@ name: Tests and Lint
55
66on :
77 push :
8- branches : [ "main" ]
8+ branches : ["main"]
99 pull_request :
10- branches : [ "main" ]
10+ branches : ["main"]
1111
1212env :
13- KETE_CACHE_DIR : ${{ github.workspace }}/docs/data
1413 RUSTFLAGS : " -D warnings"
1514 RUSTDOCFLAGS : " -D warnings"
1615
@@ -24,72 +23,96 @@ jobs:
2423 runs-on : ubuntu-latest
2524 strategy :
2625 fail-fast : false
26+
2727 steps :
28- - uses : actions/checkout@v4
29- with :
30- lfs : true
31- - name : Set up Python
32- uses : actions/setup-python@v5
33- with :
34- python-version : " 3.11"
35- - name : Test with cargo
36- run : |
37- cargo test
38- - name : Cargo Docs
39- run : |
40- cargo doc
41- - name : Install dependencies
42- run : |
43- python3 -m pip install --upgrade pip setuptools black mypy types-requests numpy
44- - name : Black Formatting
45- run : |
46- python3 -m black . --check
47- - name : Lint with mypy
48- run : |
49- python3 -m mypy src/kete/
50-
51- # Build and run pytest
52- - name : Build kete
53- run : |
54- python3 -m pip install '.[dev]' -v
55- - name : Test with pytest
56- run : |
57- python3 -m pytest --cov-report term-missing --cov=kete
58-
59- # Build documentation and push artifact
60- - name : Build Docs
61- run : |
62- cd docs
63- make clean
64- make doctest
65- make html
66- - name : Fix permissions
67- run : |
68- chmod -c -R +rX "docs/" | while read line; do
69- echo "::warning title=Invalid file permissions automatically fixed::$line"
70- done
71- - name : Upload Docs artifact
72- uses : actions/upload-artifact@v4
73- with :
74- name : " docs"
75- path :
76- docs/html/
77- - name : Upload Pages artifact
78- uses : actions/upload-pages-artifact@v3
79- with :
80- name : " github-pages"
81- path :
82- docs/html/
83-
84-
28+ - uses : actions/checkout@v4
29+
30+ - name : Cache downloaded files
31+ id : cache-kete
32+ uses : actions/cache@v4
33+ env :
34+ cache-name : cache-kete
35+ with :
36+ # kete stores all files in `~/.kete/` by default
37+ path : ~/.kete
38+ # These files are valid long term, and are not expected to change
39+ # between runs. So there is no need to a changing name.
40+ key : kete-cache
41+
42+ - name : Setup Rust
43+ uses : actions-rust-lang/setup-rust-toolchain@v1
44+ with :
45+ toolchain : stable
46+ cache-key : ${{ runner.os }}-stable
47+
48+ - name : Set up Python
49+ uses : actions/setup-python@v5
50+ with :
51+ python-version : " 3.11"
52+
53+ - name : Install dependencies
54+ run : |
55+ python3 -m pip install --upgrade pip setuptools ruff mypy types-requests numpy
56+
57+ - name : Ruff Formatting
58+ run : |
59+ python3 -m ruff check
60+
61+ - name : Lint with mypy
62+ run : |
63+ python3 -m mypy src/kete/
64+
65+ # Build and run pytest
66+ - name : Build kete
67+ run : |
68+ python3 -m pip install '.[dev]' -v
69+
70+ - name : Test with pytest
71+ run : |
72+ python3 -m pytest --cov-report term-missing --cov=kete
73+
74+ - name : Test with cargo
75+ run : |
76+ cargo test
77+
78+ - name : Cargo Docs
79+ run : |
80+ cargo doc
81+
82+ # Build documentation and push artifact
83+ - name : Build Docs
84+ run : |
85+ cd docs
86+ make clean
87+ make doctest
88+ make html
89+
90+ - name : Fix permissions
91+ run : |
92+ chmod -c -R +rX "docs/" | while read line; do
93+ echo "::warning title=Invalid file permissions automatically fixed::$line"
94+ done
95+
96+ - name : Upload Docs artifact
97+ uses : actions/upload-artifact@v4
98+ with :
99+ name : " docs"
100+ path : docs/html/
101+
102+ - name : Upload Pages artifact
103+ uses : actions/upload-pages-artifact@v3
104+ with :
105+ name : " github-pages"
106+ path : docs/html/
107+
85108 deploy :
86109 needs : build
87110 if : success() && github.ref == 'refs/heads/main'
88111
89112 # Grant GITHUB_TOKEN the permissions required to make a Pages deployment
90113 permissions :
91- pages : write # to deploy to Pages
92- id-token : write # to verify the deployment originates from an appropriate source
114+ pages : write # to deploy to Pages
115+ id-token : write # to verify the deployment originates from an appropriate source
93116
94117 # Deploy to the github-pages environment
95118 environment :
0 commit comments