-
Notifications
You must be signed in to change notification settings - Fork 46
186 lines (178 loc) · 6.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
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.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
ref: refs/pull/${{ github.event.issue.number }}/head
- 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: libsodium.dll
key: cache_libsodium_dll
- run: python -m pip install -r requirements.txt
- run: python run_all_tests.py -a
env:
TEST_IPV8_WITH_IPV6: 0
- run: python run_all_tests.py -a
env:
TEST_IPV8_WITH_IPV6: 1
- uses: actions/cache/save@v4
if: matrix.os == 'windows-latest'
id: save_cache
with:
path: libsodium.dll
key: cache_libsodium_dll
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, validate_attestation_tutorial, validate_identity_tutorial, validate_documentation]
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, validate_attestation_tutorial, validate_identity_tutorial, validate_documentation]
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 }}
validate_attestation_tutorial:
name: Validate attestation tutorial
if: ${{github.event.issue.pull_request && startsWith(github.event.comment.body, 'validate') }}
needs: set_pending_status
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: refs/pull/${{ github.event.issue.number }}/head
- name: Setup Python 3.8
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Install dependencies
run: |
pip install --upgrade setuptools pip
pip install -r requirements.txt
- name: Run attestation tests
run: |
export PYTHONPATH="$(pwd)/"
cd doc/deprecated/attestation_tutorial_integration
python attestation_tutorial_attest.py
python attestation_tutorial_verify.py
validate_identity_tutorial:
name: Validate identity tutorial
if: ${{github.event.issue.pull_request && startsWith(github.event.comment.body, 'validate') }}
needs: set_pending_status
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: refs/pull/${{ github.event.issue.number }}/head
- name: Setup Python 3.8
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Install dependencies
run: |
pip install --upgrade setuptools pip
pip install -r requirements.txt
- name: Run identity tests
run: |
export PYTHONPATH="$(pwd)/"
cd doc/basics/identity_tutorial_integration
python attestation_tutorial_attest.py
python attestation_tutorial_verify.py
validate_documentation:
name: Validate documentation
if: ${{github.event.issue.pull_request && startsWith(github.event.comment.body, 'validate') }}
needs: set_pending_status
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: refs/pull/${{ github.event.issue.number }}/head
- name: Setup Python 3.8
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Install dependencies
run: |
pip install --upgrade setuptools pip
pip install -r requirements.txt
- name: Run documentation tests
run: |
cd doc
if [ -f "further-reading/certfile.pem" ]
then
echo "certfile.pem found"
else
echo "generating certfile.pem"
cd further-reading
openssl req -newkey rsa:2048 -nodes -keyout private.key -x509 -days 365 -out certfile.pem -subj "/C=NL/ST=Zuid Holland/L=Delft/O=TU Delft/OU=Distributed Systems Group/CN=Tribler"
cat private.key >> certfile.pem
rm private.key
cd ..
fi
LD_PRELOAD=libgcc_s.so.1 python3 -X dev ./validate_examples.py