2022-03-25 18:56:38 +03:00
|
|
|
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@v2.3.2
|
|
|
|
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}};
|
2022-03-25 21:38:26 +03:00
|
|
|
wget -O requirements.txt https://raw.githubusercontent.com/RSS-Bridge/rss-bridge/master/.github/prtester-requirements.txt;
|
2022-03-25 21:31:11 +03:00
|
|
|
wget https://raw.githubusercontent.com/RSS-Bridge/rss-bridge/master/.github/prtester.py;
|
2022-03-25 18:56:38 +03:00
|
|
|
wget https://patch-diff.githubusercontent.com/raw/$GITHUB_REPOSITORY/pull/$PR.patch;
|
2022-03-25 21:56:17 +03:00
|
|
|
touch DEBUG;
|
2022-03-25 18:56:38 +03:00
|
|
|
cat $PR.patch | grep " bridges/.*\.php" | sed "s= bridges/\(.*\)Bridge.php.*=\1=g" | sort | uniq > whitelist.txt
|
|
|
|
- name: Start Docker - Current
|
|
|
|
run: |
|
2022-03-25 21:56:17 +03:00
|
|
|
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
|
2022-03-25 18:56:38 +03:00
|
|
|
- name: Start Docker - PR
|
|
|
|
run: |
|
|
|
|
docker build -t prbuild .;
|
2022-03-25 21:56:17 +03:00
|
|
|
docker run -d -v $GITHUB_WORKSPACE/whitelist.txt:/app/whitelist.txt -v $GITHUB_WORKSPACE/DEBUG:/app/DEBUG -p 3001:80 prbuild
|
2022-03-25 18:56:38 +03:00
|
|
|
- name: Setup python
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: '3.7'
|
|
|
|
cache: 'pip'
|
|
|
|
- name: Install requirements
|
|
|
|
run: |
|
|
|
|
cd $GITHUB_WORKSPACE
|
|
|
|
pip install -r requirements.txt
|
|
|
|
- name: Run bridge tests
|
|
|
|
run: |
|
|
|
|
mkdir results;
|
|
|
|
python prtester.py
|
|
|
|
- name: Find result files
|
|
|
|
uses: tj-actions/glob@v7.10
|
|
|
|
id: artifacts
|
|
|
|
with:
|
|
|
|
files: |
|
|
|
|
./results/*.html
|
|
|
|
- name: Upload results to PR
|
|
|
|
uses: yamanq/pull-request-artifacts@v1.3.1
|
|
|
|
with:
|
|
|
|
commit: ${{ github.event.pull_request.head.sha }}
|
|
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
artifacts-branch: artifacts
|
|
|
|
artifacts-prefix-url: "https://htmlpreview.github.io/?"
|
|
|
|
artifacts: |
|
2022-03-25 21:38:26 +03:00
|
|
|
${{ steps.artifacts.outputs.paths }}
|