add flag workflow_call: for reusable workflow

This commit is contained in:
aya 2024-12-04 13:54:41 +02:00
parent e9bf24efa4
commit 164b8ce3c2
2 changed files with 79 additions and 37 deletions

View File

@ -8,13 +8,14 @@ on:
schedule: schedule:
- cron: '0 4 * * *' - cron: '0 4 * * *'
workflow_dispatch: workflow_dispatch:
workflow_call:
env:
QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }}
QUAY_USER: ${{ secrets.QUAY_USER }}
jobs: jobs:
test-common: test-common:
uses: waku-org/nwaku/.github/workflows/container-image.yml@master uses: ./.github/workflows/test_common.yml
secrets: inherit secrets: inherit
with:
node1: "wakuorg/nwaku:latest"
node2: "wakuorg/nwaku:latest"
additional_nodes: "wakuorg/nwaku:latest,wakuorg/nwaku:latest,wakuorg/nwaku:latest"
caller: "nim"

View File

@ -1,3 +1,4 @@
name: Interop Tests Common name: Interop Tests Common
on: on:
@ -39,37 +40,77 @@ jobs:
timeout-minutes: 120 timeout-minutes: 120
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with:
repository: waku-org/waku-interop-tests
- uses: actions/setup-python@v4 - uses: actions/setup-python@v4
with: with:
python-version: '3.12'
cache: 'pip'
- run: pip install -r requirements.txt
- name: Run tests python-version: '3.12'
run: | cache: 'pip'
pytest -m 'smoke' -n 4 --dist loadgroup --reruns 2 --alluredir=allure-result
- name: Create job summary - run: pip install -r requirements.txt
if: always()
env: - name: Run tests
JOB_STATUS: ${{ job.status }} run: |
run: | pytest -m 'smoke' -n 4 --dist loadgroup --reruns 2 --alluredir=allure-result
echo "## Run Information" >> $GITHUB_STEP_SUMMARY
echo "- **Event**: ${{ github.event_name }}" >> $GITHUB_STEP_SUMMARY - name: Get allure history
echo "- **Actor**: ${{ github.actor }}" >> $GITHUB_STEP_SUMMARY if: always()
echo "- **Node1**: ${{ env.NODE_1 }}" >> $GITHUB_STEP_SUMMARY uses: actions/checkout@v4
echo "- **Node2**: ${{ env.NODE_2 }}" >> $GITHUB_STEP_SUMMARY with:
echo "- **Additonal Nodes**: ${{ env.ADDITIONAL_NODES }}" >> $GITHUB_STEP_SUMMARY ref: gh-pages
echo "## Test Results" >> $GITHUB_STEP_SUMMARY path: gh-pages
echo "Allure report will be available at: https://waku-org.github.io/waku-interop-tests/${{ env.CALLER }}/${{ github.run_number }}" >> $GITHUB_STEP_SUMMARY
if [ "$JOB_STATUS" != "success" ]; then - name: Setup allure report
echo "There are failures with nwaku node. cc <@&1111608257824440330>" >> $GITHUB_STEP_SUMMARY uses: simple-elf/allure-report-action@master
fi if: always()
{ id: allure-report
echo 'JOB_SUMMARY<<EOF' with:
cat $GITHUB_STEP_SUMMARY allure_results: allure-results
echo EOF gh_pages: gh-pages/${{ env.CALLER }}
} >> $GITHUB_ENV allure_history: allure-history
keep_reports: 30
report_url: https://waku-org.github.io/waku-interop-tests/${{ env.CALLER }}
- name: Deploy report to Github Pages
uses: peaceiris/actions-gh-pages@v3
if: always()
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: allure-history
destination_dir: ${{ env.CALLER }}
- name: Create job summary
if: always()
env:
JOB_STATUS: ${{ job.status }}
run: |
echo "## Run Information" >> $GITHUB_STEP_SUMMARY
echo "- **Event**: ${{ github.event_name }}" >> $GITHUB_STEP_SUMMARY
echo "- **Actor**: ${{ github.actor }}" >> $GITHUB_STEP_SUMMARY
echo "- **Node1**: ${{ env.NODE_1 }}" >> $GITHUB_STEP_SUMMARY
echo "- **Node2**: ${{ env.NODE_2 }}" >> $GITHUB_STEP_SUMMARY
echo "- **Additonal Nodes**: ${{ env.ADDITIONAL_NODES }}" >> $GITHUB_STEP_SUMMARY
echo "## Test Results" >> $GITHUB_STEP_SUMMARY
echo "Allure report will be available at: https://waku-org.github.io/waku-interop-tests/${{ env.CALLER }}/${{ github.run_number }}" >> $GITHUB_STEP_SUMMARY
if [ "$JOB_STATUS" != "success" ]; then
echo "There are failures with nwaku node. cc <@&1111608257824440330>" >> $GITHUB_STEP_SUMMARY
fi
{
echo 'JOB_SUMMARY<<EOF'
cat $GITHUB_STEP_SUMMARY
echo EOF
} >> $GITHUB_ENV
- name: Send report to Discord
uses: rjstone/discord-webhook-notify@v1
if: always() && env.CALLER != 'manual'
with:
severity: ${{ job.status == 'success' && 'info' || 'error' }}
username: ${{ github.workflow }}
description: "## Job Result: ${{ job.status }}"
details: ${{ env.JOB_SUMMARY }}
webhookUrl: ${{ secrets.DISCORD_TEST_REPORTS_WH }}