S3 proxy #2048
Workflow file for this run
This file contains hidden or 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
| name: Network Tests | |
| on: | |
| merge_group: | |
| branches: [master] | |
| pull_request: | |
| workflow_dispatch: | |
| inputs: | |
| pr_number: | |
| description: "PR number to test (optional, will use current branch if not provided)" | |
| required: false | |
| type: string | |
| test_selection: | |
| description: "Which tests to run" | |
| required: false | |
| default: "all" | |
| type: choice | |
| options: | |
| - all | |
| - destroyable | |
| - ping-pong | |
| - one-to-many-internal-messages | |
| - fq-deploy | |
| - nft-index | |
| - persistent-sync | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| CARGO_TERM_COLOR: always | |
| CC: /usr/bin/clang | |
| CXX: /usr/bin/clang++ | |
| TYCHO_BUILD_PROFILE: release_check | |
| TYCHO_ARTIFACT_NAME: tycho-binary-${{ github.run_id }} | |
| RUSTFLAGS: --cfg tycho_unstable | |
| jobs: | |
| # artifact name has postfix with job id so it's unique and always fresh. | |
| # We don't delete it because 1d retention is enough. | |
| # It's faster than build node even with cache(job timed out after 30m) | |
| build-node: | |
| name: Build Tycho Binary | |
| runs-on: [self-hosted, linux] | |
| if: github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch' | |
| outputs: | |
| binary_path: ${{ steps.get_path.outputs.path }} | |
| steps: | |
| - name: Check user permissions | |
| if: github.event_name == 'workflow_dispatch' && github.event.inputs.pr_number | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| # Get user's permission level | |
| PERMISSION=$(gh api repos/${{ github.repository }}/collaborators/${{ github.actor }}/permission --jq '.permission') | |
| echo "User ${{ github.actor }} has $PERMISSION permission" | |
| if [[ "$PERMISSION" != "write" && "$PERMISSION" != "admin" ]]; then | |
| echo "::error::User ${{ github.actor }} does not have write permission" | |
| exit 1 | |
| fi | |
| - name: Checkout code | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| persist-credentials: false | |
| ref: ${{ github.event.inputs.pr_number && format('refs/pull/{0}/head', github.event.inputs.pr_number) || github.ref }} | |
| - name: Show what we're testing | |
| shell: bash | |
| run: | | |
| echo "Testing PR: ${{ github.event.inputs.pr_number || 'current branch' }}" | |
| echo "Checked out commit: $(git rev-parse HEAD)" | |
| echo "Current branch/ref: $(git describe --always --dirty)" | |
| echo "Commit message: $(git log -1 --pretty=format:'%s')" | |
| - name: Initialize Environment (for Build) | |
| uses: ./.github/actions/init | |
| with: | |
| setup-cache: true | |
| - name: Build Project | |
| shell: bash | |
| run: | | |
| echo "Building ${{ env.TYCHO_BUILD_PROFILE }} profile..." | |
| just build | |
| - name: Determine Binary Path | |
| id: get_path | |
| shell: bash | |
| run: | | |
| # This will now just echo the path since the build is done | |
| binary_path=$(./scripts/build-node.sh) | |
| echo "Binary built at: $binary_path" | |
| # Output the path relative to workspace root for artifact upload | |
| echo "path=${binary_path#${GITHUB_WORKSPACE}/}" >> $GITHUB_OUTPUT | |
| - name: Upload Tycho Binary Artifact | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
| with: | |
| name: ${{ env.TYCHO_ARTIFACT_NAME }} | |
| path: ${{ steps.get_path.outputs.path }} | |
| retention-days: 1 # Keep artifact only for 1 day | |
| network-tests: | |
| name: Network Integration Tests - ${{ matrix.test_name }} | |
| runs-on: [self-hosted, linux] | |
| needs: build-node | |
| if: github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch' | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false # Allow other tests to run even if one fails | |
| matrix: | |
| include: | |
| - test_name: destroyable | |
| test_image: ghcr.io/broxus/tycho-tests/tycho-tests-destroyable:latest | |
| test_type: container | |
| test_env: {} | |
| - test_name: ping-pong | |
| test_image: ghcr.io/broxus/tycho-tests/tycho-tests-ping-pong:latest | |
| test_type: container | |
| test_env: {} | |
| - test_name: one-to-many-internal-messages | |
| test_image: ghcr.io/broxus/tycho-tests/tycho-tests-one-to-many-internal-messages:latest | |
| test_type: container | |
| test_env: {} | |
| - test_name: fq-deploy | |
| test_image: ghcr.io/broxus/tycho-tests/tycho-tests-fq:latest | |
| test_type: container | |
| test_env: {} | |
| - test_name: nft-index | |
| test_image: ghcr.io/broxus/tycho-tests/tycho-tests-nft-index:latest | |
| test_type: container | |
| test_env: {} | |
| - test_name: persistent-sync | |
| test_type: script | |
| test_script: ./scripts/run-persistent-sync-test.sh | |
| test_env: | |
| HACK_EACH_KEY_BLOCK_IS_PERSISTENT: "1" | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| persist-credentials: false | |
| ref: ${{ github.event.inputs.pr_number && format('refs/pull/{0}/head', github.event.inputs.pr_number) || github.ref }} | |
| - name: Show what we're testing | |
| shell: bash | |
| run: | | |
| echo "Testing PR: ${{ github.event.inputs.pr_number || 'current branch' }}" | |
| echo "Checked out commit: $(git rev-parse HEAD)" | |
| echo "Current branch/ref: $(git describe --always --dirty)" | |
| echo "Commit message: $(git log -1 --pretty=format:'%s')" | |
| - name: Initialize Environment | |
| uses: ./.github/actions/init | |
| with: | |
| setup-cache: false | |
| fake-procfs: true | |
| - name: Download Tycho Binary Artifact | |
| uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4 | |
| with: | |
| name: ${{ env.TYCHO_ARTIFACT_NAME }} | |
| path: ./downloaded_bin/ | |
| - name: Prepare Binary and Set Path | |
| shell: bash | |
| run: | | |
| downloaded_binary=$(find ./downloaded_bin/ -type f) | |
| if [ -z "$downloaded_binary" ]; then | |
| echo "ERROR: Downloaded binary not found in ./downloaded_bin/" | |
| exit 1 | |
| fi | |
| echo "Found downloaded binary: $downloaded_binary" | |
| chmod +x "$downloaded_binary" | |
| # Set the environment variable to the absolute path of the binary | |
| echo "TYCHO_BIN_PATH=$(readlink -f "$downloaded_binary")" >> $GITHUB_ENV | |
| echo "Using TYCHO_BIN_PATH=${TYCHO_BIN_PATH}" | |
| - name: Login to GHCR | |
| shell: bash | |
| run: | | |
| set -e | |
| echo "${{ secrets.GHCR_TOKEN }}" | podman login ghcr.io -u ${{ secrets.GHCR_USER }} --password-stdin | |
| - name: Run container-based network tests | |
| if: matrix.test_type == 'container' && (!github.event.inputs.test_selection || github.event.inputs.test_selection == 'all' || github.event.inputs.test_selection == matrix.test_name) | |
| shell: bash | |
| run: | | |
| # The script will use the TYCHO_BIN_PATH env | |
| ./scripts/run-network-tests.sh ${{ matrix.test_image }} | |
| # GitHub Actions sucks at handling conditional env directives, | |
| # so we need two separate steps - one with env and one without | |
| - name: Run script-based tests (with env) | |
| if: matrix.test_type == 'script' && toJSON(matrix.test_env) != '{}' && (!github.event.inputs.test_selection || github.event.inputs.test_selection == 'all' || github.event.inputs.test_selection == matrix.test_name) | |
| shell: bash | |
| env: ${{ matrix.test_env }} | |
| run: | | |
| # Run the test script | |
| ${{ matrix.test_script }} | |
| - name: Run script-based tests (no env) | |
| if: matrix.test_type == 'script' && toJSON(matrix.test_env) == '{}' && (!github.event.inputs.test_selection || github.event.inputs.test_selection == 'all' || github.event.inputs.test_selection == matrix.test_name) | |
| shell: bash | |
| run: | | |
| # Run the test script | |
| ${{ matrix.test_script }} | |
| - name: Archive Logs and Configs | |
| if: always() | |
| id: archive | |
| shell: bash | |
| run: | | |
| archive_dir=".temp" | |
| archive_name="network-test-logs-configs-${{ matrix.test_name }}.tar.zst" | |
| echo "ARCHIVE_PATH=${archive_name}" >> $GITHUB_ENV # Store path for next step | |
| # Check if the directory exists before attempting to archive | |
| if [ -d "$archive_dir" ]; then | |
| echo "Archiving directory: $archive_dir to $archive_name ..." | |
| # Create archive and compress with zstd (using multiple threads if available: -T0) | |
| # Exclude potentially problematic socket files explicitly if needed, though tar usually handles them okay. | |
| # Using --ignore-failed-read in case some files are transient/deleted during archiving | |
| tar --ignore-failed-read -cf - "$archive_dir" | zstd -T0 -o "$archive_name" | |
| if [ $? -eq 0 ]; then | |
| echo "Archive created successfully." | |
| echo "ARCHIVE_CREATED=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "Archiving failed." | |
| echo "ARCHIVE_CREATED=false" >> $GITHUB_OUTPUT | |
| fi | |
| else | |
| echo "Directory $archive_dir not found, skipping archiving." | |
| echo "ARCHIVE_CREATED=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Upload Logs and Configs Artifact | |
| # run if prior steps failed, but only if the archive was actually created | |
| if: always() && steps.archive.outputs.ARCHIVE_CREATED == 'true' | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
| with: | |
| name: network-test-logs-${{ matrix.test_name }}-${{ github.run_id }} | |
| path: ${{ env.ARCHIVE_PATH }} | |
| retention-days: 5 # 5 days retention | |
| if-no-files-found: warn | |
| network_tests_status: | |
| name: Network Tests Status Check # This is the name to require in branch protection | |
| runs-on: ubuntu-latest | |
| # Depends on the matrix job, but runs even if it's skipped or fails | |
| needs: | |
| - network-tests | |
| if: always() | |
| steps: | |
| - name: Check network test outcomes | |
| shell: bash | |
| run: | | |
| echo "Network Tests result: ${{ needs.network-tests.result }}" | |
| if [[ "${{ github.event_name }}" == "merge_group" ]]; then | |
| if [[ "${{ needs.network-tests.result }}" == "failure" || \ | |
| "${{ needs.network-tests.result }}" == "cancelled" ]]; then | |
| echo "At least one required test failed on merge_group." | |
| exit 1 | |
| fi | |
| fi | |
| echo "All required tests passed." |