diff --git a/.github/workflows/pr-ppaas.yml b/.github/workflows/pr-ppaas.yml index b777ff26..a695448e 100644 --- a/.github/workflows/pr-ppaas.yml +++ b/.github/workflows/pr-ppaas.yml @@ -62,24 +62,31 @@ jobs: cd $CONFIG_WASM_LIB_DIR wasm-pack build --release -t nodejs --scope fs + - name: Create .env file for controller that can be overridden by a .env.production file + run: | + set -x + # setup some envs to various paths that re required for build + PROJECT_ROOT=$PWD + CONTROLLER_DIR=$(realpath $PROJECT_ROOT/controller) + # .env.production will override .env, but NOT .env.local or environment variables passed in + ENV_FILE=$CONTROLLER_DIR/.env + touch "$ENV_FILE" + echo PEWPEWCONTROLLER_UNITTESTS_S3_BUCKET_NAME="unit-test-bucket" >> "$ENV_FILE" + echo PEWPEWCONTROLLER_UNITTESTS_S3_BUCKET_URL="https://unit-test-bucket.s3.amazonaws.com" >> "$ENV_FILE" + echo PEWPEWCONTROLLER_UNITTESTS_S3_KEYSPACE_PREFIX="unittests/" >> "$ENV_FILE" + echo PEWPEWCONTROLLER_UNITTESTS_S3_REGION_ENDPOINT="s3-us-east-1.amazonaws.com" >> "$ENV_FILE" + echo APPLICATION_NAME=pewpewcontroller >> "$ENV_FILE" + echo AGENT_ENV="unittests" >> "$ENV_FILE" + echo AGENT_DESC="c5n.large" >> "$ENV_FILE" + echo PEWPEWAGENT_UNITTESTS_SQS_SCALE_OUT_QUEUE_URL="https://sqs.us-east-1.amazonaws.com/unittests/sqs-scale-out" >> "$ENV_FILE" + echo PEWPEWAGENT_UNITTESTS_SQS_SCALE_IN_QUEUE_URL="https://sqs.us-east-1.amazonaws.com/unittests/sqs-scale-in" >> "$ENV_FILE" + echo PEWPEWCONTROLLER_UNITTESTS_SQS_COMMUNICATION_QUEUE_URL="https://sqs.us-east-1.amazonaws.com/unittests/sqs-communication" >> "$ENV_FILE" + - name: Install NPM Dependencies run: npm ci - name: Run Lint run: npm run linterror - name: Build Controller - env: - # Minimum variables needed to compile - PEWPEWCONTROLLER_UNITTESTS_S3_BUCKET_NAME: "unit-test-bucket" - PEWPEWCONTROLLER_UNITTESTS_S3_BUCKET_URL: "https://unit-test-bucket.s3.amazonaws.com" - PEWPEWCONTROLLER_UNITTESTS_S3_KEYSPACE_PREFIX: "unittests/" - PEWPEWCONTROLLER_UNITTESTS_S3_REGION_ENDPOINT: "s3-us-east-1.amazonaws.com" - APPLICATION_NAME: pewpewcontroller - AGENT_ENV: "unittests" - AGENT_DESC: "c5n.large" - PEWPEWAGENT_UNITTESTS_SQS_SCALE_OUT_QUEUE_URL: "https://sqs.us-east-1.amazonaws.com/unittests/sqs-scale-out" - PEWPEWAGENT_UNITTESTS_SQS_SCALE_IN_QUEUE_URL: "https://sqs.us-east-1.amazonaws.com/unittests/sqs-scale-in" - PEWPEWCONTROLLER_UNITTESTS_SQS_COMMUNICATION_QUEUE_URL: "https://sqs.us-east-1.amazonaws.com/unittests/sqs-communication" - run: npm run build:react - name: Run Tests run: NODE_ENV=test npm test