1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-01-17 00:50:05 +00:00

Merge pull request #802 from sasjs/fix-ci

chore(ci): install vpn and run sasjs tests
This commit is contained in:
Allan Bowe
2023-05-04 10:51:34 +01:00
committed by GitHub
11 changed files with 1112 additions and 520 deletions

25
.github/vpn/config.ovpn vendored Normal file
View File

@@ -0,0 +1,25 @@
# Client
client
tls-client
dev tun
# this will connect with whatever proto DNS tells us (https://community.openvpn.net/openvpn/ticket/934)
proto tcp
remote vpn.4gl.io 7494
resolv-retry infinite
cipher AES-256-CBC
auth SHA256
script-security 2
keepalive 10 120
remote-cert-tls server
# Keys
ca ca.crt
cert user.crt
key user.key
tls-auth tls.key 1
# Security
nobind
persist-key
persist-tun
verb 3

View File

@@ -39,11 +39,33 @@ jobs:
env: env:
CI: true CI: true
- name: Install SSH Key - name: Write VPN Files
uses: shimataro/ssh-key-action@v2 run: |
with: echo "$CA_CRT" > .github/vpn/ca.crt
key: ${{ secrets.DCGITLAB_KEY }} echo "$USER_CRT" > .github/vpn/user.crt
known_hosts: 'placeholder' echo "$USER_KEY" > .github/vpn/user.key
echo "$TLS_KEY" > .github/vpn/tls.key
shell: bash
env:
CA_CRT: ${{ secrets.CA_CRT}}
USER_CRT: ${{ secrets.USER_CRT }}
USER_KEY: ${{ secrets.USER_KEY }}
TLS_KEY: ${{ secrets.TLS_KEY }}
- name: Install Open VPN
run: |
sudo apt install apt-transport-https
sudo wget https://swupdate.openvpn.net/repos/openvpn-repo-pkg-key.pub
sudo apt-key add openvpn-repo-pkg-key.pub
sudo wget -O /etc/apt/sources.list.d/openvpn3.list https://swupdate.openvpn.net/community/openvpn3/repos/openvpn3-jammy.list
sudo apt update
sudo apt install openvpn3=17~betaUb22042+jammy
- name: Start Open VPN 3
run: openvpn3 session-start --config .github/vpn/config.ovpn
- name: install pm2
run: npm i -g pm2
- name: Deploy sasjs-tests - name: Deploy sasjs-tests
run: | run: |
@@ -55,12 +77,12 @@ jobs:
replace-in-files --regex='"userName".*' --replacement='"userName":"${{ secrets.SASJS_USERNAME }}",' ./public/config.json replace-in-files --regex='"userName".*' --replacement='"userName":"${{ secrets.SASJS_USERNAME }}",' ./public/config.json
replace-in-files --regex='"password".*' --replacement='"password":"${{ secrets.SASJS_PASSWORD }}",' ./public/config.json replace-in-files --regex='"password".*' --replacement='"password":"${{ secrets.SASJS_PASSWORD }}",' ./public/config.json
replace-in-files --regex='"serverType".*' --replacement='"serverType":"SASJS",' ./public/config.json replace-in-files --regex='"serverType".*' --replacement='"serverType":"SASJS",' ./public/config.json
npm run update:adapter && npm run build npm run update:adapter
scp -o stricthostkeychecking=no -r ./build/* ${{ secrets.DCGITLAB_DEPLOY_PATH_VIYA }} pm2 start --name sasjs-test npm -- start
- name: Run cypress on sasjs - name: Run cypress on sasjs
run: | run: |
replace-in-files --regex='"sasjsTestsUrl".*' --replacement='"sasjsTestsUrl":"${{ secrets.SASJS_TEST_URL_VIYA }}",' ./cypress.json replace-in-files --regex='"sasjsTestsUrl".*' --replacement='"sasjsTestsUrl":"http://localhost:3000",' ./cypress.json
replace-in-files --regex='"username".*' --replacement='"username":"${{ secrets.SASJS_USERNAME }}",' ./cypress.json replace-in-files --regex='"username".*' --replacement='"username":"${{ secrets.SASJS_USERNAME }}",' ./cypress.json
replace-in-files --regex='"password".*' --replacement='"password":"${{ secrets.SASJS_PASSWORD }}",' ./cypress.json replace-in-files --regex='"password".*' --replacement='"password":"${{ secrets.SASJS_PASSWORD }}",' ./cypress.json
sh ./sasjs-tests/sasjs-cypress-run.sh ${{ secrets.MATRIX_TOKEN }} https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} sh ./sasjs-tests/sasjs-cypress-run.sh ${{ secrets.MATRIX_TOKEN }} https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}

View File

@@ -14,65 +14,83 @@ context('sasjs-tests', function () {
it('Should have all tests successfull', (done) => { it('Should have all tests successfull', (done) => {
cy.get('body').then(($body) => { cy.get('body').then(($body) => {
if ($body.find('input[placeholder="User Name"]').length > 0) { cy.wait(1000).then(() => {
cy.get('input[placeholder="User Name"]').type(username) const startButton = $body.find(
cy.get('input[placeholder="Password"]').type(password) '.ui.massive.icon.primary.left.labeled.button'
cy.get('.submit-button').click() )[0]
}
cy.get('input[placeholder="User Name"]', { timeout: 40000 }) if (
.should('not.exist') !startButton ||
.then(() => { (startButton && !Cypress.dom.isVisible(startButton))
cy.get('.ui.massive.icon.primary.left.labeled.button') ) {
.click() cy.get('input[placeholder="User Name"]').type(username)
.then(() => { cy.get('input[placeholder="Password"]').type(password)
cy.get('.ui.massive.loading.primary.button', { cy.get('.submit-button').click()
timeout: testingFinishTimeout }
})
.should('not.exist') cy.get('input[placeholder="User Name"]', { timeout: 40000 })
.then(() => { .should('not.exist')
cy.get('span.icon.failed') .then(() => {
.should('not.exist') cy.get('.ui.massive.icon.primary.left.labeled.button')
.then(() => { .click()
done() .then(() => {
}) cy.get('.ui.massive.loading.primary.button', {
timeout: testingFinishTimeout
}) })
}) .should('not.exist')
}) .then(() => {
cy.get('span.icon.failed')
.should('not.exist')
.then(() => {
done()
})
})
})
})
})
}) })
}) })
it('Should have all tests successfull with debug on', (done) => { it('Should have all tests successfull with debug on', (done) => {
cy.get('body').then(($body) => { cy.get('body').then(($body) => {
if ($body.find('input[placeholder="User Name"]').length > 0) { cy.wait(1000).then(() => {
cy.get('input[placeholder="User Name"]').type(username) const startButton = $body.find(
cy.get('input[placeholder="Password"]').type(password) '.ui.massive.icon.primary.left.labeled.button'
cy.get('.submit-button').click() )[0]
}
cy.get('.ui.fitted.toggle.checkbox label') if (
.click() !startButton ||
.then(() => { (startButton && !Cypress.dom.isVisible(startButton))
cy.get('input[placeholder="User Name"]', { timeout: 40000 }) ) {
.should('not.exist') cy.get('input[placeholder="User Name"]').type(username)
.then(() => { cy.get('input[placeholder="Password"]').type(password)
cy.get('.ui.massive.icon.primary.left.labeled.button') cy.get('.submit-button').click()
.click() }
.then(() => {
cy.get('.ui.massive.loading.primary.button', { cy.get('.ui.fitted.toggle.checkbox label')
timeout: testingFinishTimeout .click()
}) .then(() => {
.should('not.exist') cy.get('input[placeholder="User Name"]', { timeout: 40000 })
.then(() => { .should('not.exist')
cy.get('span.icon.failed') .then(() => {
.should('not.exist') cy.get('.ui.massive.icon.primary.left.labeled.button')
.then(() => { .click()
done() .then(() => {
}) cy.get('.ui.massive.loading.primary.button', {
timeout: testingFinishTimeout
}) })
}) .should('not.exist')
}) .then(() => {
}) cy.get('span.icon.failed')
.should('not.exist')
.then(() => {
done()
})
})
})
})
})
})
}) })
}) })
}) })

View File

@@ -0,0 +1,25 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })

20
cypress/support/index.js Normal file
View File

@@ -0,0 +1,20 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************
// Import commands.js using ES2015 syntax:
import './commands'
// Alternatively you can use CommonJS syntax:
// require('./commands')

14
package-lock.json generated
View File

@@ -32,7 +32,7 @@
"node-polyfill-webpack-plugin": "1.1.4", "node-polyfill-webpack-plugin": "1.1.4",
"path": "0.12.7", "path": "0.12.7",
"pem": "1.14.5", "pem": "1.14.5",
"prettier": "2.7.1", "prettier": "2.8.7",
"process": "0.11.10", "process": "0.11.10",
"rimraf": "3.0.2", "rimraf": "3.0.2",
"semantic-release": "19.0.3", "semantic-release": "19.0.3",
@@ -13925,9 +13925,9 @@
} }
}, },
"node_modules/prettier": { "node_modules/prettier": {
"version": "2.7.1", "version": "2.8.7",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.7.tgz",
"integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", "integrity": "sha512-yPngTo3aXUUmyuTjeTUT75txrf+aMh9FiD7q9ZE/i6r0bPb22g4FsE6Y338PQX1bmfy08i9QQCB7/rcUAVntfw==",
"dev": true, "dev": true,
"bin": { "bin": {
"prettier": "bin-prettier.js" "prettier": "bin-prettier.js"
@@ -27416,9 +27416,9 @@
"dev": true "dev": true
}, },
"prettier": { "prettier": {
"version": "2.7.1", "version": "2.8.7",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.7.tgz",
"integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", "integrity": "sha512-yPngTo3aXUUmyuTjeTUT75txrf+aMh9FiD7q9ZE/i6r0bPb22g4FsE6Y338PQX1bmfy08i9QQCB7/rcUAVntfw==",
"dev": true "dev": true
}, },
"pretty-bytes": { "pretty-bytes": {

View File

@@ -60,7 +60,7 @@
"node-polyfill-webpack-plugin": "1.1.4", "node-polyfill-webpack-plugin": "1.1.4",
"path": "0.12.7", "path": "0.12.7",
"pem": "1.14.5", "pem": "1.14.5",
"prettier": "2.7.1", "prettier": "2.8.7",
"process": "0.11.10", "process": "0.11.10",
"rimraf": "3.0.2", "rimraf": "3.0.2",
"semantic-release": "19.0.3", "semantic-release": "19.0.3",

View File

@@ -13,10 +13,7 @@
# misc # misc
.DS_Store .DS_Store
.env.local .env.*
.env.development.local
.env.test.local
.env.production.local
npm-debug.log* npm-debug.log*
yarn-debug.log* yarn-debug.log*

File diff suppressed because it is too large Load Diff

View File

@@ -3,10 +3,10 @@
"password": "", "password": "",
"sasJsConfig": { "sasJsConfig": {
"serverUrl": "", "serverUrl": "",
"appLoc": "/Public/app/adapter-tests", "appLoc": "/Public/app/adapter-tests/services",
"serverType": "SASJS", "serverType": "SASJS",
"debug": false, "debug": false,
"contextName": "sasjs adapter compute context", "contextName": "sasjs adapter compute context",
"useComputeApi": true "useComputeApi": true
} }
} }

View File

@@ -1,17 +1,29 @@
{ {
"$schema": "https://cli.sasjs.io/sasjsconfig-schema.json", "$schema": "https://cli.sasjs.io/sasjsconfig-schema.json",
"serviceConfig": { "serviceConfig": {
"serviceFolders": [ "serviceFolders": ["sasjs/common"]
"sasjs/common"
]
}, },
"defaultTarget": "4gl", "defaultTarget": "4gl",
"targets": [ "targets": [
{ {
"name": "4gl", "name": "4gl",
"serverType": "SASJS",
"serverUrl": "https://sas9.4gl.io", "serverUrl": "https://sas9.4gl.io",
"appLoc": "/Public/app/adapter-tests" "serverType": "SASJS",
"httpsAgentOptions": {
"allowInsecureRequests": false
},
"appLoc": "/Public/app/adapter-tests",
"deployConfig": {
"deployServicePack": true,
"deployScripts": []
},
"streamConfig": {
"streamWeb": true,
"streamWebFolder": "webv",
"webSourcePath": "build",
"streamServiceName": "adapter-tests",
"assetPaths": []
}
} }
] ]
} }