-
Notifications
You must be signed in to change notification settings - Fork 451
107 lines (102 loc) · 3.8 KB
/
pr-comment-validate.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: PR Validation Checker
on:
issue_comment:
types: [created]
jobs:
pr_commented:
name: Validate PR
if: ${{ github.event.issue.pull_request && startsWith(github.event.comment.body, 'validate') }}
needs: set_pending_status
strategy:
matrix:
os: [ubuntu-latest, windows-latest] # macos-latest not tested due to crashing.
version: ["3.9", "3.10"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
ref: refs/pull/${{ github.event.issue.number }}/head
submodules: 'true'
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.version }}
cache: 'pip'
- uses: actions/cache/restore@v4
if: matrix.os == 'windows-latest'
id: restore_cache
with:
path: src/libsodium.dll
key: cache_libsodium_dll
- run: python -m pip install -r requirements.txt
- run: |
cd src
python run_unit_tests.py -a
env:
TEST_IPV8_WITH_IPV6: 0
- run: |
cd src
python run_unit_tests.py -a
env:
TEST_IPV8_WITH_IPV6: 1
- run: |
cd src
python run_unit_tests.py -a -k tribler/test_integration -p 2
set_pending_status:
if: ${{github.event.issue.pull_request && startsWith(github.event.comment.body, 'validate') }}
runs-on: ubuntu-latest
outputs:
actual_pull_head: ${{ steps.sha_share_step.outputs.actual_pull_head }}
steps:
- name: Retrieving commit
shell: bash
run: |
{
echo 'actual_pull_head<<EOF'
git ls-remote ${{ github.server_url }}/${{ github.repository }}/ refs/pull/${{ github.event.issue.number }}/head | grep -o "^\w*\b"
echo
echo EOF
} >> "$GITHUB_ENV"
- name: Sharing commit SHA between jobs
id: sha_share_step
run: echo "actual_pull_head=${{ env.actual_pull_head }}" >> "$GITHUB_OUTPUT"
- name: Set commit pending status
uses: guibranco/[email protected]
with:
authToken: ${{secrets.COMMIT_STATUS_TOKEN}}
context: 'Cross-env Validation'
description: 'Pending..'
state: 'pending'
sha: ${{ env.actual_pull_head }}
target_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
set_failure_status:
if: ${{failure() && github.event.issue.pull_request && startsWith(github.event.comment.body, 'validate') }}
needs: [set_pending_status, pr_commented]
runs-on: ubuntu-latest
steps:
- name: Set commit failed status
env:
actual_pull_head: ${{needs.set_pending_status.outputs.actual_pull_head}}
uses: guibranco/[email protected]
with:
authToken: ${{secrets.COMMIT_STATUS_TOKEN}}
context: 'Cross-env Validation'
description: 'Failed!'
state: 'failure'
sha: ${{ env.actual_pull_head }}
target_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
set_success_status:
if: ${{!failure() && github.event.issue.pull_request && startsWith(github.event.comment.body, 'validate') }}
needs: [set_pending_status, pr_commented]
runs-on: ubuntu-latest
steps:
- name: Set commit success status
env:
actual_pull_head: ${{needs.set_pending_status.outputs.actual_pull_head}}
uses: guibranco/[email protected]
with:
authToken: ${{secrets.COMMIT_STATUS_TOKEN}}
context: 'Cross-env Validation'
description: 'Success!'
state: 'success'
sha: ${{ env.actual_pull_head }}
target_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}