From 5d306f981a0ed0e7dba16a13bc95459a3c7d5aa5 Mon Sep 17 00:00:00 2001 From: Jerry Date: Sun, 20 Feb 2022 00:47:37 -0800 Subject: [PATCH] Add continuous integration to Github workflow --- .github/workflows/main.yml | 23 +++++++++++++++++++++-- integration-test/run_node.sh | 2 ++ integration-test/run_tests.sh | 11 ++++++++++- integration-test/test/test_mint_nft.py | 2 +- 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 307007ee..db18f8fa 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,7 +5,7 @@ on: branches: ["main"] pull_request: branches: ["main"] - types: [opened, reopened, synchronize] + types: [opened, reopened, edited, synchronize] jobs: build: @@ -36,4 +36,23 @@ jobs: - name: "Upload coverage to Codecov" uses: codecov/codecov-action@v2 with: - fail_ci_if_error: true \ No newline at end of file + fail_ci_if_error: true + + continuous-integration: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ ubuntu-latest] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Python Poetry Action + uses: abatilo/actions-poetry@v2.1.3 + + - name: Run integration tests + run: | + cd integration-test && ./run_tests.sh diff --git a/integration-test/run_node.sh b/integration-test/run_node.sh index 02003fec..44fb6a75 100755 --- a/integration-test/run_node.sh +++ b/integration-test/run_node.sh @@ -2,6 +2,8 @@ if [ "$NETWORK" = "local-alonzo" ] then + chmod 400 /code/tmp_configs/"$NETWORK"/shelley/*.skey + chmod 400 /code/tmp_configs/"$NETWORK"/shelley/*.vkey cardano-node run \ --config /code/tmp_configs/"$NETWORK"/config.json \ --topology /code/tmp_configs/"$NETWORK"/topology.json \ diff --git a/integration-test/run_tests.sh b/integration-test/run_tests.sh index 142a2150..bf1920cf 100755 --- a/integration-test/run_tests.sh +++ b/integration-test/run_tests.sh @@ -1,4 +1,7 @@ -#!/bin/sh +#!/bin/bash + +set -e +set -o pipefail ROOT=$(pwd) @@ -6,9 +9,15 @@ poetry install # Run alonzo integration tests ./bootstrap.sh local-alonzo + +# Cleanup containers and volumes in case there is any running +docker-compose down --volume + +# Launch containers docker-compose up -d export PAYMENT_KEY="$ROOT"/configs/local-alonzo/shelley/utxo-keys/utxo1.skey poetry run pytest -s "$ROOT"/test +# Cleanup docker-compose down --volume diff --git a/integration-test/test/test_mint_nft.py b/integration-test/test/test_mint_nft.py index dabb7e0d..222d8628 100644 --- a/integration-test/test/test_mint_nft.py +++ b/integration-test/test/test_mint_nft.py @@ -19,7 +19,7 @@ class TestMintNFT: chain_context = OgmiosChainContext(OGMIOS_WS, Network.TESTNET) - @retry(tries=5, delay=2) + @retry(tries=10, delay=6) def check_ogmios(self): print(f"Current chain tip: {self.chain_context.last_block_slot}")