@@ -4,10 +4,15 @@ on: [push]
4
4
5
5
jobs :
6
6
build-linux :
7
+ strategy :
8
+ matrix :
9
+ py-version : [312, 313]
7
10
runs-on : ubuntu-latest
8
11
defaults :
9
12
run :
10
13
shell : bash -el {0}
14
+ env :
15
+ build_file : python/.build/env-${{ matrix.py-version }}-linux.yml
11
16
12
17
steps :
13
18
- name : Checkout repository
@@ -24,14 +29,14 @@ jobs:
24
29
uses : actions/cache@v4
25
30
env :
26
31
# Increase this value to reset cache manually
27
- CACHE_NUMBER : 0
32
+ cache_number : 0
28
33
with :
29
34
path : ${{ env.CONDA }}/envs
30
- key : conda-${{ runner.os }}-${{hashFiles('python/build_env_linux.yml' ) }}-${{ env.CACHE_NUMBER }}
35
+ key : conda-${{ runner.os }}-${{ hashFiles(env.build_file ) }}-${{ env.cache_number }}
31
36
id : cache
32
37
33
38
- name : Update environment
34
- run : conda env update -n magtense-env -f python/build_env_linux.yml
39
+ run : conda env update -n magtense-env -f ${{ env.build_file }}
35
40
if : steps.cache.outputs.cache-hit != 'true'
36
41
37
42
- name : Create directory for wrappers of compiled Fortran source code
@@ -51,91 +56,83 @@ jobs:
51
56
52
57
- name : Build pip-wheels
53
58
working-directory : ${{ github.workspace }}/python/
54
- run : python scripts /dist_pypi.py
59
+ run : python .build /dist_pypi.py --py_versions ${{ matrix.py-version }}
55
60
56
61
- name : cpu - Archive pip-wheel
57
62
uses : actions/upload-artifact@v4
58
63
with :
59
- name : pip-wheel-cpu
60
- path : ${{ github.workspace }}/python/dist/magtense-*-0-* .whl
64
+ name : pip-wheel-${{ matrix.py-version }}- cpu
65
+ path : ${{ github.workspace }}/python/dist/magtense-*-0-py${{ matrix.py-version }}-none-manylinux1_x86_64 .whl
61
66
62
67
- name : cu12 - Archive pip-wheel
63
68
uses : actions/upload-artifact@v4
64
69
with :
65
- name : pip-wheel-cu12
66
- path : ${{ github.workspace }}/python/dist/magtense-*-1-* .whl
70
+ name : pip-wheel-${{ matrix.py-version }}- cu12
71
+ path : ${{ github.workspace }}/python/dist/magtense-*-1-py${{ matrix.py-version }}-none-manylinux1_x86_64 .whl
67
72
68
73
69
- test-linux-cpu :
70
- runs-on : ubuntu-24.04
74
+ test-linux :
75
+ strategy :
76
+ matrix :
77
+ mt-punit : [cpu, cu12]
78
+ py-version : [312, 313]
79
+ runs-on : ubuntu-latest
71
80
needs : build-linux
72
81
defaults :
73
82
run :
74
83
shell : bash -el {0}
75
84
76
85
steps :
77
- - name : Download a single artifact
78
- uses : actions/download-artifact@v4
79
- with :
80
- name : pip-wheel-cpu
81
-
82
- - name : Create a new virtual environment
83
- run : |
84
- python3 -m venv ${{ github.workspace }}/.venv
85
-
86
- - name : Install pip-wheel
87
- run : |
88
- source ${{ github.workspace }}/.venv/bin/activate
89
- files=(*)
90
- python3 -m pip install ${{ github.workspace }}/${files[0]}
91
-
92
86
- name : Checkout test scripts
93
87
uses : actions/checkout@v4
94
88
with :
95
89
sparse-checkout : |
96
90
python/tests/
97
-
98
- - name : Test with pytest
99
- run : |
100
- source ${{ github.workspace }}/.venv/bin/activate
101
- export LD_LIBRARY_PATH=${{ github.workspace }}/.venv/lib:$LD_LIBRARY_PATH
102
- python3 -m pip install pytest
103
- pytest
104
-
105
-
106
- test-linux-cu12 :
107
- runs-on : ubuntu-24.04
108
- needs : build-linux
109
- defaults :
110
- run :
111
- shell : bash -el {0}
91
+ documentation/examples_FEM_validation/
112
92
113
- steps :
114
93
- name : Download a single artifact
115
94
uses : actions/download-artifact@v4
116
95
with :
117
- name : pip-wheel-cu12
96
+ name : pip-wheel-${{ matrix.py-version }}-${{ matrix.mt-punit }}
97
+
98
+ # TODO Setup version selection with JavaScript
99
+ # - id: get-id
100
+ # uses: actions/github-script@0.9.0
101
+ # with:
102
+ # script: |
103
+ # const id = context.payload.client_payload.value.split('-')[1]
104
+ # core.setOutput('id', id)
105
+ # - run: echo "${{steps.get-id.outputs.id}}"
106
+
107
+ - name : Setup Miniforge for python 3.12
108
+ if : ${{ matrix.py-version }} == 312
109
+ uses : conda-incubator/setup-miniconda@v3
110
+ with :
111
+ miniforge-version : latest
112
+ python-version : 3.12
113
+ auto-activate-base : true
114
+ activate-environment : true
115
+
116
+ - name : Setup Miniforge for python 3.13
117
+ if : ${{ matrix.py-version }} == 313
118
+ uses : conda-incubator/setup-miniconda@v3
119
+ with :
120
+ miniforge-version : latest
121
+ python-version : 3.13
122
+ auto-activate-base : true
123
+ activate-environment : true
118
124
119
125
- name : Create a new virtual environment
120
- run : |
121
- python3 -m venv ${{ github.workspace }}/.venv
122
-
123
- - name : Install pip-wheel
126
+ run : python3 -m venv ${{ github.workspace }}/.venv
127
+
128
+ # TODO Cache pip
129
+ - name : Install pip-wheel and pytest
124
130
run : |
125
131
source ${{ github.workspace }}/.venv/bin/activate
126
- files=(*)
127
- python3 -m pip install ${{ github.workspace }}/${files[0]}
128
-
129
- - name : Checkout test scripts
130
- uses : actions/checkout@v4
131
- with :
132
- sparse-checkout : |
133
- python/tests/
132
+ python3 -m pip install ${{ github.workspace }}/*.whl
133
+ python3 -m pip install pytest
134
134
135
- - name : Test with pytest
135
+ - name : Run tests
136
136
run : |
137
137
source ${{ github.workspace }}/.venv/bin/activate
138
- export LD_LIBRARY_PATH=${{ github.workspace }}/.venv/lib:$LD_LIBRARY_PATH
139
- python3 -m pip install pytest
140
138
pytest
141
-
0 commit comments