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:
|
||||
nightly:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: [self-hosted, qa]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
@ -15,30 +15,17 @@ jobs:
|
|||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 14.x
|
||||
- run: yarn
|
||||
- run: yarn bootstrap
|
||||
- run: yarn build
|
||||
- name: Pull from budibase-infra
|
||||
- name: QA Core Integration Tests
|
||||
run: |
|
||||
curl -H "Authorization: token ${{ secrets.GH_PERSONAL_TOKEN }}" \
|
||||
-H 'Accept: application/vnd.github.v3.raw' \
|
||||
-o
|
||||
-L
|
||||
wc -l
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Test Reports
|
||||
path:
|
||||
cd qa-core
|
||||
yarn
|
||||
yarn api:test:ci
|
||||
env:
|
||||
BUDIBASE_HOST: budicloud.qa.budibase.net
|
||||
BUDIBASE_ACCOUNTS_URL: https://account-portal.budicloud.qa.budibase.net
|
||||
|
||||
# TODO: enable once running in QA test env
|
||||
# - name: Configure AWS Credentials
|
||||
# uses: aws-actions/configure-aws-credentials@v1
|
||||
# with:
|
||||
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_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
|
||||
- name: Cypress Discord Notify
|
||||
run: yarn test:notify
|
||||
env:
|
||||
WEBHOOK_URL: ${{ secrets.BUDI_QA_WEBHOOK }}
|
||||
GITHUB_RUN_URL: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID
|
|
@ -18,7 +18,6 @@
|
|||
import { TableNames, UNEDITABLE_USER_FIELDS } from "constants"
|
||||
import {
|
||||
FIELDS,
|
||||
AUTO_COLUMN_SUB_TYPES,
|
||||
RelationshipTypes,
|
||||
ALLOWABLE_STRING_OPTIONS,
|
||||
ALLOWABLE_NUMBER_OPTIONS,
|
||||
|
@ -132,12 +131,6 @@
|
|||
: availableAutoColumns
|
||||
|
||||
// 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 =
|
||||
editableColumn?.type !== LINK_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() {
|
||||
jsonSchemaModal.show()
|
||||
}
|
||||
|
@ -460,24 +441,6 @@
|
|||
</div>
|
||||
{/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"}
|
||||
<Input
|
||||
type="number"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
node_modules/
|
||||
.env
|
||||
watchtower-hook.json
|
||||
dist/
|
||||
dist/
|
||||
.testReport.json
|
||||
|
|
|
@ -9,9 +9,10 @@
|
|||
"url": "https://github.com/Budibase/budibase.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "env-cmd jest --runInBand",
|
||||
"test": "env-cmd jest --runInBand --json --outputFile=testResults.json",
|
||||
"test:watch": "env-cmd jest --watch",
|
||||
"test:debug": "DEBUG=1 jest",
|
||||
"test:notify": "node scripts/testResultsWebhook",
|
||||
"docker:up": "docker-compose up -d",
|
||||
"docker:down": "docker-compose down",
|
||||
"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 fs = require("fs")
|
||||
|
||||
const WEBHOOK_URL = process.env.CYPRESS_WEBHOOK_URL
|
||||
const DASHBOARD_URL = process.env.CYPRESS_DASHBOARD_URL
|
||||
const WEBHOOK_URL = process.env.WEBHOOK_URL
|
||||
const GIT_SHA = process.env.GITHUB_SHA
|
||||
const GITHUB_ACTIONS_RUN_URL = process.env.GITHUB_ACTIONS_RUN_URL
|
||||
|
||||
async function generateReport() {
|
||||
// read the report file
|
||||
const REPORT_PATH = path.resolve(
|
||||
__dirname,
|
||||
"..",
|
||||
"cypress",
|
||||
"reports",
|
||||
"testReport.json"
|
||||
)
|
||||
const REPORT_PATH = path.resolve(__dirname, "..", "testReport.json")
|
||||
const report = fs.readFileSync(REPORT_PATH, "utf-8")
|
||||
return JSON.parse(report)
|
||||
}
|
||||
|
||||
async function discordCypressResultsNotification(report) {
|
||||
async function discordResultsNotification(report) {
|
||||
const {
|
||||
suites,
|
||||
tests,
|
||||
passes,
|
||||
pending,
|
||||
failures,
|
||||
duration,
|
||||
passPercent,
|
||||
skipped,
|
||||
} = report.stats
|
||||
numTotalTestSuites,
|
||||
numTotalTests,
|
||||
numPassedTests,
|
||||
numPendingTests,
|
||||
numFailedTests,
|
||||
success,
|
||||
startTime,
|
||||
endTime,
|
||||
} = report
|
||||
|
||||
const OUTCOME = failures > 0 ? "failure" : "success"
|
||||
const OUTCOME = success ? "success" : "failure"
|
||||
|
||||
const options = {
|
||||
method: "POST",
|
||||
|
@ -68,51 +61,51 @@ async function discordCypressResultsNotification(report) {
|
|||
name: "Commit",
|
||||
value: `https://github.com/Budibase/budibase/commit/${GIT_SHA}`,
|
||||
},
|
||||
{
|
||||
name: "Cypress Dashboard URL",
|
||||
value: DASHBOARD_URL || "None Supplied",
|
||||
},
|
||||
{
|
||||
name: "Github Actions Run URL",
|
||||
value: GITHUB_ACTIONS_RUN_URL || "None Supplied",
|
||||
},
|
||||
{
|
||||
name: "Test Suites",
|
||||
value: suites,
|
||||
value: numTotalTestSuites,
|
||||
},
|
||||
{
|
||||
name: "Tests",
|
||||
value: tests,
|
||||
value: numTotalTests,
|
||||
},
|
||||
{
|
||||
name: "Passed",
|
||||
value: passes,
|
||||
value: numPassedTests,
|
||||
},
|
||||
{
|
||||
name: "Pending",
|
||||
value: pending,
|
||||
},
|
||||
{
|
||||
name: "Skipped",
|
||||
value: skipped,
|
||||
value: numPendingTests,
|
||||
},
|
||||
{
|
||||
name: "Failures",
|
||||
value: failures,
|
||||
value: numFailedTests,
|
||||
},
|
||||
{
|
||||
name: "Duration",
|
||||
value: `${duration / 1000} Seconds`,
|
||||
value: endTime
|
||||
? `${(endTime - startTime) / 1000} Seconds`
|
||||
: "DNF",
|
||||
},
|
||||
{
|
||||
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)
|
||||
|
||||
if (response.status >= 201) {
|
||||
|
@ -125,7 +118,7 @@ async function discordCypressResultsNotification(report) {
|
|||
|
||||
async function run() {
|
||||
const report = await generateReport()
|
||||
await discordCypressResultsNotification(report)
|
||||
await discordResultsNotification(report)
|
||||
}
|
||||
|
||||
run()
|
Loading…
Reference in New Issue