mirror of
https://github.com/jaypyles/Scraperr.git
synced 2026-05-04 00:10:44 +00:00
73 lines
1.8 KiB
YAML
73 lines
1.8 KiB
YAML
name: Reusable PR Tests
|
|
|
|
on:
|
|
workflow_call:
|
|
secrets:
|
|
openai_key:
|
|
required: true
|
|
discord_webhook_url:
|
|
required: true
|
|
|
|
|
|
jobs:
|
|
unit-tests:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set env
|
|
run: echo "ENV=test" >> $GITHUB_ENV
|
|
|
|
- name: Install pdm
|
|
run: pip install pdm
|
|
|
|
- name: Install project dependencies
|
|
run: pdm install
|
|
|
|
- name: Install playwright
|
|
run: pdm run playwright install
|
|
|
|
- name: Run tests
|
|
run: PYTHONPATH=. pdm run pytest -v -ra api/backend/tests
|
|
|
|
cypress-tests:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Run Cypress Tests
|
|
id: run-tests
|
|
uses: ./.github/actions/run-cypress-tests
|
|
with:
|
|
openai_key: ${{ secrets.OPENAI_KEY }}
|
|
continue-on-error: true
|
|
|
|
- name: Check container logs on failure
|
|
if: steps.run-tests.outcome == 'failure'
|
|
run: |
|
|
echo "Cypress tests failed. Dumping container logs..."
|
|
docker logs scraperr_api || true
|
|
|
|
- name: Fail job if Cypress failed
|
|
if: steps.run-tests.outcome == 'failure'
|
|
run: exit 1
|
|
|
|
success-message:
|
|
runs-on: ubuntu-latest
|
|
needs:
|
|
- unit-tests
|
|
- cypress-tests
|
|
steps:
|
|
- name: Send Discord Message
|
|
uses: jaypyles/discord-webhook-action@v1.0.0
|
|
with:
|
|
webhook-url: ${{ secrets.discord_webhook_url }}
|
|
content: "Scraperr Successfully Passed Tests"
|
|
username: "Scraperr CI"
|
|
embed-title: "✅ Deployment Status"
|
|
embed-description: "Scraperr successfully passed all tests."
|
|
embed-color: 3066993
|
|
embed-footer-text: "Scraperr CI"
|
|
embed-timestamp: ${{ github.event.head_commit.timestamp }}
|