1
+ ---
1
2
name : Run integration tests in Testing Farm
2
3
on :
3
4
issue_comment :
@@ -7,26 +8,32 @@ permissions:
7
8
contents : read
8
9
# This is required for the ability to create/update the Pull request status
9
10
statuses : write
10
- # The concurrency key is used to prevent multiple workflows from running at the same time
11
- concurrency :
12
- # group name contains reponame-pr_num to allow simualteneous runs in different PRs
13
- group : testing-farm-${{ github.event.repository.name }}-${{ github.event.issue.number }}
14
- cancel-in-progress : true
15
11
jobs :
16
12
prepare_vars :
17
13
name : Get info from role and PR to determine if and how to test
14
+ # The concurrency key is used to prevent multiple workflows from running at the same time
15
+ concurrency :
16
+ # group name contains reponame-pr_num to allow simualteneous runs in different PRs
17
+ group : testing-farm-${{ github.event.repository.name }}-${{ github.event.issue.number }}
18
+ cancel-in-progress : true
18
19
# Let's schedule tests only on user request. NOT automatically.
19
20
# Only repository owner or member can schedule tests
20
21
if : |
21
22
github.event.issue.pull_request
22
- && (contains(github.event.comment.body, '[citest]') || contains(github.event.comment.body, '[citest-all]'))
23
+ && contains(github.event.comment.body, '[citest]')
24
+ && (contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.comment.author_association)
25
+ || contains('systemroller', github.event.comment.user.login))
23
26
runs-on : ubuntu-latest
24
27
outputs :
25
28
supported_platforms : ${{ steps.supported_platforms.outputs.supported_platforms }}
26
29
head_sha : ${{ steps.head_sha.outputs.head_sha }}
27
- datetime : ${{ steps.datetime.outputs.datetime }}
28
30
memory : ${{ steps.memory.outputs.memory }}
29
31
steps :
32
+ - name : Dump github context
33
+ run : echo "$GITHUB_CONTEXT"
34
+ shell : bash
35
+ env :
36
+ GITHUB_CONTEXT : ${{ toJson(github) }}
30
37
31
38
- name : Checkout repo
32
39
uses : actions/checkout@v4
41
48
PR_NO : ${{ github.event.issue.number }}
42
49
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
43
50
44
- - name : Get cuurent datetime
45
- id : datetime
46
- run : |
47
- printf -v datetime '%(%Y%m%d-%H%M%S)T' -1
48
- echo "datetime=$datetime" >> $GITHUB_OUTPUT
49
-
50
51
- name : Get memory
51
52
id : memory
52
53
run : |
@@ -114,6 +115,19 @@ jobs:
114
115
${{ needs.prepare_vars.outputs.datetime }}/artifacts"
115
116
ARTIFACT_TARGET_DIR : /srv/pub/alt/linuxsystemroles/logs
116
117
steps :
118
+ - name : Set variables with DATETIME and artifact location
119
+ id : set_vars
120
+ run : |
121
+ printf -v DATETIME '%(%Y%m%d-%H%M%S)T' -1
122
+ ARTIFACTS_DIR_NAME="tf_${{ github.event.repository.name }}-${{ github.event.issue.number }}_\
123
+ ${{ matrix.platform }}-${{ matrix.ansible_version }}_$DATETIME/artifacts"
124
+ ARTIFACTS_TARGET_DIR=/srv/pub/alt/linuxsystemroles/logs
125
+ ARTIFACTS_DIR=$ARTIFACTS_TARGET_DIR/$ARTIFACTS_DIR_NAME
126
+ ARTIFACTS_URL=https://dl.fedoraproject.org/pub/alt/linuxsystemroles/logs$ARTIFACTS_DIR_NAME
127
+ echo "DATETIME=$DATETIME" >> $GITHUB_OUTPUT
128
+ echo "ARTIFACTS_DIR=$ARTIFACTS_DIR" >> $GITHUB_OUTPUT
129
+ echo "ARTIFACTS_URL=$ARTIFACTS_URL" >> $GITHUB_OUTPUT
130
+
117
131
- name : Set commit status as pending
118
132
if : contains(needs.prepare_vars.outputs.supported_platforms, matrix.platform)
119
133
uses : myrotvorets/set-commit-status-action@master
@@ -137,19 +151,17 @@ jobs:
137
151
- name : Run test in testing farm
138
152
uses : sclorg/testing-farm-as-github-action@v3
139
153
if : contains(needs.prepare_vars.outputs.supported_platforms, matrix.platform)
140
- env :
141
- ARTIFACTS_DIR : ${{ env.ARTIFACT_TARGET_DIR }}/${{ env.ARTIFACTS_DIR_NAME }}
142
- ARTIFACTS_URL : https://dl.fedoraproject.org/pub/alt/linuxsystemroles/logs/${{ env.ARTIFACTS_DIR_NAME }}
143
154
with :
144
- git_url : ${{ github.server_url }}/${{ github.repository }}
145
- git_ref : ${{ needs.prepare_vars.outputs.head_sha }}
155
+ git_url : https:// github.com/linux-system-roles/tft-tests
156
+ git_ref : main
146
157
pipeline_settings : ' { "type": "tmt-multihost" }'
147
158
variables : " ANSIBLE_VER=${{ matrix.ansible_version }};\
148
159
REPO_NAME=${{ github.event.repository.name }};\
160
+ GITHUB_ORG=${{ github.repository_owner }};\
149
161
GITHUB_ORG=linux-system-roles;\
150
162
PR_NUM=${{ github.event.issue.number }};\
151
- ARTIFACTS_DIR=${{ env .ARTIFACTS_DIR }};\
152
- ARTIFACTS_URL=${{ env .ARTIFACTS_URL }};\
163
+ ARTIFACTS_DIR=${{ steps.set_vars.outputs .ARTIFACTS_DIR }};\
164
+ ARTIFACTS_URL=${{ steps.set_vars.outputs .ARTIFACTS_URL }};\
153
165
TEST_LOCAL_CHANGES=false"
154
166
# Note that LINUXSYSTEMROLES_SSH_KEY must be single-line, TF doesn't read multi-line variables fine.
155
167
secrets : " LINUXSYSTEMROLES_USER=${{ secrets.LINUXSYSTEMROLES_USER }};\
@@ -167,11 +179,9 @@ jobs:
167
179
- name : Set final commit status
168
180
uses : myrotvorets/set-commit-status-action@master
169
181
if : always() && contains(needs.prepare_vars.outputs.supported_platforms, matrix.platform)
170
- env :
171
- ARTIFACTS_URL : https://dl.fedoraproject.org/pub/alt/linuxsystemroles/logs/${{ env.ARTIFACTS_DIR_NAME }}
172
182
with :
173
183
sha : ${{ needs.prepare_vars.outputs.head_sha }}
174
184
status : ${{ job.status }}
175
185
context : ${{ matrix.platform }}|ansible-${{ matrix.ansible_version }}
176
186
description : Test finished
177
- targetUrl : ${{ env .ARTIFACTS_URL }}
187
+ targetUrl : ${{ steps.set_vars.outputs .ARTIFACTS_URL }}
0 commit comments