Bridge status overview #88
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Bridge status overview | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: 0 0 * * 4 | |
jobs: | |
init: | |
name: Initialization | |
runs-on: ubuntu-latest | |
outputs: | |
WITH_UPLOAD: ${{ steps.check_upload.outputs.WITH_UPLOAD }} | |
steps: | |
- name: "Check upload token secret RSSTESTER_ACTION is set" | |
id: check_upload | |
run: | | |
echo "WITH_UPLOAD=$([ -n "${{ secrets.RSSTESTER_ACTION }}" ] && echo "true" || echo "false")" >> "$GITHUB_OUTPUT" | |
update-comment: | |
name: Update comment | |
runs-on: ubuntu-latest | |
env: | |
PYTHONUNBUFFERED: 1 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup environment | |
run: |- | |
cp .github/prtester-requirements.txt requirements.txt | |
- name: Build docker image | |
run: |- | |
docker build --tag rssbridge . | |
- name: Run docker image | |
run: |- | |
docker run --detach --env RSSBRIDGE_system_enabled_bridges=* --env RSSBRIDGE_system_enable_debug_mode=true --publish 3000:80 rssbridge | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.13' | |
cache: 'pip' | |
- name: Install python requirements | |
run: |- | |
pip install --requirement requirements.txt | |
- name: Run prtester.py | |
run: |- | |
python .github/prtester.py \ | |
--title "${{ vars.OVERVIEW_ISSUE_COMMENT_TITLE }}" \ | |
--instances "http://localhost:3000" \ | |
--reduced-artifacts \ | |
--artifacts-base-url "https://${{ github.repository_owner }}.github.io/${{ vars.ARTIFACTS_REPO || 'rss-bridge-tests' }}/status" \ | |
--output-file "comment.md" | |
sed -E 's/(${{ vars.OVERVIEW_ISSUE_COMMENT_TITLE }})/\1 (failed only)/g' comment.md | sed '/✔️/d' > comment_failed.md | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifacts | |
path: | | |
comment.md | |
*.html | |
if-no-files-found: error | |
- name: Find comment | |
uses: peter-evans/find-comment@v3 | |
id: find_comment | |
with: | |
issue-number: ${{ vars.OVERVIEW_ISSUE_ID }} | |
comment-author: 'github-actions[bot]' | |
body-includes: ${{ vars.OVERVIEW_ISSUE_COMMENT_TITLE }} | |
- name: Update comment | |
uses: peter-evans/create-or-update-comment@v4 | |
with: | |
issue-number: ${{ vars.OVERVIEW_ISSUE_ID }} | |
comment-id: ${{ steps.find_comment.outputs.comment-id }} | |
body-file: comment_failed.md | |
edit-mode: replace | |
upload-artifacts: | |
name: Upload artifacts | |
runs-on: ubuntu-latest | |
needs: | |
- init | |
- update-comment | |
if: needs.init.outputs.WITH_UPLOAD == 'true' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
repository: "${{ github.repository_owner }}/${{ vars.ARTIFACTS_REPO || 'rss-bridge-tests' }}" | |
ref: 'main' | |
token: ${{ secrets.RSSTESTER_ACTION }} | |
- name: Setup git config | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "<>" | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: artifacts | |
- name: Move artifacts | |
run: | | |
mv ./comment.md ./README.md | |
DIRECTORY="$GITHUB_WORKSPACE/status" | |
rm -rf $DIRECTORY | |
mkdir -p $DIRECTORY | |
cd $DIRECTORY | |
cp $GITHUB_WORKSPACE/README.md ./README.md | |
mv $GITHUB_WORKSPACE/*.html . | |
- name: Commit and push artifacts | |
run: | | |
export COMMIT_MESSAGE="Updated status artifacts" | |
git add . | |
git commit -m "$COMMIT_MESSAGE" || exit 0 | |
git push | |
- name: Delete artifacts | |
uses: geekyeggo/delete-artifact@v5 | |
with: | |
name: artifacts | |
failOnError: false |