This repository has been archived by the owner on May 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
209 lines (198 loc) · 6.85 KB
/
build_and_test.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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
name: Build and test
on:
pull_request:
branches:
- main
- develop
push:
branches:
- develop
- 'wheel/**'
- 'runci/**'
release:
types:
- created
- edited
schedule:
# 04:00 every Tuesday morning
- cron: '0 4 * * 2'
env:
IQSHARP_TELEMETRY_OPT_OUT: 1
PYTKET_REMOTE_QSHARP_RESOURCE_ID: ${{ secrets.PYTKET_REMOTE_QSHARP_RESOURCE_ID }}
PYTKET_REMOTE_QSHARP_LOCATION: ${{ secrets.PYTKET_REMOTE_QSHARP_LOCATION }}
PYTKET_REMOTE_QSHARP_STORAGE: ${{ secrets.PYTKET_REMOTE_QSHARP_STORAGE }}
AZURE_TENANT_ID: ${{ secrets.PYTKET_REMOTE_QSHARP_AZURE_TENANT_ID }}
AZURE_CLIENT_ID: ${{ secrets.PYTKET_REMOTE_QSHARP_AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.PYTKET_REMOTE_QSHARP_AZURE_CLIENT_SECRET }}
jobs:
qsharp-checks:
name: Qsharp - Build and test module
strategy:
matrix:
os: ['ubuntu-22.04', 'macos-12', 'windows-2022']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* +refs/heads/*:refs/remotes/origin/*
- name: Install dotnet SDK - ubuntu
if: ${{ matrix.os == 'ubuntu-22.04' }}
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
- name: Install iqsharp - ubuntu
if: ${{ matrix.os == 'ubuntu-22.04' }}
run: |
dotnet tool install -g Microsoft.Quantum.IQSharp
dotnet iqsharp install --user
- name: Install dotnet SDK - mac os
if: ${{ matrix.os == 'macos-12' }}
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
- name: Install iqsharp - mac os
if: ${{ matrix.os == 'macos-12' }}
run: |
brew install mono-libgdiplus jupyter
dotnet tool install -g Microsoft.Quantum.IQSharp
dotnet iqsharp install
- name: Install dotnet SDK - windows
if: ${{ matrix.os == 'windows-2022' }}
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
- name: Install iqsharp - windows
if: ${{ matrix.os == 'windows-2022' }}
run: |
dotnet tool install -g Microsoft.Quantum.IQSharp
dotnet iqsharp install --user
- name: Set up Python 3.9
if: github.event_name == 'push' || github.event_name == 'schedule'
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Build and test (3.9)
if: github.event_name == 'push' || github.event_name == 'schedule'
shell: bash
run: |
./.github/workflows/build-test nomypy
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Build and test including remote checks (3.10) mypy
if: (matrix.os == 'macos-12') && (github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || github.event_name == 'release' || github.event_name == 'schedule' )
shell: bash
run: |
./.github/workflows/build-test mypy
env:
PYTKET_RUN_REMOTE_TESTS: 1
- name: Build and test including remote checks (3.10) nomypy
if: (matrix.os != 'macos-12') && (github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || github.event_name == 'release' || github.event_name == 'schedule')
shell: bash
run: |
./.github/workflows/build-test nomypy
env:
PYTKET_RUN_REMOTE_TESTS: 1
- name: Set up Python 3.11
if: github.event_name == 'push' || github.event_name == 'pull_request' || github.event_name == 'schedule'
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Build and test (3.11)
if: github.event_name == 'push' || github.event_name == 'pull_request' || github.event_name == 'schedule'
shell: bash
run: |
./.github/workflows/build-test nomypy
- uses: actions/upload-artifact@v3
if: github.event_name == 'release' || contains(github.ref, 'refs/heads/wheel')
with:
name: artefacts
path: wheelhouse/
- name: Install docs dependencies
if: (matrix.os == 'ubuntu-22.04') && (github.event_name == 'pull_request' || github.event_name == 'schedule' )
run: |
pip install -r .github/workflows/docs/requirements.txt
- name: Build docs
if: (matrix.os == 'ubuntu-22.04') && (github.event_name == 'pull_request' || github.event_name == 'schedule' )
timeout-minutes: 20
run: |
./.github/workflows/docs/check-build-docs
publish_to_pypi:
name: Publish to pypi
if: github.event_name == 'release'
needs: qsharp-checks
runs-on: ubuntu-22.04
steps:
- name: Download all wheels
uses: actions/download-artifact@v3
with:
path: wheelhouse
- name: Put them all in the dist folder
run: |
mkdir dist
for w in `find wheelhouse/ -type f -name "*.whl"` ; do cp $w dist/ ; done
- name: Publish wheels
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_PYTKET_QSHARP_API_TOKEN }}
verbose: true
build_docs:
name: Build docs
if: github.event_name == 'release'
needs: publish_to_pypi
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Download all wheels
uses: actions/download-artifact@v3
with:
path: wheelhouse
- name: Install pip, wheel
run: pip install -U pip wheel jupyterlab
- name: Install extension
run: for w in `find wheelhouse/ -type f -name "*.whl"` ; do pip install $w ; done
- name: Install dotnet SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
- name: Install iqsharp
run: |
dotnet tool install -g Microsoft.Quantum.IQSharp
dotnet iqsharp install --user
- name: Install docs dependencies
run: |
pip install -r .github/workflows/docs/requirements.txt
- name: Build docs
timeout-minutes: 20
run: |
cd .github/workflows/docs
mkdir extensions
./build-docs -d ${GITHUB_WORKSPACE}/.github/workflows/docs/extensions/api
- name: Upload docs as artefact
uses: actions/upload-pages-artifact@v2
with:
path: .github/workflows/docs/extensions
publish_docs:
name: Publish docs
if: github.event_name == 'release'
needs: build_docs
runs-on: ubuntu-22.04
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2