From 1b542e3f39c98c7ca6a5b54b9fa4ca39a4f5bf87 Mon Sep 17 00:00:00 2001 From: Alex Strachan Date: Tue, 14 Jan 2025 16:13:12 -0800 Subject: [PATCH] move local tests to docker --- Makefile | 12 ++++++------ docker-compose.yaml | 23 +++++++++++++++++++++++ testing/test.sh | 12 +----------- 3 files changed, 30 insertions(+), 17 deletions(-) create mode 100644 docker-compose.yaml diff --git a/Makefile b/Makefile index 219d9ee8..b0fc4226 100644 --- a/Makefile +++ b/Makefile @@ -7,19 +7,19 @@ test-direct-mode-multi-sdk: ./testing/test.sh ./testing/direct-mode-multi-sdk.env test-pr-mode: - ./testing/test.sh ./testing/pr-mode.env + docker-compose run --rm main ./testing/test.sh ./testing/pr-mode.env test-push-code-samples-only: - ./testing/test.sh ./testing/push-code-samples-only.env + docker-compose run --rm main ./testing/test.sh ./testing/push-code-samples-only.env test-release-mode: - ./testing/test.sh ./testing/release-mode.env + docker-compose run --rm main ./testing/test.sh ./testing/release-mode.env test-release-mode-multi-sdk: - ./testing/test.sh ./testing/release-mode-multi-sdk.env + docker-compose run --rm main ./testing/test.sh ./testing/release-mode-multi-sdk.env test-validate-action: - ./testing/test.sh ./testing/validate-action.env + docker-compose run --rm main ./testing/test.sh ./testing/validate-action.env test-overlay: - ./testing/test.sh ./testing/overlay-test.env \ No newline at end of file + docker-compose run --rm main ./testing/test.sh ./testing/overlay-test.env diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 00000000..09b03800 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,23 @@ +version: "3.9" + +services: + main: + build: + context: . + container_name: main_container + stdin_open: true # Keep stdin open for interactive processes + tty: true # Allocate a pseudo-TTY + environment: + - INPUT_DEBUG=true + - INPUT_GITHUB_ACCESS_TOKEN=${GITHUB_TOKEN} + - GITHUB_SERVER_URL=https://github.com + - GITHUB_REPOSITORY=speakeasy-api/sdk-generation-action-test-repo + - GITHUB_REPOSITORY_OWNER=speakeasy-api + - GITHUB_REF=refs/heads/main + - GITHUB_OUTPUT=./output.txt + - GITHUB_WORKFLOW=test + - GITHUB_WORKSPACE=${PWD} + - GITHUB_RUN_ID=1 + - GITHUB_RUN_ATTEMPT=1 + - SPEAKEASY_ENVIRONMENT=local + - SPEAKEASY_API_KEY=${SPEAKEASY_API_KEY} diff --git a/testing/test.sh b/testing/test.sh index b5dfa70c..b3d8bc7c 100755 --- a/testing/test.sh +++ b/testing/test.sh @@ -9,17 +9,7 @@ function run_action() { } # Default environment variables not subject to change by different tests -export INPUT_DEBUG=true -export INPUT_GITHUB_ACCESS_TOKEN=${GITHUB_ACCESS_TOKEN} -#export INPUT_SPEAKEASY_VERSION="v1.240.0" # Uncomment to test specific versions otherwise uses latest -export GITHUB_SERVER_URL="https://github.com" -export GITHUB_REPOSITORY_OWNER="speakeasy-api" -export GITHUB_REF="refs/heads/main" -export GITHUB_OUTPUT="./output.txt" -export GITHUB_WORKFLOW="test" -export GITHUB_WORKSPACE=$(pwd) -export GITHUB_RUN_ID="1" -export GITHUB_RUN_ATTEMPT="1" +#INPUT_SPEAKEASY_VERSION="v1.240.0" # Uncomment to test specific versions otherwise uses latest if [ "$RUN_FINALIZE" = "true" ]; then BRANCH_NAME=$(go run testing/getoutput.go -output branch_name)