Skip to content

firewatch-tests

firewatch-tests #29

Workflow file for this run

name: firewatch-tests
on:
workflow_dispatch:
inputs:
environment:
type: choice
description: Environment where to run tests
required: true
options:
- devnet
- testnet
- mainnet
schedule:
- cron: '0 8 * * 1,4'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
id-token: write
contents: read
jobs:
initial:
name: Initial
runs-on: ubuntu-latest
timeout-minutes: 1
outputs:
TAG: ${{ steps.env-vars.outputs.TAG }}
NOW: ${{ steps.env-vars.outputs.NOW }}
ENV: ${{ steps.env-vars.outputs.ENV }}
steps:
- name: Defining global vars
id: env-vars
shell: bash
run: |
echo "TAG=${GITHUB_SHA:0:8}" >> $GITHUB_OUTPUT
echo "NOW=$(TZ=':Europe/Madrid' date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_OUTPUT
# Si es manual -> usa el input, si es schedule -> ejecutará todos los entornos
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "ENV=${{ github.event.inputs.environment }}" >> $GITHUB_OUTPUT
else
echo "ENV=all" >> $GITHUB_OUTPUT
fi
- name: Repository checkout
uses: actions/checkout@v4
- name: 📬 Initial Slack deployment message
shell: bash
env:
ENV: ${{ steps.env-vars.outputs.ENV }}
TAG: ${{ steps.env-vars.outputs.TAG }}
NOW: ${{ steps.env-vars.outputs.NOW }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
run: |
echo "Send initial Slack message"
curl -X POST -H 'Content-type: application/json' \
--data "{\"text\":\"🎬 Starting *FIREWATCH-TESTS* in *${ENV}* - Commit: <https://github.com/xrplevm/firewatch/commit/${TAG}|${TAG}> by ${GITHUB_ACTOR}\"}" \
${SLACK_WEBHOOK_URL}
tests:
name: Tests
runs-on: ubuntu-latest
timeout-minutes: 20
needs: [initial]
strategy:
fail-fast: false
matrix:
environment: [devnet, testnet, mainnet]
module: [axelar, cosmos, evm]
steps:
- name: Repository checkout
uses: actions/checkout@v4
- name: Setup PNPM
uses: pnpm/action-setup@v4
with:
version: 9.7.0
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run ${{ matrix.module }} tests for ${{ matrix.environment }}
if: ${{ github.event_name == 'schedule' || matrix.environment == needs.initial.outputs.ENV }}
shell: bash
run: |
echo "🧪 Running tests for ${{ matrix.module }} in ${{ matrix.environment }}"
pnpm run test:${{ matrix.module }}:${{ matrix.environment }} || echo "⚠️ ${{ matrix.module }}:${{ matrix.environment }} failed"
- name: Failure job notification
if: ${{ failure() || cancelled() }}
shell: bash
env:
ENV: ${{ needs.initial.outputs.ENV }}
TAG: ${{ needs.initial.outputs.TAG }}
NOW: ${{ needs.initial.outputs.NOW }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
run: |
STATUS="${{ job.status }}"
echo "Send error Slack message"
curl -X POST -H 'Content-type: application/json' \
--data "{\"text\":\"❌ *FIREWATCH-TESTS* ${GITHUB_JOB} job *${STATUS^^}*. Check logs <https://github.com/xrplevm/firewatch/actions/runs/${GITHUB_RUN_ID}|here> - Commit: <https://github.com/xrplevm/firewatch/commit/${TAG}|${TAG}> by ${GITHUB_ACTOR}\"}" \
${SLACK_WEBHOOK_URL}
final:
name: 🏁 Final
runs-on: ubuntu-latest
timeout-minutes: 1
needs: [initial, tests]
if: |
always() &&
!contains(join(needs.*.result, ','), 'failure') &&
!contains(join(needs.*.result, ','), 'cancelled')
steps:
- name: 📬 Final Slack deployment message
shell: bash
env:
ENV: ${{ needs.initial.outputs.ENV }}
TAG: ${{ needs.initial.outputs.TAG }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
run: |
echo "Send final Slack message"
curl -X POST -H 'Content-type: application/json' \
--data "{\"text\":\"🏁 *FIREWATCH-TESTS* in *${ENV}* *SUCCESSFULLY* - Commit: <https://github.com/xrplevm/firewatch/commit/${TAG}|${TAG}> by ${GITHUB_ACTOR}\"}" \
${SLACK_WEBHOOK_URL}