Merge pull request #9706 from Budibase/qa-2-qa-job-for-nightly-api-test
Re-enabling nightly tests
This commit is contained in:
commit
33b08faffa
|
@ -7,7 +7,7 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
nightly:
|
nightly:
|
||||||
runs-on: ubuntu-latest
|
runs-on: [self-hosted, qa]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
@ -15,30 +15,17 @@ jobs:
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: 14.x
|
node-version: 14.x
|
||||||
- run: yarn
|
- name: QA Core Integration Tests
|
||||||
- run: yarn bootstrap
|
|
||||||
- run: yarn build
|
|
||||||
- name: Pull from budibase-infra
|
|
||||||
run: |
|
run: |
|
||||||
curl -H "Authorization: token ${{ secrets.GH_PERSONAL_TOKEN }}" \
|
cd qa-core
|
||||||
-H 'Accept: application/vnd.github.v3.raw' \
|
yarn
|
||||||
-o
|
yarn api:test:ci
|
||||||
-L
|
env:
|
||||||
wc -l
|
BUDIBASE_HOST: budicloud.qa.budibase.net
|
||||||
|
BUDIBASE_ACCOUNTS_URL: https://account-portal.budicloud.qa.budibase.net
|
||||||
- uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: Test Reports
|
|
||||||
path:
|
|
||||||
|
|
||||||
# TODO: enable once running in QA test env
|
- name: Cypress Discord Notify
|
||||||
# - name: Configure AWS Credentials
|
run: yarn test:notify
|
||||||
# uses: aws-actions/configure-aws-credentials@v1
|
env:
|
||||||
# with:
|
WEBHOOK_URL: ${{ secrets.BUDI_QA_WEBHOOK }}
|
||||||
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
GITHUB_RUN_URL: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID
|
||||||
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
||||||
# aws-region: eu-west-1
|
|
||||||
|
|
||||||
# - name: Upload test results HTML
|
|
||||||
# uses: aws-actions/configure-aws-credentials@v1
|
|
||||||
# run: aws s3 cp packages/builder/cypress/reports/testReport.html s3://{{ secrets.BUDI_QA_REPORTS_BUCKET_NAME }}/$GITHUB_RUN_ID/index.html
|
|
|
@ -18,7 +18,6 @@
|
||||||
import { TableNames, UNEDITABLE_USER_FIELDS } from "constants"
|
import { TableNames, UNEDITABLE_USER_FIELDS } from "constants"
|
||||||
import {
|
import {
|
||||||
FIELDS,
|
FIELDS,
|
||||||
AUTO_COLUMN_SUB_TYPES,
|
|
||||||
RelationshipTypes,
|
RelationshipTypes,
|
||||||
ALLOWABLE_STRING_OPTIONS,
|
ALLOWABLE_STRING_OPTIONS,
|
||||||
ALLOWABLE_NUMBER_OPTIONS,
|
ALLOWABLE_NUMBER_OPTIONS,
|
||||||
|
@ -132,12 +131,6 @@
|
||||||
: availableAutoColumns
|
: availableAutoColumns
|
||||||
|
|
||||||
// used to select what different options can be displayed for column type
|
// used to select what different options can be displayed for column type
|
||||||
$: canBeSearched =
|
|
||||||
editableColumn?.type !== LINK_TYPE &&
|
|
||||||
editableColumn?.type !== JSON_TYPE &&
|
|
||||||
editableColumn?.subtype !== AUTO_COLUMN_SUB_TYPES.CREATED_BY &&
|
|
||||||
editableColumn?.subtype !== AUTO_COLUMN_SUB_TYPES.UPDATED_BY &&
|
|
||||||
editableColumn?.type !== FORMULA_TYPE
|
|
||||||
$: canBeDisplay =
|
$: canBeDisplay =
|
||||||
editableColumn?.type !== LINK_TYPE &&
|
editableColumn?.type !== LINK_TYPE &&
|
||||||
editableColumn?.type !== AUTO_TYPE &&
|
editableColumn?.type !== AUTO_TYPE &&
|
||||||
|
@ -254,18 +247,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onChangePrimaryIndex(e) {
|
|
||||||
indexes = e.detail ? [editableColumn.name] : []
|
|
||||||
}
|
|
||||||
|
|
||||||
function onChangeSecondaryIndex(e) {
|
|
||||||
if (e.detail) {
|
|
||||||
indexes[1] = editableColumn.name
|
|
||||||
} else {
|
|
||||||
indexes = indexes.slice(0, 1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function openJsonSchemaEditor() {
|
function openJsonSchemaEditor() {
|
||||||
jsonSchemaModal.show()
|
jsonSchemaModal.show()
|
||||||
}
|
}
|
||||||
|
@ -460,24 +441,6 @@
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if canBeSearched && !external}
|
|
||||||
<div>
|
|
||||||
<Label>Search Indexes</Label>
|
|
||||||
<Toggle
|
|
||||||
value={indexes[0] === editableColumn.name}
|
|
||||||
disabled={indexes[1] === editableColumn.name}
|
|
||||||
on:change={onChangePrimaryIndex}
|
|
||||||
text="Primary"
|
|
||||||
/>
|
|
||||||
<Toggle
|
|
||||||
value={indexes[1] === editableColumn.name}
|
|
||||||
disabled={!indexes[0] || indexes[0] === editableColumn.name}
|
|
||||||
on:change={onChangeSecondaryIndex}
|
|
||||||
text="Secondary"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if editableColumn.type === "string"}
|
{#if editableColumn.type === "string"}
|
||||||
<Input
|
<Input
|
||||||
type="number"
|
type="number"
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
node_modules/
|
node_modules/
|
||||||
.env
|
.env
|
||||||
watchtower-hook.json
|
watchtower-hook.json
|
||||||
dist/
|
dist/
|
||||||
|
.testReport.json
|
||||||
|
|
|
@ -9,9 +9,10 @@
|
||||||
"url": "https://github.com/Budibase/budibase.git"
|
"url": "https://github.com/Budibase/budibase.git"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "env-cmd jest --runInBand",
|
"test": "env-cmd jest --runInBand --json --outputFile=testResults.json",
|
||||||
"test:watch": "env-cmd jest --watch",
|
"test:watch": "env-cmd jest --watch",
|
||||||
"test:debug": "DEBUG=1 jest",
|
"test:debug": "DEBUG=1 jest",
|
||||||
|
"test:notify": "node scripts/testResultsWebhook",
|
||||||
"docker:up": "docker-compose up -d",
|
"docker:up": "docker-compose up -d",
|
||||||
"docker:down": "docker-compose down",
|
"docker:down": "docker-compose down",
|
||||||
"api:server:setup": "npm run docker:up && env-cmd ts-node ../packages/builder/ts/setup.ts",
|
"api:server:setup": "npm run docker:up && env-cmd ts-node ../packages/builder/ts/setup.ts",
|
||||||
|
|
|
@ -4,37 +4,30 @@ const fetch = require("node-fetch")
|
||||||
const path = require("path")
|
const path = require("path")
|
||||||
const fs = require("fs")
|
const fs = require("fs")
|
||||||
|
|
||||||
const WEBHOOK_URL = process.env.CYPRESS_WEBHOOK_URL
|
const WEBHOOK_URL = process.env.WEBHOOK_URL
|
||||||
const DASHBOARD_URL = process.env.CYPRESS_DASHBOARD_URL
|
|
||||||
const GIT_SHA = process.env.GITHUB_SHA
|
const GIT_SHA = process.env.GITHUB_SHA
|
||||||
const GITHUB_ACTIONS_RUN_URL = process.env.GITHUB_ACTIONS_RUN_URL
|
const GITHUB_ACTIONS_RUN_URL = process.env.GITHUB_ACTIONS_RUN_URL
|
||||||
|
|
||||||
async function generateReport() {
|
async function generateReport() {
|
||||||
// read the report file
|
// read the report file
|
||||||
const REPORT_PATH = path.resolve(
|
const REPORT_PATH = path.resolve(__dirname, "..", "testReport.json")
|
||||||
__dirname,
|
|
||||||
"..",
|
|
||||||
"cypress",
|
|
||||||
"reports",
|
|
||||||
"testReport.json"
|
|
||||||
)
|
|
||||||
const report = fs.readFileSync(REPORT_PATH, "utf-8")
|
const report = fs.readFileSync(REPORT_PATH, "utf-8")
|
||||||
return JSON.parse(report)
|
return JSON.parse(report)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function discordCypressResultsNotification(report) {
|
async function discordResultsNotification(report) {
|
||||||
const {
|
const {
|
||||||
suites,
|
numTotalTestSuites,
|
||||||
tests,
|
numTotalTests,
|
||||||
passes,
|
numPassedTests,
|
||||||
pending,
|
numPendingTests,
|
||||||
failures,
|
numFailedTests,
|
||||||
duration,
|
success,
|
||||||
passPercent,
|
startTime,
|
||||||
skipped,
|
endTime,
|
||||||
} = report.stats
|
} = report
|
||||||
|
|
||||||
const OUTCOME = failures > 0 ? "failure" : "success"
|
const OUTCOME = success ? "success" : "failure"
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
|
@ -68,51 +61,51 @@ async function discordCypressResultsNotification(report) {
|
||||||
name: "Commit",
|
name: "Commit",
|
||||||
value: `https://github.com/Budibase/budibase/commit/${GIT_SHA}`,
|
value: `https://github.com/Budibase/budibase/commit/${GIT_SHA}`,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "Cypress Dashboard URL",
|
|
||||||
value: DASHBOARD_URL || "None Supplied",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: "Github Actions Run URL",
|
name: "Github Actions Run URL",
|
||||||
value: GITHUB_ACTIONS_RUN_URL || "None Supplied",
|
value: GITHUB_ACTIONS_RUN_URL || "None Supplied",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Test Suites",
|
name: "Test Suites",
|
||||||
value: suites,
|
value: numTotalTestSuites,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Tests",
|
name: "Tests",
|
||||||
value: tests,
|
value: numTotalTests,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Passed",
|
name: "Passed",
|
||||||
value: passes,
|
value: numPassedTests,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Pending",
|
name: "Pending",
|
||||||
value: pending,
|
value: numPendingTests,
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Skipped",
|
|
||||||
value: skipped,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Failures",
|
name: "Failures",
|
||||||
value: failures,
|
value: numFailedTests,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Duration",
|
name: "Duration",
|
||||||
value: `${duration / 1000} Seconds`,
|
value: endTime
|
||||||
|
? `${(endTime - startTime) / 1000} Seconds`
|
||||||
|
: "DNF",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Pass Percentage",
|
name: "Pass Percentage",
|
||||||
value: Math.floor(passPercent),
|
value: Math.floor((numPassedTests / numTotalTests) * 100),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Only post in discord when tests fail
|
||||||
|
if (success) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const response = await fetch(WEBHOOK_URL, options)
|
const response = await fetch(WEBHOOK_URL, options)
|
||||||
|
|
||||||
if (response.status >= 201) {
|
if (response.status >= 201) {
|
||||||
|
@ -125,7 +118,7 @@ async function discordCypressResultsNotification(report) {
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
const report = await generateReport()
|
const report = await generateReport()
|
||||||
await discordCypressResultsNotification(report)
|
await discordResultsNotification(report)
|
||||||
}
|
}
|
||||||
|
|
||||||
run()
|
run()
|
Loading…
Reference in New Issue