Skip to content

API Tests - Bruno #3432

API Tests - Bruno

API Tests - Bruno #3432

# This workflow runs the API tests for the bruno application on the latest version of Ubuntu
name: API Tests - Bruno
on:
schedule:
# every hour at minute 0 (UTC)
- cron: "0 * * * *" # TODO uncomment after tests are stable
workflow_dispatch:
permissions:
contents: read
actions: read
checks: write
jobs:
run_bruno_api_test:
name: API Tests by Bruno
runs-on: ubuntu-latest
steps:
- name: Generate timestamp
id: timestamp
run: echo "value=$(date -u '+%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT
- uses: actions/checkout@v4
- name: Install dependencies and run tests
run: |
cd bruno
npm install
npm run test:ci
- name: Publish Test Report
uses: dorny/test-reporter@v2
if: ${{ success() || failure() }} # run this step even if previous step failed
with:
name: Bruno API Tests ${{ steps.timestamp.outputs.value }} # Name of the check run which will be created
path: bruno/report.xml # Path to test results
reporter: java-junit # Format of test results
- name: Notify Slack on failure
if: ${{ failure() }}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
run: |
payload=$(cat << 'EOF'
{
"text": "Bruno API Tests failed",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Bruno API Tests failed* in `${{ github.repository }}` on branch `${{ github.ref_name }}` by `${{ github.actor }}`"
}
},
{
"type": "section",
"fields": [
{ "type": "mrkdwn", "text": "*Workflow:*\n${{ github.workflow }}" },
{ "type": "mrkdwn", "text": "*Run ID:*\n${{ github.run_id }}" },
{ "type": "mrkdwn", "text": "*Commit:*\n${{ github.sha }}" }
]
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View run>"
}
},
]
}
EOF
)
curl -X POST -H 'Content-type: application/json' --data "$payload" "$SLACK_WEBHOOK_URL"