forked from PennyLaneAI/pennylane
-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (82 loc) · 2.9 KB
/
tests.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
name: Tests
on:
push:
branches:
- master
pull_request:
concurrency:
group: unit-tests-${{ github.ref }}
cancel-in-progress: true
env:
DEPS_BRANCH: bot/stable-deps-update
jobs:
tests:
uses: ./.github/workflows/interface-unit-tests.yml
with:
branch: ${{ github.ref }}
# Run a 'lightened' version of the CI on Pull Requests by default
# Unless the label `ci:run-full-test-suite` is attached to the PR.
# Always runs the full suite for push events.
run_lightened_ci: >-
${{
github.event_name == 'pull_request'
&& !contains(github.event.pull_request.labels.*.name, 'ci:run-full-test-suite')
|| false
}}
upload-stable-deps:
needs: tests
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-tags: true
sparse-checkout: .github
- name: Prepare local repo
run: |
git fetch
git config user.name "GitHub Actions Bot"
git config user.email "<>"
if git ls-remote --exit-code origin "refs/heads/${{ env.DEPS_BRANCH }}"; then
git checkout "${{ env.DEPS_BRANCH }}"
git rebase origin/master
else
git checkout master
git checkout -b "${{ env.DEPS_BRANCH }}"
fi
rm -f .github/stable/*.txt
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: frozen-*
path: .github/stable/
merge-multiple: true
- name: Determine if changes have been made
id: changed
run: |
echo "has_changes=$(git status --porcelain | wc -l | awk '{print $1}')" >> $GITHUB_OUTPUT
- name: Stage changes
if: steps.changed.outputs.has_changes != '0'
run: |
git add .github/stable/
git commit -m "Update changed dependencies"
git push -f --set-upstream origin "${{ env.DEPS_BRANCH }}"
# Create PR to master
- name: Create pull request
if: steps.changed.outputs.has_changes != '0'
uses: repo-sync/pull-request@v2
with:
source_branch: "${{ env.DEPS_BRANCH }}"
destination_branch: "master"
github_token: "${{ secrets.GITHUB_TOKEN }}"
pr_title: "Update stable dependency files"
pr_body: |
Automatic update of stable requirement files to snapshot valid python environments.
Because bots are not able to trigger CI on their own, please do so by pushing an empty commit to this branch using the following command:
```
git commit --allow-empty -m 'trigger ci'
```
pr_allow_empty: false
pr_draft: false
pr_reviewer: "timmysilv"