Skip to content

ci: adds shared reusable setup polytest and mock server actions#18

Merged
aorumbayev merged 11 commits intoalgorandfoundation:mainfrom
aorumbayev:feat/ghcr-and-shared-action
Dec 8, 2025
Merged

ci: adds shared reusable setup polytest and mock server actions#18
aorumbayev merged 11 commits intoalgorandfoundation:mainfrom
aorumbayev:feat/ghcr-and-shared-action

Conversation

@aorumbayev
Copy link
Contributor

@aorumbayev aorumbayev commented Dec 2, 2025

Adds shared GitHub Actions for setting up polytest and running mock servers, enhances the mock server to handle binary responses correctly, and removes unused endpoints.

Changes

  • setup-polytest action: Composite action for installing Rust and the polytest CLI, allowing version specification and reuse from ts and py utils
  • run-mock-server action: Composite action that starts mock servers using Bun directly (no Docker required), with automatic health checks and environment variable exports (MOCK_ALGOD_URL, MOCK_INDEXER_URL, MOCK_KMD_URL)
  • Mock server improvements:
    • Handles binary msgpack responses correctly
    • Updated scripts (start_all_servers.sh, start_server.sh, stop_all_servers.sh) for local development
    • Comprehensive README documentation0

Usage

# Install polytest CLI
- uses: algorandfoundation/algokit-polytest/.github/actions/setup-polytest@main
  with:
    version: "0.6.0"  # Optional

# Start mock servers
- uses: algorandfoundation/algokit-polytest/.github/actions/run-mock-server@main
  with:
    client: algod  # algod, indexer, or kmd

See run-mock-server README for full documentation.

Validation

Validated behavior tested against utils-py - see pr description in algorandfoundation/algokit-utils-py#231
Validated behavior tested against utils-ts - see pr description in algorandfoundation/algokit-utils-ts#477

aorumbayev and others added 4 commits December 2, 2025 13:31
* fix: handles binary msgpack responses correctly

Ensures correct handling of binary msgpack responses by using `arrayBuffer()` instead of `text()` to prevent UTF-8 corruption.
Also adds logging for content type and binary status, and adjusts the response preview logic to only apply to non msgpack data.

* chore: cd for image publishing
@neilcampbell neilcampbell deleted the branch algorandfoundation:main December 4, 2025 13:26
@aorumbayev aorumbayev reopened this Dec 4, 2025
@aorumbayev aorumbayev changed the base branch from fix/msgpack-responses-fastify to main December 4, 2025 14:12
aorumbayev and others added 4 commits December 8, 2025 13:11
Introduces a composite GitHub Action to simplify starting mock servers for testing Algorand API clients (algod, indexer, kmd).

This action handles installing Bun, mock-server dependencies,
starting the server in the background, waiting for the server to be healthy, and exporting environment variables for use in subsequent steps.

It uses the mock-server located in the `resources/mock-server/` directory of this repo and makes it available as a reusable action.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the AlgoKit Polytest repository by adding CI/CD infrastructure for easier integration with downstream projects. The changes provide reusable GitHub Actions for setting up polytest and running mock servers, along with improved local development scripts.

Key Changes:

  • Introduces composite GitHub Actions (setup-polytest and run-mock-server) for standardized CI integration
  • Replaces Docker-based server startup with Bun-native shell scripts for better performance and flexibility
  • Significantly expands documentation with usage examples, environment variable conventions, and integration guides

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
.github/actions/setup-polytest/action.yml New composite action to install Rust toolchain and polytest CLI with optional version pinning
.github/actions/run-mock-server/action.yml New composite action to start mock servers in CI with health checks and environment variable exports
.github/actions/run-mock-server/README.md Comprehensive documentation for the run-mock-server action with multiple usage examples
resources/mock-server/scripts/start_server.sh Refactored from Docker to Bun-native execution with improved argument validation and error handling
resources/mock-server/scripts/start_all_servers.sh New script to start all three mock servers concurrently with health checks and logging
resources/mock-server/scripts/stop_all_servers.sh New utility script to cleanly stop all running mock servers
resources/mock-server/README.md Expanded with detailed usage instructions, environment variables, and troubleshooting guidance
README.md Complete rewrite providing repository overview, GitHub Actions documentation, and integration examples

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@aorumbayev aorumbayev force-pushed the feat/ghcr-and-shared-action branch from 562e5ba to 2c0ff3d Compare December 8, 2025 17:00
@aorumbayev aorumbayev merged commit 478c222 into algorandfoundation:main Dec 8, 2025
1 check passed
@aorumbayev aorumbayev deleted the feat/ghcr-and-shared-action branch December 8, 2025 17:17
@aorumbayev aorumbayev changed the title ci: adds CD for docker publishing to ghcr and adds reusable setup action ci: adds shared reusable setup polytest and mock server actions Dec 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants