Skip to content

Commit e156c4e

Browse files
committed
Add Integration Request action
1 parent 28832ab commit e156c4e

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: "Reusable Integration Request"
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
trigger:
7+
description: "Required trigger for requesting the test suite"
8+
default: "@integrationtests"
9+
required: false
10+
type: string
11+
localregistry:
12+
description: "Add local registries hosted on GitHub. Specified by providing the url (https/ssh) to the repositories as a newline (\n) seperated list. User is responsible for setting up the necessary SSH-Keys to access the repositories if necessary."
13+
default: ""
14+
required: false
15+
type: string
16+
17+
jobs:
18+
get-pr-comment:
19+
runs-on: ubuntu-latest
20+
outputs:
21+
repo: ${{ steps.extract.outputs.REPO }}
22+
steps:
23+
- name: Extract command arguments
24+
id: extract
25+
run: |
26+
COMMENT="${{ github.event.comment.body }}"
27+
QUERY="${{ inputs.trigger }}"
28+
if [[ "$COMMENT" =~ ^$QUERY[[:space:]]+(.*) ]]; then
29+
echo "REPO=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT
30+
else
31+
echo "No valid command found, exiting..."
32+
exit 1
33+
fi
34+
35+
runtests:
36+
needs: get-pr-comment
37+
uses: ITensor/ITensorActions/.github/workflows/IntegrationTest.yml@main
38+
with:
39+
localregistry: "${{ inputs.localregistry }}"
40+
repo: "${{ needs.get-pr-comment.outputs.repo }}"
41+
42+
report:
43+
needs: [get-pr-comment, runtests]
44+
runs-on: ubuntu-latest
45+
steps:
46+
- uses: peter-evans/create-or-update-comment@v4
47+
with:
48+
comment-id: ${{ github.event.comment.id }}
49+
reactions: '+1'

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,3 +245,23 @@ jobs:
245245
localregistry: "https://github.com/ITensor/ITensorRegistry.git"
246246
repo: "${{ matrix.repo }}"
247247
```
248+
249+
Additionally, it is possible to run these tests dynamically, whenever a comment on a PR is detected.
250+
For example, a workflow that detects `@integrationtests Repo/Package.jl` looks like:
251+
252+
```yaml
253+
name: "Integration Request"
254+
255+
on:
256+
issue_comment:
257+
types: [created]
258+
259+
jobs:
260+
integrationrequest:
261+
if: |
262+
github.event.issue.pull_request &&
263+
contains(fromJSON('["OWNER", "COLLABORATOR", "MEMBER"]'), github.event.comment.author_association)
264+
uses: ITensor/ITensorActions/.github/workflows/IntegrationRequest.yml@main
265+
with:
266+
localregistry: https://github.com/ITensor/ITensorRegistry.git
267+
```

0 commit comments

Comments
 (0)