-
Notifications
You must be signed in to change notification settings - Fork 187
193 lines (152 loc) · 5.7 KB
/
demo_diff_check.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
name: Check the output of demos on the master and dev branches
on:
schedule:
- cron: '0 0 * * 0'
workflow_dispatch:
jobs:
build-dev:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v4
with:
ref: dev
- name: Run Rigetti Quilc
run: docker run --rm -d -p 5555:5555 rigetti/quilc -R
- name: Run Rigetti QVM
run: docker run --rm -d -p 5000:5000 rigetti/qvm -S
- name: Set up Python Version
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Setup Python Environment
id: venv
run: |
if [ ! -d "venv" ]; then python3 -m venv venv; fi
echo "location=${{ github.workspace }}/venv" >> $GITHUB_OUTPUT
echo "${{ github.workspace }}/venv/bin" >> $GITHUB_PATH
- name: Install Poetry
id: poetry
env:
POETRY_HOME: /tmp/poetry
run: |
curl -sSL https://install.python-poetry.org -o install-poetry.py
python3 install-poetry.py --version 1.7.1
$POETRY_HOME/bin/poetry config virtualenvs.create "false"
$POETRY_HOME/bin/poetry config virtualenvs.in-project "true"
$POETRY_HOME/bin/poetry --version
echo "bin=${{ env.POETRY_HOME }}/bin/poetry" >> $GITHUB_OUTPUT
- name: Install Python Dependencies
run: |
source ${{ steps.venv.outputs.location }}/bin/activate
make POETRY_BIN="${{ steps.poetry.outputs.bin }}" UPGRADE_PL=1 environment
# Adding this install outside of poetry as the dependencies conflict with existing other packages.
# TODO: This needs to be revisited.
${{ steps.venv.outputs.location }}/bin/python3 -m pip install --no-deps mitiq==0.25.0
- name: Build tutorials
run: |
make download
make html
zip -r /tmp/qml_demos.zip demos
- uses: actions/upload-artifact@v2
with:
name: built-website-dev
path: |
/tmp/qml_demos.zip
_build/html
build-master:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v4
with:
ref: master
- name: Run Rigetti Quilc
run: docker run --rm -d -p 5555:5555 rigetti/quilc -R
- name: Run Rigetti QVM
run: docker run --rm -d -p 5000:5000 rigetti/qvm -S
- name: Set up Python Version
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Setup Python Environment
id: venv
run: |
if [ ! -d "venv" ]; then python3 -m venv venv; fi
echo "location=${{ github.workspace }}/venv" >> $GITHUB_OUTPUT
echo "${{ github.workspace }}/venv/bin" >> $GITHUB_PATH
- name: Install Poetry
id: poetry
env:
POETRY_HOME: /tmp/poetry
run: |
curl -sSL https://install.python-poetry.org -o install-poetry.py
python3 install-poetry.py --version 1.7.1
$POETRY_HOME/bin/poetry config virtualenvs.create "false"
$POETRY_HOME/bin/poetry config virtualenvs.in-project "true"
$POETRY_HOME/bin/poetry --version
echo "bin=${{ env.POETRY_HOME }}/bin/poetry" >> $GITHUB_OUTPUT
- name: Install Python Dependencies
run: |
source ${{ steps.venv.outputs.location }}/bin/activate
make POETRY_BIN="${{ steps.poetry.outputs.bin }}" UPGRADE_PL=0 environment
# Adding this install outside of poetry as the dependencies conflict with existing other packages.
# TODO: This needs to be revisited.
${{ steps.venv.outputs.location }}/bin/python3 -m pip install --no-deps mitiq==0.25.0
- name: Build tutorials
run: |
make download
make html
zip -r /tmp/qml_demos.zip demos
- uses: actions/upload-artifact@v2
with:
name: built-website-master
path: |
/tmp/qml_demos.zip
_build/html
check-diffs:
runs-on: ubuntu-latest
needs: [build-dev, build-master]
steps:
- uses: actions/checkout@v4
with:
# We checkout a dedicated unprotected branch and store the output of
# the checker there
ref: demo_output_comparison
- name: Create dev dir
run: mkdir /tmp/dev/
- uses: actions/download-artifact@v2
with:
name: built-website-dev
path: /tmp/dev/
- name: Create master dir
run: mkdir /tmp/master/
- uses: actions/download-artifact@v2
with:
name: built-website-master
path: /tmp/master/
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Update the output file
run: |
git config user.name "QML demo checker Bot"
git config user.email "<>"
pip install pytz
python .github/workflows/generate_diffs.py
mv demo_diffs.md demo_checker
git add demo_checker/demo_diffs.md
git commit -m "Update the demonstration differences found"
git push
- uses: actions/upload-artifact@v2
with:
name: demo_diffs
path: |
demo_checker/demo_diffs.md