Run merge tests for PR 2155 by @tudor-malene #150
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Builds a local testnet and runs a set of merge tests | |
# | |
name: '[locally] Run merge tests' | |
run-name: Run merge tests for PR ${{ github.event.client_payload.number }} by @${{ github.event.client_payload.owner }} | |
on: | |
repository_dispatch: | |
types: [merged_pull_request] | |
jobs: | |
test-run: | |
runs-on: [self-hosted, Linux, X64, ten-test-gh-runner-01] | |
steps: | |
- name: 'Map IDs for ObscuroLabs' | |
uses: kanga333/variable-mapper@master | |
with: | |
key: "${{ github.event.client_payload.owner }}" | |
map: | | |
{ | |
"StefanIliev545": { | |
"discord_id": "1034771491436363797" | |
}, | |
"BedrockSquirrel": { | |
"discord_id": "92361563276591104" | |
}, | |
"moraygrieve": { | |
"discord_id": "814873419207409685" | |
}, | |
"tudor-malene": { | |
"discord_id": "921049923414261821" | |
}, | |
"zkokelj": { | |
"discord_id": "639076633994592256" | |
}, | |
"badgersrus": { | |
"discord_id": "920586981581393983" | |
}, | |
"Jennievon": { | |
"discord_id": "902910727948492840" | |
}, | |
"pkrishnath": { | |
"discord_id": "1275573709910052947" | |
}, | |
".*": { | |
"discord_id": "814873419207409685" | |
} | |
} | |
- name: 'Check out ten-test' | |
uses: actions/checkout@v3 | |
with: | |
path: ./ten-test | |
- name: 'Check out go-ten code' | |
uses: actions/checkout@v3 | |
with: | |
repository: ten-protocol/go-ten | |
path: ./go-ten | |
- name: 'Docker clean containers and images before the test' | |
run: | | |
for i in `docker ps -a | awk '{ print $1 } ' | grep -v CONTAINER`; do docker stop $i && docker rm $i; done | |
docker system prune -af --volumes | |
for i in `docker volume ls --filter dangling=true -q`; do docker volume rm $i; done | |
- name: 'Build docker containers' | |
run: | | |
cd ${{ github.workspace }}/go-ten/testnet | |
./testnet-local-build_images.sh | |
- name: 'Start up testnet' | |
run: | | |
cd ${{ github.workspace }}/go-ten/ | |
go run ./testnet/launcher/cmd | |
- name: 'Collect container logs' | |
if: always() | |
run: | | |
echo "Run docker container log background processes" | |
cd ${{ github.workspace }}/go-ten/ | |
docker logs -f `docker ps -aqf "name=validator-host"` > validator-host.out 2>&1 & | |
docker logs -f `docker ps -aqf "name=validator-enclave"` > validator-enclave.out 2>&1 & | |
docker logs -f `docker ps -aqf "name=sequencer-host"` > sequencer-host.out 2>&1 & | |
docker logs -f `docker ps -aqf "name=sequencer-enclave"` > sequencer-enclave.out 2>&1 & | |
docker logs -f `docker ps -aqf "name=eth2network"` > eth2network.out 2>&1 & | |
docker logs -f `docker ps -aqf "name=gateway"` > gateway.out 2>&1 & | |
- name: 'Build required artifacts for running tests' | |
run: | | |
cd ${{ github.workspace }}/ten-test | |
./get_artifacts.sh | |
- name: 'Do a persistence reset for nonce and contracts' | |
run: | | |
cd ${{ github.workspace }}/ten-test/admin | |
/usr/local/bin/pysys.py run -m ten.local persistence_reset | |
- name: 'Run tests' | |
run: | | |
cd ${{ github.workspace }}/ten-test/tests | |
/usr/local/bin/pysys.py run -m ten.local -r -e skip -e persistence -e performance -e robustness | |
- name: 'Discord notification' | |
if: success() | |
uses: sarisia/actions-status-discord@v1 | |
with: | |
webhook: ${{ secrets.CONT_INT_WEBHOOK }} | |
title: "Merge tests for PR ${{ github.event.client_payload.number }} by @${{ github.event.client_payload.owner }} passed" | |
description: "Local testnet tests on PR merge" | |
avatar_url: ${{ secrets.AVATAR_URL }} | |
- name: 'Discord notification' | |
if: failure() | |
uses: sarisia/actions-status-discord@v1 | |
with: | |
webhook: ${{ secrets.CONT_INT_WEBHOOK }} | |
title: "Merge tests for PR ${{ github.event.client_payload.number }} by @${{ github.event.client_payload.owner }} failed" | |
description: "Local testnet tests on PR merge" | |
content: "Please investigate <@${{ env.discord_id }}>" | |
avatar_url: ${{ secrets.AVATAR_URL }} | |
- name: 'Upload testcase output' | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: test-artifact | |
path: | | |
${{ github.workspace }}/ten-test/**/Output | |
!${{ github.workspace }}/ten-test/**/node_modules | |
retention-days: 1 | |
- name: 'Get the gateway logs' | |
if: failure() | |
run: | | |
cd ${{ github.workspace }}/go-ten/ | |
docker container cp `docker ps -aqf "name=gateway"`:/gateway_logs.log gateway_logs.out | |
- name: 'Upload container logs' | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
continue-on-error: true | |
with: | |
name: container-artifact | |
path: | | |
${{ github.workspace }}/go-ten/*.out | |
retention-days: 1 | |
- name: 'Docker clean containers and images after the test' | |
if: always() | |
run: | | |
for i in `docker ps -a | awk '{ print $1 } ' | grep -v CONTAINER`; do docker stop $i && docker rm $i; done | |
docker system prune -af --volumes | |
for i in `docker volume ls --filter dangling=true -q`; do docker volume rm $i; done |