mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-12-21 03:37:19 +03:00
93eecdf79f
* [core] replace everything except bridge name to get a valid whitelist.txt * [core] do not use hard code repository name to improve working with forks * [core] trim bridge names from whitelist.txt to reduce chance of failure
67 lines
2.7 KiB
YAML
67 lines
2.7 KiB
YAML
name: 'PR Testing'
|
|
|
|
on:
|
|
pull_request_target:
|
|
branches: [ master ]
|
|
|
|
jobs:
|
|
test-pr:
|
|
name: Generate HTML
|
|
runs-on: ubuntu-latest
|
|
# Needs additional permissions https://github.com/actions/first-interaction/issues/10#issuecomment-1041402989
|
|
steps:
|
|
- name: Check out self
|
|
uses: actions/checkout@v3
|
|
with:
|
|
ref: ${{github.event.pull_request.head.ref}}
|
|
repository: ${{github.event.pull_request.head.repo.full_name}}
|
|
- name: Check out rss-bridge
|
|
run: |
|
|
PR=${{github.event.number}};
|
|
wget -O requirements.txt https://raw.githubusercontent.com/$GITHUB_REPOSITORY/${{ github.event.pull_request.base.ref }}/.github/prtester-requirements.txt;
|
|
wget https://raw.githubusercontent.com/$GITHUB_REPOSITORY/${{ github.event.pull_request.base.ref }}/.github/prtester.py;
|
|
wget https://patch-diff.githubusercontent.com/raw/$GITHUB_REPOSITORY/pull/$PR.patch;
|
|
touch DEBUG;
|
|
cat $PR.patch | grep "\bbridges/.*Bridge\.php\b" | sed "s=.*\bbridges/\(.*\)Bridge\.php\b.*=\1=g" | sort | uniq > whitelist.txt
|
|
- name: Start Docker - Current
|
|
run: |
|
|
docker run -d -v $GITHUB_WORKSPACE/whitelist.txt:/app/whitelist.txt -v $GITHUB_WORKSPACE/DEBUG:/app/DEBUG -p 3000:80 ghcr.io/rss-bridge/rss-bridge:latest
|
|
- name: Start Docker - PR
|
|
run: |
|
|
docker build -t prbuild .;
|
|
docker run -d -v $GITHUB_WORKSPACE/whitelist.txt:/app/whitelist.txt -v $GITHUB_WORKSPACE/DEBUG:/app/DEBUG -p 3001:80 prbuild
|
|
- name: Setup python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.7'
|
|
cache: 'pip'
|
|
- name: Install requirements
|
|
run: |
|
|
cd $GITHUB_WORKSPACE
|
|
pip install -r requirements.txt
|
|
- name: Run bridge tests
|
|
id: testrun
|
|
run: |
|
|
mkdir results;
|
|
python prtester.py;
|
|
body="$(cat comment.txt)";
|
|
body="${body//'%'/'%25'}";
|
|
body="${body//$'\n'/'%0A'}";
|
|
body="${body//$'\r'/'%0D'}";
|
|
echo "bodylength=${#body}" >> $GITHUB_OUTPUT
|
|
- name: Find Comment
|
|
if: ${{ steps.testrun.outputs.bodylength > 130 }}
|
|
uses: peter-evans/find-comment@v2
|
|
id: fc
|
|
with:
|
|
issue-number: ${{ github.event.pull_request.number }}
|
|
comment-author: 'github-actions[bot]'
|
|
body-includes: Pull request artifacts
|
|
- name: Create or update comment
|
|
if: ${{ steps.testrun.outputs.bodylength > 130 }}
|
|
uses: peter-evans/create-or-update-comment@v2
|
|
with:
|
|
comment-id: ${{ steps.fc.outputs.comment-id }}
|
|
issue-number: ${{ github.event.pull_request.number }}
|
|
body-file: comment.txt
|
|
edit-mode: replace
|