Skip to content

Commit

Permalink
Simplifying yarn invocations in Docker image.
Browse files Browse the repository at this point in the history
  • Loading branch information
1Copenut committed Nov 16, 2023
1 parent 94fb7bf commit e528d79
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .buildkite/scripts/lifecycle/post_command.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
set -euo pipefail
set +x

unset DOCKER_MACHINE DOCKER_STAGING_IMAGE DOCKER_STAGING_PASSWORD DOCKER_STAGING_REGISTRY DOCKER_STAGING_USERNAME GCE_ACCOUNT GITHUB_ACCOUNT GITHUB_TOKEN GPROJECT VAULT_ACCOUNT
unset DOCKER_MACHINE DOCKER_STAGING_PASSWORD DOCKER_STAGING_REGISTRY DOCKER_STAGING_USERNAME GCE_ACCOUNT GITHUB_ACCOUNT GITHUB_TOKEN GPROJECT VAULT_ACCOUNT
3 changes: 0 additions & 3 deletions .buildkite/scripts/lifecycle/pre_command.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,5 @@ export GITHUB_TOKEN
# ======================================== #
# Known values
# ======================================== #
DOCKER_STAGING_IMAGE=container-registry-test.elastic.co/eui/ci
export DOCKER_STAGING_IMAGE

GPROJECT=elastic-bekitzur
export GPROJECT
2 changes: 1 addition & 1 deletion .buildkite/scripts/pipelines/pipeline_docker_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ echo "${DOCKER_STAGING_PASSWORD}" | docker login -u "${DOCKER_STAGING_USERNAME}"

echo "[DOCKER]: Build and push container to registry"
docker-compose -f ./scripts/docker-ci/docker-compose.yml build app
docker push "${DOCKER_STAGING_IMAGE}":latest
docker push "${DOCKER_STAGING_REGISTRY}":latest

echo "[DOCKER]: Log out of registry"
docker logout
42 changes: 21 additions & 21 deletions .buildkite/scripts/pipelines/pipeline_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

set -euo pipefail

DOCKER_OPTIONS=(
-i --rm
--env GIT_COMMITTER_NAME=test
--env GIT_COMMITTER_EMAIL=test
--env HOME=/tmp
--user="$(id -u):$(id -g)"
--volume="$(pwd):/app"
--workdir=/app
--platform=linux/amd64
"${DOCKER_STAGING_IMAGE}":latest
)
# DOCKER_OPTIONS=(
# -i --rm
# --env GIT_COMMITTER_NAME=test
# --env GIT_COMMITTER_EMAIL=test
# --env HOME=/tmp
# --user="$(id -u):$(id -g)"
# --volume="$(pwd):/app"
# --workdir=/app
# --platform=linux/amd64
# "${DOCKER_STAGING_REGISTRY}":latest
# )

case $TEST_TYPE in
lint)
Expand All @@ -22,47 +22,47 @@ case $TEST_TYPE in

unit:ts)
echo "[TASK]: Running .ts and .js unit tests"
DOCKER_OPTIONS+=(bash -c "yarn test-unit --node-options=--max_old_space_size=2048 --testMatch=non-react")
yarn test-unit --node-options=--max_old_space_size=2048 --testMatch=non-react
;;

unit:tsx:16)
echo "[TASK]: Running Jest .tsx tests against React 16"
DOCKER_OPTIONS+=(bash -c "yarn test-unit --node-options=--max_old_space_size=2048 --react-version=16 --testMatch=react")
yarn test-unit --node-options=--max_old_space_size=2048 --react-version=16 --testMatch=react
;;

unit:tsx:17)
echo "[TASK]: Running Jest .tsx tests against React 17"
DOCKER_OPTIONS+=(bash -c "yarn test-unit --node-options=--max_old_space_size=2048 --react-version=17 --testMatch=react")
yarn test-unit --node-options=--max_old_space_size=2048 --react-version=17 --testMatch=react
;;

unit:tsx)
echo "[TASK]: Running Jest .tsx tests against React 18"
DOCKER_OPTIONS+=(bash -c "yarn test-unit --node-options=--max_old_space_size=2048 --testMatch=react")
yarn test-unit --node-options=--max_old_space_size=2048 --testMatch=react
;;

cypress:16)
echo "[TASK]: Running Cypress tests against React 16"
DOCKER_OPTIONS+=(bash -c "yarn cypress install && yarn test-cypress --node-options=--max_old_space_size=2048 --react-version=16")
yarn cypress install && yarn test-cypress --node-options=--max_old_space_size=2048 --react-version=16
;;

cypress:17)
echo "[TASK]: Running Cypress tests against React 17"
DOCKER_OPTIONS+=(bash -c "yarn cypress install && yarn test-cypress --node-options=--max_old_space_size=2048 --react-version=17")
yarn cypress install && yarn test-cypress --node-options=--max_old_space_size=2048 --react-version=17
;;

cypress:18)
echo "[TASK]: Running Cypress tests against React 18"
DOCKER_OPTIONS+=(bash -c "yarn cypress install && yarn test-cypress --node-options=--max_old_space_size=2048")
yarn cypress install && yarn test-cypress --node-options=--max_old_space_size=2048
;;

cypress:a11y)
echo "[TASK]: Running Cypress accessibility tests against React 18"
DOCKER_OPTIONS+=(bash -c "yarn cypress install && yarn run test-cypress-a11y --node-options=--max_old_space_size=2048")
yarn cypress install && yarn run test-cypress-a11y --node-options=--max_old_space_size=2048
;;

cypress:a11y)
echo "[TASK]: Running Cypress accessibility tests against React 18"
DOCKER_OPTIONS+=(bash -c "yarn cypress install && yarn run test-cypress-a11y --node-options=--max_old_space_size=2048")
yarn cypress install && yarn run test-cypress-a11y --node-options=--max_old_space_size=2048
;;

*)
Expand All @@ -72,4 +72,4 @@ case $TEST_TYPE in
;;
esac

docker run "${DOCKER_OPTIONS[@]}"
# docker run "${DOCKER_OPTIONS[@]}"

0 comments on commit e528d79

Please sign in to comment.