diff --git a/.github/workflows/test_common.yml b/.github/workflows/test_common.yml index 20b97855a..2160d5147 100644 --- a/.github/workflows/test_common.yml +++ b/.github/workflows/test_common.yml @@ -32,18 +32,18 @@ env: RLN_CREDENTIALS: ${{ secrets.RLN_CREDENTIALS }} jobs: - tests: name: tests strategy: fail-fast: false matrix: shard: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17] - # total number of shards =18 means tests will split into 18 thread and run in parallel to increase execution speed - # command for sharding : - # pytest --shard-id= --num-shards= - # shard 16 for test_rln.py file as they shall run sequentially - # shard 17 for test_cursor_many_msgs.py as it takes time >7 mins + # total number of shards =18 means tests will split into 18 thread and run in parallel to increase execution speed + # command for sharding : + # pytest --shard-id= --num-shards= + # shard 16 for test_rln.py file as they shall run sequentially + # shard 17 for test_cursor_many_msgs.py as it takes time >7 mins + runs-on: ubuntu-latest timeout-minutes: 120 outputs: @@ -65,79 +65,94 @@ jobs: jobResult_15: ${{ steps.set_result.outputs.JOB_RESULT_15 }} jobResult_16: ${{ steps.set_result.outputs.JOB_RESULT_16 }} jobResult_17: ${{ steps.set_result.outputs.JOB_RESULT_17 }} + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive - - uses: actions/checkout@v4 - with: - submodules: recursive + - name: Remove unwanted software + uses: ./.github/actions/prune-vm - - name: Remove unwanted software - uses: ./.github/actions/prune-vm + - uses: actions/setup-python@v4 + with: + python-version: "3.12" + cache: "pip" - - name: Debug Python import paths - run: | - pwd - echo "PYTHONPATH=$PYTHONPATH" - find . -maxdepth 5 | grep wrapper || true - python - <<'PY' - import sys - print("sys.path:") - for p in sys.path: - print(p) - try: - import wrapper - print("wrapper import OK:", wrapper) - except Exception as e: - print("wrapper import failed:", e) - PY - - - uses: actions/setup-python@v4 - with: - python-version: '3.12' - cache: 'pip' + - name: Add python bindings to PYTHONPATH + run: echo "PYTHONPATH=$(pwd)/vendor/logos-delivery-python-bindings/waku:$PYTHONPATH" >> $GITHUB_ENV - - name: Install system deps for tc / nsenter - run: | - sudo apt-get update - sudo apt-get install -y \ - util-linux \ - iproute2 \ - sudo \ - ca-certificates \ - curl + - name: Debug Python import paths + run: | + pwd + echo "PYTHONPATH=$PYTHONPATH" + find . -maxdepth 5 | grep wrapper || true + python - <<'PY' + import sys + print("sys.path:") + for p in sys.path: + print(p) + try: + import wrapper + print("wrapper import OK:", wrapper) + except Exception as e: + print("wrapper import failed:", e) + PY - - run: pip install -r requirements.txt + - name: Install system deps for tc / nsenter + run: | + sudo apt-get update + sudo apt-get install -y \ + util-linux \ + iproute2 \ + sudo \ + ca-certificates \ + curl - - name: Run tests + - run: pip install -r requirements.txt - run: | - if [ "${{ matrix.shard }}" == "16" ]; then - pytest tests/relay/test_rln.py --alluredir=allure-results-${{ matrix.shard }} - elif [ "${{ matrix.shard }}" == "17" ]; then - pytest tests/store/test_cursor_many_msgs.py --alluredir=allure-results-${{ matrix.shard }} - elif [ "${{ matrix.shard }}" != "17" ]; then - pytest --ignore=tests/relay/test_rln.py --ignore=tests/store/test_cursor_many_msgs.py --reruns 2 --shard-id=${{ matrix.shard }} --num-shards=16 --alluredir=allure-results-${{ matrix.shard }} - fi + - name: Run tests + run: | + export PYTHONPATH="$(pwd)/vendor/logos-delivery-python-bindings/waku:$PYTHONPATH" - - name: Upload allure results - if: always() - uses: actions/upload-artifact@v4 - with: - name: allure-results-${{ matrix.shard }} - path: allure-results-${{ matrix.shard }} + if [ "${{ matrix.shard }}" == "16" ]; then + pytest tests/relay/test_rln.py \ + --ignore=vendor/logos-delivery-python-bindings/tests \ + --alluredir=allure-results-${{ matrix.shard }} + elif [ "${{ matrix.shard }}" == "17" ]; then + pytest tests/store/test_cursor_many_msgs.py \ + --ignore=vendor/logos-delivery-python-bindings/tests \ + --alluredir=allure-results-${{ matrix.shard }} + else + pytest \ + --ignore=vendor/logos-delivery-python-bindings/tests \ + --ignore=tests/relay/test_rln.py \ + --ignore=tests/store/test_cursor_many_msgs.py \ + --reruns 2 \ + --shard-id=${{ matrix.shard }} \ + --num-shards=16 \ + --alluredir=allure-results-${{ matrix.shard }} + fi - - name: Set job result - id: set_result - if: always() - run: | - version="${{ matrix.shard }}" - echo "JOB_RESULT_${version}=${{ job.status }}" >> "$GITHUB_OUTPUT" + - name: Upload allure results + if: always() + uses: actions/upload-artifact@v4 + with: + name: allure-results-${{ matrix.shard }} + path: allure-results-${{ matrix.shard }} + - name: Set job result + id: set_result + if: always() + run: | + version="${{ matrix.shard }}" + echo "JOB_RESULT_${version}=${{ job.status }}" >> "$GITHUB_OUTPUT" aggregate-reports: runs-on: ubuntu-latest needs: [tests] if: always() + steps: - name: Download all allure results uses: actions/download-artifact@v4 @@ -167,59 +182,55 @@ jobs: uses: peaceiris/actions-gh-pages@v3 if: always() with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_branch: gh-pages - publish_dir: allure-history - destination_dir: ${{ env.CALLER }} + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_branch: gh-pages + publish_dir: allure-history + destination_dir: ${{ env.CALLER }} - name: Store output from matrix jobs run: | - echo '${{ toJSON(needs.tests.outputs) }}' > results.json + echo '${{ toJSON(needs.tests.outputs) }}' > results.json - name: Create job summary if: always() run: | - echo "## Run Information" >> $GITHUB_STEP_SUMMARY - echo "- **Event**: ${{ github.event_name }}" >> $GITHUB_STEP_SUMMARY - echo "- **Actor**: ${{ github.actor }}" >> $GITHUB_STEP_SUMMARY - echo "- **Node1**: ${{ env.NODE_1 }}" >> $GITHUB_STEP_SUMMARY - echo "- **Node2**: ${{ env.NODE_2 }}" >> $GITHUB_STEP_SUMMARY - echo "- **Additonal Nodes**: ${{ env.ADDITIONAL_NODES }}" >> $GITHUB_STEP_SUMMARY - echo "## Test Results" >> $GITHUB_STEP_SUMMARY - echo "Allure report will be available at: https://logos-messaging.github.io/logos-delivery-interop-tests/${{ env.CALLER }}/${{ github.run_number }}" >> $GITHUB_STEP_SUMMARY - - # Evaluate overall result - TESTS_RESULT="success" - for key in $(jq -r 'keys[]' results.json); do - result=$(jq -r --arg key "$key" '.[$key]' results.json) - echo "Key: $key, Value: $result" - # Check condition on the result - if [ "$result" != "success" ]; then - echo "Value 'success' not found at key: $key" - TESTS_RESULT="failure" - break - fi - done - - # Notify Waku team - if [ "$TESTS_RESULT" != "success" ]; then - echo "There are failures with nwaku node. cc <@&1111608257824440330>" >> $GITHUB_STEP_SUMMARY + echo "## Run Information" >> $GITHUB_STEP_SUMMARY + echo "- **Event**: ${{ github.event_name }}" >> $GITHUB_STEP_SUMMARY + echo "- **Actor**: ${{ github.actor }}" >> $GITHUB_STEP_SUMMARY + echo "- **Node1**: ${{ env.NODE_1 }}" >> $GITHUB_STEP_SUMMARY + echo "- **Node2**: ${{ env.NODE_2 }}" >> $GITHUB_STEP_SUMMARY + echo "- **Additonal Nodes**: ${{ env.ADDITIONAL_NODES }}" >> $GITHUB_STEP_SUMMARY + echo "## Test Results" >> $GITHUB_STEP_SUMMARY + echo "Allure report will be available at: https://logos-messaging.github.io/logos-delivery-interop-tests/${{ env.CALLER }}/${{ github.run_number }}" >> $GITHUB_STEP_SUMMARY + + TESTS_RESULT="success" + for key in $(jq -r 'keys[]' results.json); do + result=$(jq -r --arg key "$key" '.[$key]' results.json) + echo "Key: $key, Value: $result" + if [ "$result" != "success" ]; then + echo "Value 'success' not found at key: $key" + TESTS_RESULT="failure" + break fi - - # Write result and summary to ENV - echo "TESTS_RESULT=$TESTS_RESULT" >> $GITHUB_ENV - { - echo 'JOB_SUMMARY<> $GITHUB_ENV + done + + if [ "$TESTS_RESULT" != "success" ]; then + echo "There are failures with nwaku node. cc <@&1111608257824440330>" >> $GITHUB_STEP_SUMMARY + fi + + echo "TESTS_RESULT=$TESTS_RESULT" >> $GITHUB_ENV + { + echo 'JOB_SUMMARY<> $GITHUB_ENV - name: Send report to Discord uses: rjstone/discord-webhook-notify@v1 if: always() && env.CALLER != 'manual' with: - severity: ${{ env.TESTS_RESULT == 'success' && 'info' || 'error' }} - username: ${{ github.workflow }} - description: "## Job Result: ${{ env.TESTS_RESULT }}" - details: ${{ env.JOB_SUMMARY }} - webhookUrl: ${{ secrets.DISCORD_TEST_REPORTS_WH }} \ No newline at end of file + severity: ${{ env.TESTS_RESULT == 'success' && 'info' || 'error' }} + username: ${{ github.workflow }} + description: "## Job Result: ${{ env.TESTS_RESULT }}" + details: ${{ env.JOB_SUMMARY }} + webhookUrl: ${{ secrets.DISCORD_TEST_REPORTS_WH }} \ No newline at end of file