forked from lava-nc/lava-optimization
-
Notifications
You must be signed in to change notification settings - Fork 1
131 lines (114 loc) · 3.66 KB
/
cd.yml
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
name: Run CD
on:
workflow_dispatch:
jobs:
build-artifacts:
name: Build Artifacts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
lfs: true
- name: setup CI
uses: lava-nc/ci-setup-composite-action@v1.2
with:
repository: 'Lava-Optimization'
- name: Build artifacts
run: |
pipx run poetry build
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: lava-optimization
path: |
dist
retention-days: 10
test-artifact-install:
name: Test Artifact Install
runs-on: ubuntu-latest
needs: build-artifacts
steps:
- uses: actions/checkout@v3
with:
lfs: true
- name: Download lava-optimization artifact
uses: actions/download-artifact@v3
with:
name: lava-optimization
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Test artifact tar.gz
run: |
python3.9 -m venv artifact-test
source artifact-test/bin/activate
artifact=$(ls | grep lava_optimization | grep tar)
pip install --no-input $artifact
python -c 'import lava.lib.optimization.solvers'
python -c 'import lava.lib.optimization.solvers.qp.solver'
pip uninstall -y lava-optimization
deactivate
rm -rf artifact-test
- name: Test artifact .whl
run: |
python3.9 -m venv artifact-test
source artifact-test/bin/activate
artifact=$(ls | grep lava_optimization | grep whl)
pip install --no-input $artifact
python -c 'import lava.lib.optimization.solvers'
python -c 'import lava.lib.optimization.solvers.qp.solver'
pip uninstall -y lava-optimization
deactivate
rm -rf artifact-test
test-artifact-use:
name: Test Artifact With Unit Tests
runs-on: ubuntu-latest
needs: [build-artifacts, test-artifact-install]
steps:
- name: Download lava-optimization artifact
uses: actions/download-artifact@v3
with:
name: lava-optimization
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Test artifact tar.gz
run: |
mkdir tmp
cd tmp
cp ../lava* .
python3.9 -m venv artifact-unittest
source artifact-unittest/bin/activate
pip install -U pip
pip install nbconvert>=7.2.2 pytest>=7.2.0 matplotlib>=3.5.1 ipykernel>=6.15.0 nbformat>=5.3.0 nbconvert>=7.2.2
artifact=$(ls | grep lava_optimization | grep tar)
pip install --no-input $artifact
tar -xvf $artifact
mv ./lava*/tests .
mv ./lava*/tutorials .
python -m unittest -vv
deactivate
cd ../
rm -rf tmp
- name: Test artifact .whl
run: |
mkdir tmp
cd tmp
cp ../lava* .
python3.9 -m venv artifact-unittest
source artifact-unittest/bin/activate
pip install -U pip
pip install nbconvert>=7.2.2 pytest>=7.2.0 matplotlib>=3.5.1 ipykernel>=6.15.0 nbformat>=5.3.0 nbconvert>=7.2.2
artifact=$(ls | grep lava_optimization | grep whl)
pip install --no-input $artifact
# Change $artifact to tar.gz
artifact=$(ls | grep lava_optimization | grep tar)
tar -xvf $artifact
mv ./lava*/tests .
mv ./lava*/tutorials .
python -m unittest -vv
deactivate
cd ../
rm -rf tmp