-
Notifications
You must be signed in to change notification settings - Fork 2
134 lines (113 loc) · 3.47 KB
/
Copy pathpython-app.yml
File metadata and controls
134 lines (113 loc) · 3.47 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
123
124
125
126
127
128
129
130
131
132
133
134
name: Python application
on:
push:
branches: '**'
pull_request:
branches: '**'
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: 3.x
cache: 'pip'
- name: Report versions
run: |
lsb_release -a
uname -a
python -V
pip --version
- name: Patch pyLIQTR wheel
run: |
set -euxo pipefail
pip download --dest=python-wheels --no-deps --ignore-requires-python --no-binary :all: pyLIQTR
cd python-wheels
tar -xzvf pyliqtr-*.tar.gz
plver=$(awk '/^Version:/ {print $2}' < pyliqtr-*/PKG-INFO)
cd "pyliqtr-$plver"
sed -i -e '/python_requires/d' setup.py
sed -i -e '/Requires-Python:/d' PKG-INFO src/pyLIQTR.egg-info/PKG-INFO
pip wheel --wheel-dir=.. .
cd ../..
rm -rf "python-wheels/pyliqtr-$plver" "python-wheels/pyliqtr-${plver}.tar.gz"
- name: Download dependencies
run: |
set -euxo pipefail
pip download --dest=python-wheels --find-links=python-wheels .
- name: Store Python wheels
uses: actions/upload-artifact@v7
with:
name: python-wheels
path: python-wheels
retention-days: 7
test:
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: false
matrix:
test-suite:
- name: hamgen
directory: hamiltonian_generator
script: hamgen.py
config_file: ''
- name: analysis-trotter
directory: analysis
script: driver.py
config_file: ''
- name: analysis-pauli-lcu
directory: analysis
script: driver.py
config_file: config-pl.py
config_setup: 'sed -e ''s/^my_method = "Trotter"/my_method = "pauli-lcu"/'' config.py > config-pl.py'
- name: analysis-dbl-factor
directory: analysis
script: driver.py
config_file: config-df.py
config_setup: 'sed -e ''s/^my_method = "Trotter"/my_method = "double-factorization"/'' config.py > config-df.py'
- name: common-unit-tests
directory: common
script: pytest
config_file: ''
config_setup: ''
- name: analysis-unit-tests
directory: analysis
script: pytest
config_file: ''
config_setup: ''
name: Test ${{ matrix.test-suite.name }}
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: 3.x
- name: Restore Python wheels
uses: actions/download-artifact@v8
with:
name: python-wheels
path: python-wheels
- name: Install dependencies
run: |
set -euxo pipefail
pip install --upgrade pip
pip install --find-links=python-wheels .
- name: Setup config
if: matrix.test-suite.config_setup != ''
run: |
cd ${{ matrix.test-suite.directory }}
${{ matrix.test-suite.config_setup }}
- name: Run test
run: |
set -euxo pipefail
cd ${{ matrix.test-suite.directory }}
if [ "${{ matrix.test-suite.script }}" = "pytest" ]; then
python -m pytest tests/ -v
else
python ${{ matrix.test-suite.script }} ${{ matrix.test-suite.config_file }}
fi