-
Notifications
You must be signed in to change notification settings - Fork 2
86 lines (85 loc) · 2.67 KB
/
selfhosted.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
# CI workflow that runs on self hosted cluster
name: Self-hosted rules
on:
pull_request:
types: [labeled]
workflow_dispatch:
jobs:
prepare:
if: contains(join(github.event.pull_request.labels.*.name), 'run-on')
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Read platforms from labels
id: set-matrix
env:
LABELS: ${{ toJSON(github.event.pull_request.labels.*.name) }}
run: |
echo $LABELS
platforms="["
combined=""
shopt -s lastpipe
jq -c '.[]' <<< "$LABELS" | while read label; do
platform=(${label//-/ })
if [ ${platform[0]} == "\"run" ] && [ ${platform[1]} == "on" ]; then
platforms+="${combined:+,}\"${platform[2]}"
combined=${platforms}
fi
done
platforms+="]"
echo ${platforms}
echo matrix="${platforms}" >> $GITHUB_OUTPUT
tests:
needs: prepare
strategy:
matrix:
platform: ${{ fromJSON(needs.prepare.outputs.matrix) }}
version: ["main"]
fail-fast: false
runs-on: self-hosted
steps:
- name: Cleanup workspace manually
run: |
rm -rf _work/*
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python-version }}
- name: Install and configure poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: false
- name: Install qibo stable
if: ${{ matrix.version == 'stable' }}
run: |
python -m venv testenv
source testenv/bin/activate
python -m pip install qibolab qibocal
- name: Install qibo main
if: ${{ matrix.version == 'main' }}
run: |
python -m venv testenv
source testenv/bin/activate
git clone https://github.com/qiboteam/qibolab
git clone https://github.com/qiboteam/qibocal
cd qibocal
poetry install --no-interaction
cd ../qibolab
poetry install --no-interaction --all-extras
cd ..
- name: Execute on ${{ matrix.platform }}
run: |
queues=`cat queues.json`
platform=${{ matrix.platform }}
source testenv/bin/activate
export QIBOLAB_PLATFORMS=.
partition="$(jq -r -n --argjson data "$queues" '$data.'$platform)"
srun -p $partition python _selfhosted/calibration.py ${{ matrix.platform }}
- name: Notify the Pull Request
uses: thollander/actions-comment-pull-request@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
filePath: message.txt