|
| 1 | +name: CCIP TON Testnet Monitor |
| 2 | +permissions: |
| 3 | + contents: read |
| 4 | + |
| 5 | +on: |
| 6 | + schedule: |
| 7 | + # Runs at minute 0, 15, 30, and 45 of every hour |
| 8 | + - cron: "*/15 * * * *" |
| 9 | + |
| 10 | + workflow_dispatch: # Manual trigger from GitHub Actions UI |
| 11 | + |
| 12 | + pull_request: |
| 13 | + types: [opened, synchronize, reopened, labeled] |
| 14 | + branches: |
| 15 | + - main |
| 16 | + |
| 17 | +jobs: |
| 18 | + ccip-monitor-tests: |
| 19 | + # Toggle via CCIP_TESTNET_MONITOR_ENABLED variable (set to 'false' to disable) |
| 20 | + # Manual triggers (workflow_dispatch) always run regardless of toggle |
| 21 | + if: | |
| 22 | + github.event_name == 'workflow_dispatch' || |
| 23 | + (vars.CCIP_TESTNET_MONITOR_ENABLED != 'false' && ( |
| 24 | + github.event_name == 'schedule' || |
| 25 | + (github.event_name == 'pull_request' && |
| 26 | + contains(github.event.pull_request.labels.*.name, 'run-testnet-monitor-test')) |
| 27 | + )) |
| 28 | + runs-on: ubuntu-latest |
| 29 | + strategy: |
| 30 | + fail-fast: false |
| 31 | + matrix: |
| 32 | + test: |
| 33 | + # Note: add more tests here, see staging-monitor/cmd/run-test/main.go and staging-monitor/README.md |
| 34 | + - ton2evm-messaging |
| 35 | + - evm2ton-messaging |
| 36 | + env: |
| 37 | + TON_TESTNET_SELECTOR: ${{ vars.TON_TESTNET_SELECTOR }} |
| 38 | + ETHEREUM_TESTNET_SEPOLIA_SELECTOR: ${{ vars.ETHEREUM_TESTNET_SEPOLIA_SELECTOR }} |
| 39 | + TON_TESTNET_ROUTER: ${{ secrets.TON_TESTNET_ROUTER }} |
| 40 | + TON_TESTNET_FEE_QUOTER: ${{ secrets.TON_TESTNET_FEE_QUOTER }} |
| 41 | + TON_TESTNET_RECEIVER: ${{ secrets.TON_TESTNET_RECEIVER }} |
| 42 | + TON_TESTNET_WALLET_KEY: ${{ secrets.TON_TESTNET_WALLET_KEY }} |
| 43 | + TON_TESTNET_ENDPOINT: ${{ secrets.STAGING_TON_TESTNET_ENDPOINT }} |
| 44 | + ETHEREUM_TESTNET_SEPOLIA_ROUTER: ${{ secrets.ETHEREUM_TESTNET_SEPOLIA_ROUTER }} |
| 45 | + ETHEREUM_TESTNET_SEPOLIA_RECEIVER: ${{ secrets.ETHEREUM_TESTNET_SEPOLIA_RECEIVER }} |
| 46 | + ETHEREUM_TESTNET_SEPOLIA_WALLET_KEY: ${{ secrets.ETHEREUM_TESTNET_SEPOLIA_WALLET_KEY }} |
| 47 | + ETHEREUM_TESTNET_SEPOLIA_ENDPOINT: ${{ secrets.STAGING_ETHEREUM_TESTNET_SEPOLIA_ENDPOINT }} |
| 48 | + MESSAGE: "ccip-testnet-${{ github.run_id }}" |
| 49 | + RUN_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" |
| 50 | + TRIGGER: "${{ github.event_name }}" |
| 51 | + WHEN: "${{ github.run_started_at }}" # ISO8601 |
| 52 | + steps: |
| 53 | + - name: Check out code |
| 54 | + uses: actions/checkout@v5 |
| 55 | + |
| 56 | + - name: Install Nix |
| 57 | + uses: cachix/install-nix-action@02a151ada4993995686f9ed4f1be7cfbb229e56f # v31 |
| 58 | + with: |
| 59 | + nix_path: nixpkgs=channel:nixos-unstable |
| 60 | + |
| 61 | + - name: Run ${{ matrix.test }} test |
| 62 | + id: test |
| 63 | + continue-on-error: true |
| 64 | + run: | |
| 65 | + cd staging-monitor |
| 66 | + nix develop -c go run ./cmd/run-test -case ${{ matrix.test }} |
| 67 | +
|
| 68 | + - name: Send Slack notification |
| 69 | + if: always() |
| 70 | + env: |
| 71 | + SLACK_WEBHOOK_URL: ${{ secrets.STAGING_TEST_SLACK_WEBHOOK }} |
| 72 | + run: | |
| 73 | + cd staging-monitor |
| 74 | + nix develop -c go run ./cmd/send-slack -webhook-url="$SLACK_WEBHOOK_URL" -environment Prod-Testnet |
| 75 | +
|
| 76 | + - name: Fail job if test failed |
| 77 | + if: always() |
| 78 | + run: | |
| 79 | + cd staging-monitor |
| 80 | + STATUS=$(jq -r '.status' result.json) |
| 81 | + if [[ "$STATUS" != "success" ]]; then |
| 82 | + echo "Test failed with status: $STATUS" |
| 83 | + exit 1 |
| 84 | + fi |
0 commit comments