From bd24a936fbcb55767d06b0f0ab84b651b17d52f0 Mon Sep 17 00:00:00 2001 From: SPT-dev Date: Thu, 2 Mar 2023 21:12:48 -0500 Subject: [PATCH] tests: Use Nginx instead of yarn start --- .drone-docker.yml | 38 ++++++++++---------------------------- .drone-kubernetes.yml | 38 ++++++++++---------------------------- 2 files changed, 20 insertions(+), 56 deletions(-) diff --git a/.drone-docker.yml b/.drone-docker.yml index 728c7a1..5907b62 100644 --- a/.drone-docker.yml +++ b/.drone-docker.yml @@ -31,26 +31,27 @@ steps: - sed -i 's/{{ DEPLOY_SSH_KEY_PASSPHRASE }}/'"$DEPLOY_SSH_KEY_PASSPHRASE"'/g' ./.ansible-items/inventory - sed -i 's/{{ DEPLOY_USER }}/'"$DEPLOY_USER"'/g' ./.ansible-items/inventory - - name: install frontend dependencies + - name: install dependencies and build frontend image: node:lts-alpine3.14 commands: - node -v - npm -v - yarn --version - yarn --cwd ./items/frontend install + - yarn --cwd ./items/frontend build --pure-lockfile + - rm -rf ./items/api/public/static/* + - cp ./items/frontend/build/* ./items/api/public + - rm ./items/api/public/index.html depends_on: - replace hosts and user variables - name: frontend - image: node:lts-alpine3.14 + image: nginx:1.21.4-alpine commands: - - node -v - - npm -v - - yarn --version - - yarn --cwd ./items/frontend start + - cp ./items/frontend/build/* /usr/share/nginx/html detach: true depends_on: - - install frontend dependencies + - install dependencies and build frontend - name: test frontend image: cypress/browsers:node16.5.0-chrome94-ff93 @@ -60,25 +61,7 @@ steps: - yarn --version - yarn --cwd ./items/frontend cy:run depends_on: - - install frontend dependencies - - - name: build frontend - image: node:lts-alpine3.14 - commands: - - node -v - - npm -v - - yarn --version - - yarn --cwd ./items/frontend build --pure-lockfile - - rm -rf ./items/api/public/static/* - - mv ./items/frontend/build/* ./items/api/public - - rm ./items/api/public/index.html - depends_on: - - test frontend - when: - branch: - - main - - master - - development + - install dependencies and build frontend - name: check ansible syntax image: plugins/ansible:3 @@ -111,8 +94,7 @@ steps: SPT_ITEMS_PATH: from_secret: deploy_path depends_on: - - check ansible syntax - - build frontend + - test frontend when: branch: - master diff --git a/.drone-kubernetes.yml b/.drone-kubernetes.yml index a9239a1..7b62c8c 100644 --- a/.drone-kubernetes.yml +++ b/.drone-kubernetes.yml @@ -31,26 +31,27 @@ steps: - sed -i 's/{{ DEPLOY_SSH_KEY_PASSPHRASE }}/'"$DEPLOY_SSH_KEY_PASSPHRASE"'/g' ./.ansible-items/inventory - sed -i 's/{{ DEPLOY_USER }}/'"$DEPLOY_USER"'/g' ./.ansible-items/inventory - - name: install frontend dependencies + - name: install dependencies and build frontend image: node:lts-alpine3.14 commands: - node -v - npm -v - yarn --version - yarn --cwd ./items/frontend install + - yarn --cwd ./items/frontend build --pure-lockfile + - rm -rf ./items/api/public/static/* + - cp ./items/frontend/build/* ./items/api/public + - rm ./items/api/public/index.html depends_on: - replace hosts and user variables - name: frontend - image: node:lts-alpine3.14 + image: nginx:1.21.4-alpine commands: - - node -v - - npm -v - - yarn --version - - yarn --cwd ./items/frontend start + - cp ./items/frontend/build/* /usr/share/nginx/html detach: true depends_on: - - install frontend dependencies + - install dependencies and build frontend - name: test frontend image: cypress/browsers:node16.5.0-chrome94-ff93 @@ -60,25 +61,7 @@ steps: - yarn --version - yarn --cwd ./items/frontend cy:run depends_on: - - install frontend dependencies - - - name: build frontend - image: node:lts-alpine3.14 - commands: - - node -v - - npm -v - - yarn --version - - yarn --cwd ./items/frontend build --pure-lockfile - - rm -rf ./items/api/public/static/* - - mv ./items/frontend/build/* ./items/api/public - - rm ./items/api/public/index.html - depends_on: - - test frontend - when: - branch: - - main - - master - - development + - install dependencies and build frontend - name: check ansible syntax image: plugins/ansible:3 @@ -111,8 +94,7 @@ steps: SPT_ITEMS_PATH: from_secret: deploy_path depends_on: - - check ansible syntax - - build frontend + - test frontend when: branch: - master