2023-07-13 11:44:05 +00:00
|
|
|
name: Test
|
|
|
|
run-name: Building and testing development branch
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- development
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
Build-and-test-development:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: actions/setup-node@v3
|
|
|
|
with:
|
|
|
|
node-version: 18
|
|
|
|
|
|
|
|
- name: Write .npmrc file
|
2023-07-25 09:34:58 +00:00
|
|
|
run: |
|
|
|
|
touch client/.npmrc
|
|
|
|
echo '${{ secrets.NPMRC}}' > client/.npmrc
|
2023-07-13 11:44:05 +00:00
|
|
|
|
|
|
|
- run: apt-get update
|
|
|
|
- run: wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
|
|
|
|
- run: apt install -y ./google-chrome*.deb;
|
|
|
|
- run: export CHROME_BIN=/usr/bin/google-chrome
|
|
|
|
- run: apt-get update -y
|
|
|
|
- run: apt-get -y install libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb
|
|
|
|
- run: apt -y install jq
|
2023-07-25 09:34:58 +00:00
|
|
|
|
2023-07-13 11:44:05 +00:00
|
|
|
- name: Write cypress credentials
|
|
|
|
run: echo "$CYPRESS_CREDS" > ./client/cypress.env.json
|
|
|
|
shell: bash
|
|
|
|
env:
|
|
|
|
CYPRESS_CREDS: ${{ secrets.CYPRESS_CREDS }}
|
|
|
|
|
2023-07-14 10:27:33 +00:00
|
|
|
- run: npm ci
|
2023-07-13 11:44:05 +00:00
|
|
|
# Install pm2 and prepare SASJS server
|
|
|
|
- run: npm i -g pm2
|
|
|
|
- run: curl -L https://github.com/sasjs/server/releases/latest/download/linux.zip > linux.zip
|
|
|
|
- run: unzip linux.zip
|
|
|
|
- run: touch .env
|
|
|
|
- run: echo RUN_TIMES=js >> .env
|
|
|
|
- run: echo NODE_PATH=node >> .env
|
|
|
|
- run: echo CORS=enable >> .env
|
|
|
|
- run: echo WHITELIST=http://localhost:4200 >> .env
|
2023-07-25 09:34:58 +00:00
|
|
|
- run: cat .env
|
2023-07-13 11:44:05 +00:00
|
|
|
- run: pm2 start api-linux --wait-ready
|
|
|
|
|
|
|
|
- name: Deploy mocked services
|
|
|
|
run: |
|
|
|
|
cd ./sas/mocks/sasjs
|
2023-07-14 10:27:33 +00:00
|
|
|
npm install -g @sasjs/cli
|
|
|
|
npm install -g replace-in-files-cli
|
2023-07-13 11:44:05 +00:00
|
|
|
sasjs cbd -t server-ci
|
|
|
|
# sasjs request services/admin/makedata -t server-ci -d ./deploy/makeData4GL.json -c ./deploy/requestConfig.json -o ./output.json
|
|
|
|
|
2023-07-25 09:34:58 +00:00
|
|
|
- name: Install ZIP
|
|
|
|
run: |
|
|
|
|
apt-get update
|
|
|
|
apt-get install zip
|
|
|
|
|
|
|
|
- name: Prepare and run frontend and cypress
|
2023-07-13 11:44:05 +00:00
|
|
|
run: |
|
|
|
|
cd ./client
|
2023-07-25 09:34:58 +00:00
|
|
|
mv ./cypress.env.example.json ./cypress.env.json
|
|
|
|
replace-in-files --regex='"username".*' --replacement='"username":"'${{ secrets.CYPRESS_USERNAME_SASJS }}'",' ./cypress.env.json
|
|
|
|
replace-in-files --regex='"password".*' --replacement='"password":"'${{ secrets.CYPRESS_PWD_SASJS }}'" ' ./cypress.env.json
|
2023-07-13 11:44:05 +00:00
|
|
|
cat ./cypress.env.json
|
|
|
|
npm run postinstall
|
|
|
|
# Prepare index.html to SASJS local
|
|
|
|
replace-in-files --regex='serverUrl=".*?"' --replacement='serverUrl="http://localhost:5000"' ./src/index.html
|
|
|
|
replace-in-files --regex='appLoc=".*?"' --replacement='appLoc="/Public/app/devtest"' ./src/index.html
|
|
|
|
replace-in-files --regex='serverType=".*?"' --replacement='serverType="SASJS"' ./src/index.html
|
|
|
|
replace-in-files --regex='"hosturl".*' --replacement='hosturl:"http://localhost:4200",' ./cypress.config.ts
|
|
|
|
cat ./cypress.config.ts
|
|
|
|
# Start frontend and run cypress
|
2023-07-25 09:34:58 +00:00
|
|
|
npm start & npx wait-on http://localhost:4200 && npx cypress run --browser chrome --spec "cypress/e2e/liveness.cy.ts,cypress/e2e/editor.cy.ts,cypress/e2e/excel.cy.ts,cypress/e2e/filtering.cy.ts,cypress/e2e/licensing.cy.ts"
|
2023-07-13 11:44:05 +00:00
|
|
|
|
2023-07-27 11:09:16 +00:00
|
|
|
- name: Zip Cypress videos
|
|
|
|
if: always()
|
|
|
|
run: |
|
|
|
|
zip -r cypress-videos ./client/cypress/videos
|
|
|
|
|
|
|
|
- name: Cypress videos artifacts
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: cypress-videos.zip
|
|
|
|
path: cypress-videos.zip
|
|
|
|
|
2023-07-13 11:44:05 +00:00
|
|
|
Build-and-test-development-latest-adapter:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: actions/setup-node@v3
|
|
|
|
with:
|
|
|
|
node-version: 18
|
|
|
|
|
|
|
|
- name: Write .npmrc file
|
|
|
|
run: echo "$NPMRC" > client/.npmrc
|
|
|
|
shell: bash
|
|
|
|
env:
|
|
|
|
NPMRC: ${{ secrets.NPMRC}}
|
|
|
|
|
|
|
|
- run: apt-get update
|
|
|
|
- run: wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
|
|
|
|
- run: apt install -y ./google-chrome*.deb;
|
|
|
|
- run: export CHROME_BIN=/usr/bin/google-chrome
|
|
|
|
- run: apt-get update -y
|
|
|
|
- run: apt-get -y install libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb
|
|
|
|
- run: apt -y install jq
|
2023-07-25 09:34:58 +00:00
|
|
|
|
2023-07-13 11:44:05 +00:00
|
|
|
- name: Write cypress credentials
|
|
|
|
run: echo "$CYPRESS_CREDS" > ./client/cypress.env.json
|
|
|
|
shell: bash
|
|
|
|
env:
|
|
|
|
CYPRESS_CREDS: ${{ secrets.CYPRESS_CREDS }}
|
|
|
|
|
2023-07-14 10:27:33 +00:00
|
|
|
- run: npm ci
|
2023-07-13 11:44:05 +00:00
|
|
|
# Install pm2 and prepare SASJS server
|
|
|
|
- run: npm i -g pm2
|
|
|
|
- run: curl -L https://github.com/sasjs/server/releases/latest/download/linux.zip > linux.zip
|
|
|
|
- run: unzip linux.zip
|
|
|
|
- run: touch .env
|
|
|
|
- run: echo RUN_TIMES=js >> .env
|
|
|
|
- run: echo NODE_PATH=node >> .env
|
|
|
|
- run: echo CORS=enable >> .env
|
|
|
|
- run: echo WHITELIST=http://localhost:4200 >> .env
|
2023-07-25 09:34:58 +00:00
|
|
|
- run: cat .env
|
2023-07-13 11:44:05 +00:00
|
|
|
- run: pm2 start api-linux --wait-ready
|
|
|
|
|
|
|
|
- name: Deploy mocked services
|
|
|
|
run: |
|
|
|
|
cd ./sas/mocks/sasjs
|
2023-07-14 10:27:33 +00:00
|
|
|
npm install -g @sasjs/cli
|
|
|
|
npm install -g replace-in-files-cli
|
2023-07-13 11:44:05 +00:00
|
|
|
sasjs cbd -t server-ci
|
|
|
|
|
2023-07-25 09:34:58 +00:00
|
|
|
- name: Install ZIP
|
|
|
|
run: |
|
|
|
|
apt-get update
|
|
|
|
apt-get install zip
|
|
|
|
|
|
|
|
- name: Prepare and run frontend and cypress
|
2023-07-13 11:44:05 +00:00
|
|
|
run: |
|
|
|
|
cd ./client
|
2023-07-25 09:34:58 +00:00
|
|
|
mv ./cypress.env.example.json ./cypress.env.json
|
|
|
|
replace-in-files --regex='"username".*' --replacement='"username":"'${{ secrets.CYPRESS_USERNAME_SASJS }}'",' ./cypress.env.json
|
|
|
|
replace-in-files --regex='"password".*' --replacement='"password":"'${{ secrets.CYPRESS_PWD_SASJS }}'" ' ./cypress.env.json
|
2023-07-13 11:44:05 +00:00
|
|
|
cat ./cypress.env.json
|
|
|
|
npm run postinstall
|
2023-07-14 10:27:33 +00:00
|
|
|
npm install @sasjs/adapter@latest
|
2023-07-13 11:44:05 +00:00
|
|
|
# Prepare index.html to SASJS local
|
|
|
|
replace-in-files --regex='serverUrl=".*?"' --replacement='serverUrl="http://localhost:5000"' ./src/index.html
|
|
|
|
replace-in-files --regex='appLoc=".*?"' --replacement='appLoc="/Public/app/devtest"' ./src/index.html
|
|
|
|
replace-in-files --regex='serverType=".*?"' --replacement='serverType="SASJS"' ./src/index.html
|
|
|
|
replace-in-files --regex='"hosturl".*' --replacement='hosturl:"http://localhost:4200",' ./cypress.config.ts
|
|
|
|
cat ./cypress.config.ts
|
|
|
|
# Start frontend and run cypress
|
2023-07-27 11:09:16 +00:00
|
|
|
npm start & npx wait-on http://localhost:4200 && npx cypress run --browser chrome --spec "cypress/e2e/liveness.cy.ts,cypress/e2e/editor.cy.ts,cypress/e2e/excel.cy.ts,cypress/e2e/filtering.cy.ts,cypress/e2e/licensing.cy.ts"
|
|
|
|
|
|
|
|
- name: Zip Cypress videos
|
|
|
|
if: always()
|
|
|
|
run: |
|
|
|
|
zip -r cypress-videos ./client/cypress/videos
|
|
|
|
|
|
|
|
- name: Cypress videos artifacts
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: cypress-videos-latest-adapter.zip
|
|
|
|
path: cypress-videos.zip
|