Skip to content

Commit

Permalink
move local tests to docker (#200)
Browse files Browse the repository at this point in the history
Co-authored-by: Alex Strachan <[email protected]>
  • Loading branch information
Alex Strachan and alex-h-strachan authored Jan 15, 2025
1 parent 4bd9a70 commit 0ae0bfb
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 19 deletions.
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
docker-compose run --rm main ./testing/test.sh ./testing/overlay-test.env
23 changes: 23 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -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}
13 changes: 0 additions & 13 deletions testing/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +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}
if [ -z "$INPUT_GITHUB_ACCESS_TOKEN" ]; then
INPUT_GITHUB_ACCESS_TOKEN=${GITHUB_TOKEN}
fi
#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"

if [ "$RUN_FINALIZE" = "true" ]; then
BRANCH_NAME=$(go run testing/getoutput.go -output branch_name)
Expand Down

0 comments on commit 0ae0bfb

Please sign in to comment.