-
Notifications
You must be signed in to change notification settings - Fork 4
85 lines (73 loc) · 3.35 KB
/
schedule-test-run.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
---
name: schedule-test-run-command
on:
repository_dispatch:
types: [schedule-test-run-command]
jobs:
schedule-test-run-on-o3:
runs-on: ubuntu-latest
container: registry.fedoraproject.org/fedora:latest
steps:
- run: |
dnf install -y git pipx python3
PIPX_BIN_DIR=/usr/bin/ pipx install poetry
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.cache/pypoetry/virtualenvs
key: poetry-${{ hashFiles('poetry.lock') }}
- name: fix the file permissions of the repository
run: chown -R $(id -un):$(id -gn) .
- name: install python dependencies
run: poetry install
- name: create a oscrc
run: |
mkdir -p ~/.config/osc/
echo "[general]" > ~/.config/osc/oscrc
echo "apiurl = https://api.opensuse.org" >> ~/.config/osc/oscrc
echo "[https://api.opensuse.org]" >> ~/.config/osc/oscrc
echo "user = defolos" >> ~/.config/osc/oscrc
echo "pass = ${{ secrets.OSC_PASSWORD }}" >> ~/.config/osc/oscrc
- name: create the openQA client config file
run: |
mkdir -p ~/.config/openqa
echo "[openqa.opensuse.org]" > ~/.config/openqa/client.conf
echo "key = ${{ secrets.O3_KEY }}" >> ~/.config/openqa/client.conf
echo "secret = ${{ secrets.O3_SECRET }}" >> ~/.config/openqa/client.conf
- name: schedule the actual test run
run: |
VERSION_DISTRI="${{ github.event.client_payload.slash_command.args.named.version_distri }}"
DISTRI="${{ github.event.client_payload.slash_command.args.named.distri }}"
CMD="poetry run schedule_test_run"
eval "$CMD -vd $(echo $VERSION_DISTR | sed 's/,/ /g') -d $(echo $DISTRI | sed 's/,/ /g') --dry-run"
json_state_file=$(ls -tr *json|tail -1)
echo "json_state_file=$json_state_file" >> $GITHUB_ENV
echo "json_b64_state=$(cat $json_state_file | base64 -w 0)" >> $GITHUB_ENV
- name: create a comment with the json state file
uses: peter-evans/create-or-update-comment@v3
id: create_comment
with:
issue-number: ${{ github.event.client_payload.pull_request.number }}
body: |
Created the test run ${{ env.json_state_file }}.
<details><summary>Internal state</summary>
${{ env.json_b64_state }}
</details>
- name: Add reaction to the original comment on success
if: ${{ success() }}
uses: peter-evans/create-or-update-comment@v3
with:
token: ${{ secrets.PAT }}
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
reaction-type: "+1"
- name: generate the url to this workflow run
if: ${{ failure() || cancelled() }}
run: echo "run_url=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> $GITHUB_ENV
- name: Add reaction and a link to the error to the original comment on failure
if: ${{ failure() || cancelled() }}
uses: peter-evans/create-or-update-comment@v3
with:
token: ${{ secrets.PAT }}
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
reaction-type: "-1"
body: Failed to schedule the test, see the [workflow run](${{ env.run_url }}) for further details.