From 6d3ed09a2b2ebfdcadbed51a79718635a8fa693f Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Wed, 24 Sep 2025 05:52:46 +0000 Subject: [PATCH] ci: Add matrix-rust-sdk integration testing. Signed-off-by: Jason Volk --- .github/workflows/main.yml | 6 +- .github/workflows/test.yml | 35 ++++++++++ docker/Dockerfile.complement | 2 - docker/Dockerfile.matrix-rust-sdk | 108 ++++++++++++++++++++++++++++++ docker/bake.hcl | 35 ++++++++++ 5 files changed, 182 insertions(+), 4 deletions(-) create mode 100644 docker/Dockerfile.matrix-rust-sdk diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6eee687d..96691791 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -47,6 +47,7 @@ jobs: docker_repo: ${{vars.DOCKER_REPO}} release_url: ${{steps.release.outputs.upload_url}} pages_url: 'https://matrix-construct.github.io/tuwunel/' + rust_sdk_integration: ${{vars.RUST_SDK_INTEGRATION || 'true'}} strategy: fail-fast: true @@ -59,8 +60,8 @@ jobs: - name: Initialize Builder env: runner: ${{matrix.runner}} - reserved_space: '{"het": "128GB", "aws": "48GB", "gcp": "160GB"}' - max_used_space: '{"het": "256GB", "aws": "64GB", "gcp": "192GB"}' + reserved_space: '{"het": "192GB", "aws": "48GB", "gcp": "160GB"}' + max_used_space: '{"het": "384GB", "aws": "64GB", "gcp": "192GB"}' run: | set +e docker buildx inspect "${GITHUB_ACTOR}" @@ -167,6 +168,7 @@ jobs: needs: [init, lint] uses: ./.github/workflows/test.yml with: + rust_sdk_integration: ${{fromJSON(needs.init.outputs.rust_sdk_integration)}} complement: ${{fromJSON(needs.init.outputs.complement)}} complement_runner: ${{needs.init.outputs.complement_runner}} cargo_profiles: ${{needs.init.outputs.cargo_profiles}} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 66b3929b..9f29405a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -43,6 +43,9 @@ on: default: '["all"]' complement_runner: type: string + rust_sdk_integration: + type: boolean + default: true jobs: docs: @@ -160,6 +163,38 @@ jobs: {"sys_target": "x86_64-v4-linux-gnu", "bake_target": "smoke-valgrind"}, ] + rust-sdk-integration: + if: > + !failure() && !cancelled() + && inputs.rust_sdk_integration + && contains(fromJSON(inputs.cargo_profiles), fromJSON('["test"]')[0]) + && contains(fromJSON(inputs.complement_feat_sets), fromJSON('["all"]')[0]) + && contains(fromJSON(inputs.rust_toolchains), fromJSON('["nightly"]')[0]) + && contains(fromJSON(inputs.sys_targets), fromJSON('["x86_64-v1-linux-gnu"]')[0]) + + name: Rust SDK Integration + uses: ./.github/workflows/bake.yml + with: + bake_targets: '["matrix-rust-sdk-integration"]' + cargo_profiles: '["test"]' + feat_sets: ${{inputs.complement_feat_sets}} + rust_toolchains: '["nightly"]' + sys_names: ${{inputs.sys_names}} + sys_versions: ${{inputs.sys_versions}} + rust_targets: ${{inputs.rust_targets}} + sys_targets: '["x86_64-v1-linux-gnu"]' + machines: ${{inputs.machines}} + runner: ${{inputs.complement_runner}} + excludes: ${{inputs.excludes}} + includes: ${{inputs.includes}} + artifact: > + { + "matrix-rust-sdk-integration": { + "src": "/var/log/tuwunel.log", + "dst": "rust-sdk-integration.tuwunel.log", + } + } + complement: if: > !failure() && !cancelled() diff --git a/docker/Dockerfile.complement b/docker/Dockerfile.complement index f5acbffc..56045afd 100644 --- a/docker/Dockerfile.complement +++ b/docker/Dockerfile.complement @@ -51,7 +51,6 @@ COPY < /var/log/tuwunel.log & + PID=$!; trap "sleep 10s; set +ex; kill -QUIT ${PID}; wait ${PID}" EXIT + sleep 3s + + rustup run ${rust_toolchain} \ + cargo test \ + --locked \ + --release \ + --color always \ + --features default \ + --target "${rust_target}" \ + --target-dir "${MRSDK_TARGET_DIR}" \ + --package matrix-sdk-integration-testing \ + ${mrsdk_test_args} \ + -- \ + --test-threads 1 \ + --color always \ + ${mrsdk_skip_list} \ + ${mrsdk_test_opts} \ + ; +EOF diff --git a/docker/bake.hcl b/docker/bake.hcl index cb0303e6..270dc4d4 100644 --- a/docker/bake.hcl +++ b/docker/bake.hcl @@ -241,6 +241,7 @@ group "tests" { "unit", "smoke", "complement", + "mrsdk", ] } @@ -429,6 +430,39 @@ target "complement-config" { } } +# +# Matrix Rust SDK tests +# + +group "matrix-rust-sdk" { + targets = [ + "matrix-rust-sdk-integration", + ] +} + +target "matrix-rust-sdk-integration" { + name = elem("matrix-rust-sdk-integration", [cargo_profile, rust_toolchain, rust_target, feat_set, sys_name, sys_version, sys_target]) + tags = [ + elem_tag("matrix-rust-sdk-integration", [cargo_profile, rust_toolchain, rust_target, feat_set, sys_name, sys_version, sys_target], "latest"), + ] + output = ["type=docker,compression=zstd,mode=max,compression-level=${zstd_image_compress_level}"] + cache_to = ["type=local,compression=zstd,mode=max,compression-level=${cache_compress_level}"] + target = "matrix-rust-sdk-integration" + dockerfile = "${docker_dir}/Dockerfile.matrix-rust-sdk" + matrix = cargo_rust_feat_sys + inherits = [ + elem("rust", [rust_toolchain, rust_target, sys_name, sys_version, sys_target]) + ] + contexts = { + input = elem("target:rust", [rust_toolchain, rust_target, sys_name, sys_version, sys_target]) + install = elem("target:install", [cargo_profile, rust_toolchain, rust_target, feat_set, sys_name, sys_version, sys_target]) + } + args = { + mrsdk_test_args="" + mrsdk_test_opts="" + } +} + # # Smoke tests # @@ -1618,6 +1652,7 @@ kitchen_packages = [ "jq", "libc6-dev", "libssl-dev", + "libsqlite3-dev", "make", "openssl", "pkg-config",