-
Notifications
You must be signed in to change notification settings - Fork 1.3k
83 lines (75 loc) · 3.26 KB
/
Copy pathprhtmlgenerator.yml
File metadata and controls
83 lines (75 loc) · 3.26 KB
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
name: 'PR Testing'
on:
pull_request:
branches: [ master ]
permissions:
contents: read
jobs:
test-pr:
name: Generate HTML files
runs-on: ubuntu-24.04-arm
steps:
- name: Create configuration files
id: configuration
run: |
touch DEBUG
PR=${{ github.event.number || 'none' }}
wget https://patch-diff.githubusercontent.com/raw/$GITHUB_REPOSITORY/pull/$PR.patch
grep "\bbridges/[A-Za-z0-9]*Bridge\.php\b" $PR.patch | sed "s=.*\bbridges/\([A-Za-z0-9]*\)Bridge\.php\b.*=\1=g" | sort -u > whitelist.txt
echo "number_bridges=$(wc -l < whitelist.txt)" >> $GITHUB_OUTPUT
echo "whitelist.txt:"
cat whitelist.txt
- name: Checkout - PR
if: steps.configuration.outputs.number_bridges > 0
uses: actions/checkout@v7
with:
path: pr
persist-credentials: false
- name: Build docker image - PR
if: steps.configuration.outputs.number_bridges > 0
run: docker build -t rss-bridge-pr pr/
- name: Run docker container - PR
if: steps.configuration.outputs.number_bridges > 0
run: docker run -v $GITHUB_WORKSPACE/whitelist.txt:/app/whitelist.txt:ro -v $GITHUB_WORKSPACE/DEBUG:/app/DEBUG:ro --detach --pull never -p 3001:80 rss-bridge-pr
- name: Checkout - Current
if: steps.configuration.outputs.number_bridges > 0
uses: actions/checkout@v7
with:
ref: ${{github.event.pull_request.base.ref}}
repository: ${{github.event.pull_request.base.repo.full_name}}
path: current
persist-credentials: false
- name: Build docker image - Current
if: steps.configuration.outputs.number_bridges > 0
run: docker build -t rss-bridge-current current/
- name: Run docker container - Current
if: steps.configuration.outputs.number_bridges > 0
run: docker run -v $GITHUB_WORKSPACE/whitelist.txt:/app/whitelist.txt:ro -v $GITHUB_WORKSPACE/DEBUG:/app/DEBUG:ro --detach --pull never -p 3000:80 rss-bridge-current
- name: Setup python
if: steps.configuration.outputs.number_bridges > 0
uses: actions/setup-python@v7
with:
python-version: '3.14'
cache: 'pip'
cache-dependency-path: '**/*requirements*.txt'
- name: Install python requirements
if: steps.configuration.outputs.number_bridges > 0
run: pip install -r ./current/.github/prtester-requirements.txt
- name: Run bridge tests
if: steps.configuration.outputs.number_bridges > 0
id: run-tests
env:
PYTHONUNBUFFERED: 1
run: |
python ./current/.github/prtester.py --artifacts-base-url "https://${{ github.repository_owner }}.github.io/${{ vars.ARTIFACTS_REPO || 'rss-bridge-tests' }}/prs/${{ github.event.number || 'none' }}"
cat comment.md >> $GITHUB_STEP_SUMMARY
echo "bodylength=$(wc -c < comment.md)" >> $GITHUB_OUTPUT
- name: Upload test results as artifacts
if: steps.configuration.outputs.number_bridges > 0 && steps.run-tests.outputs.bodylength > 130
uses: actions/upload-artifact@v7
with:
name: test-results
path: |
comment.md
*.html
if-no-files-found: error