-
Notifications
You must be signed in to change notification settings - Fork 2
73 lines (61 loc) · 2.24 KB
/
run_experiments.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
name: Check for new qiskit versions, run benchmark experiments and submit results to metriq.info
on:
push:
branches:
- 'client-update-results' #TODO: Remove this when done debugging CI
schedule:
- cron: '0 0 1 * *' # Schedule to run on the 1st day of each month at 12:00 AM UTC
env:
FORCE_COLOR: true
jobs:
run_experiment_steps:
runs-on: ubuntu-latest
env:
METRIQ_TOKEN: ${{ secrets.METRIQ_TOKEN}}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install tox
run: pip install tox
- name: Run experiment steps in tox
run: tox -ve py38
- name: Check for new artifacts
id: artifacts-check
run: |
git diff --name-only --diff-filter=AD HEAD^ HEAD benchmarking/results/ | grep '\.csv$' > changed_csv_files.txt
if [[ $(cat changed_csv_files.txt | wc -1) -eq 0 ]]; then
echo "No result files to process"
echo "changed_csv_files=0" >> $GIHUB_ENV
else
echo "New result files found"
cat changed_csv_files.txt
echo "changed_csv_files=1" >> $GIHUB_ENV
NEW_BRANCH="automated-branch"
echo "NEW_BRANCH=$NEW_BRANCH" >> $GIHUB_ENV
fi
- name: Configure Git with Bot Git Config
if: env.changed_csv_files.txt == '1'
run: |
git config user.name "${{ secrets.BOT_USERNAME }}"
git config user.email "${{ secrets.BOT_EMAIL }}"
- name: Create new branch and commit changes
if: env.changed_csv_files.txt == '1'
run: |
git checkout -b ${{ env.NEW_BRANCH }}
cd benchmarking/results
xargs -a ../../changed_csv_files.txt -I {} git add "{}" || true
cd ../../
git commit -m "Add new result files"
git push origin ${{ env.NEW_BRANCH }}
- name: Create new PR for new artifacts
if: env.changed_csv_files.txt == '1'
uses: repo-sync/pull-request@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
pr_title: "Add new result files"
destination_branch: "main"
source_branch: ${{ env.NEW_BRANCH }}