Skip to content

Commit

Permalink
SBVT-2390 SCM tracking (#240)
Browse files Browse the repository at this point in the history
* SBVT-2390 SCM tracking

* SBVT-2390 SCM tracking
  • Loading branch information
marcinmatujewiczn authored May 15, 2024
1 parent 27f7ba9 commit 7e352da
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 4 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/browser_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: browser-type-check
on: [pull_request]
jobs:
cypress-run:
runs-on: ubuntu-latest
runs-on: self-hosted
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -47,4 +47,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PROJECT_TOKEN: ${{ secrets.DEV_EXAMPLE_7 }}
TEST_RUN_NAME: ${{ steps.set-test-run-name.outputs.TEST_RUN_NAME }}
SBVT_SCM_BRANCH: ${{ github.head_ref || github.ref_name }}
SBVT_SCM_COMMIT_ID: ${{ github.sha }}
DEBUG: TRUE
6 changes: 5 additions & 1 deletion .github/workflows/cypress_version-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: cypress-version-check
on: [pull_request]
jobs:
cypress-run:
runs-on: ubuntu-latest
runs-on: self-hosted
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -69,6 +69,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PROJECT_TOKEN: ${{ secrets.DEV_EXAMPLE_7 }}
TEST_RUN_NAME: ${{ steps.set-test-run-name.outputs.TEST_RUN_NAME }}
SBVT_SCM_BRANCH: ${{ github.head_ref || github.ref_name }}
SBVT_SCM_COMMIT_ID: ${{ github.sha }}
DEBUG: TRUE


Expand Down Expand Up @@ -114,4 +116,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PROJECT_TOKEN: ${{ secrets.DEV_EXAMPLE_7 }}
TEST_RUN_NAME: ${{ steps.set-test-run-name.outputs.TEST_RUN_NAME }}
SBVT_SCM_BRANCH: ${{ github.head_ref || github.ref_name }}
SBVT_SCM_COMMIT_ID: ${{ github.sha }}
DEBUG: TRUE
4 changes: 3 additions & 1 deletion .github/workflows/linux_quick-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on: [push]
#on: [pull_request]
jobs:
cypress-run:
runs-on: ubuntu-latest
runs-on: self-hosted
strategy:
fail-fast: true

Expand Down Expand Up @@ -35,6 +35,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PROJECT_TOKEN: ${{ secrets.DEV_EXAMPLE_7 }}
TEST_RUN_NAME: ${{ steps.set-test-run-name.outputs.TEST_RUN_NAME }}
SBVT_SCM_BRANCH: ${{ github.head_ref || github.ref_name }}
SBVT_SCM_COMMIT_ID: ${{ github.sha }}
DEBUG: TRUE


2 changes: 2 additions & 0 deletions .github/workflows/mac_windows_quick-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PROJECT_TOKEN: ${{ secrets.DEV_EXAMPLE_7 }}
TEST_RUN_NAME: "${{ github.workflow }}—${{ runner.os }}—${{ github.ref }}"
SBVT_SCM_BRANCH: ${{ github.head_ref || github.ref_name }}
SBVT_SCM_COMMIT_ID: ${{ github.sha }}
DEBUG: TRUE


Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/npm-package_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PROJECT_TOKEN: ${{ secrets.DEV_EXAMPLE_7 }}
TEST_RUN_NAME: ${{ steps.set-test-run-name.outputs.TEST_RUN_NAME }}
SBVT_SCM_BRANCH: ${{ github.head_ref || github.ref_name }}
SBVT_SCM_COMMIT_ID: ${{ github.sha }}
DEBUG: TRUE


2 changes: 2 additions & 0 deletions .github/workflows/print_report-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PROJECT_TOKEN: ${{ secrets.DEV_EXAMPLE_7 }}
TEST_RUN_NAME: "${{ github.workflow }}—${{ runner.os }}—${{ github.ref }}"
SBVT_SCM_BRANCH: ${{ github.head_ref || github.ref_name }}
SBVT_SCM_COMMIT_ID: ${{ github.sha }}
DEBUG: TRUE


2 changes: 2 additions & 0 deletions .github/workflows/typescript-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PROJECT_TOKEN: ${{ secrets.DEV_EXAMPLE_7 }}
TEST_RUN_NAME: ${{ steps.set-test-run-name.outputs.TEST_RUN_NAME }}
SBVT_SCM_BRANCH: ${{ github.head_ref || github.ref_name }}
SBVT_SCM_COMMIT_ID: ${{ github.sha }}
DEBUG: TRUE


2 changes: 2 additions & 0 deletions .github/workflows/webkit-browser_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PROJECT_TOKEN: ${{ secrets.DEV_EXAMPLE_7 }}
TEST_RUN_NAME: "${{ github.workflow }}—${{ runner.os }}—${{ github.ref }}"
SBVT_SCM_BRANCH: ${{ github.head_ref || github.ref_name }}
SBVT_SCM_COMMIT_ID: ${{ github.sha }}
DEBUG: TRUE
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@ module.exports = {
// OR save on the environment variable
// SBVT_TEST_GROUP_NAME = 'test group name'
```
## Assigning SCM data to a test run

Save Source Control Manager data on the environment variable
```bash
SBVT_SCM_BRANCH=branch-name
SBVT_SCM_COMMIT_ID=commit-hash
```

## Manual Setup

Expand Down
5 changes: 4 additions & 1 deletion plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,10 @@ function makeGlobalRunHooks() {
const postResponse = await apiRequest('post', `${configFile.url}/api/v1/projects/${configFile.projectId}/testruns`, {
testRunName: configFile.testRunName,
sdk: 'cypress',
sdkVersion: `${package_json.version}/c${usersCypress.version}`, ...(!!process.env.SBVT_TEST_GROUP_ID ? {testGroupId: process.env.SBVT_TEST_GROUP_ID} : !!configFile.testGroupName ? {testGroupId: await getCreateTestGroupId(getUsersTestGroupName(configFile.testGroupName), configFile.projectToken)} : {}),
sdkVersion: `${package_json.version}/c${usersCypress.version}`,
...(!!process.env.SBVT_TEST_GROUP_ID ? {testGroupId: process.env.SBVT_TEST_GROUP_ID} : !!configFile.testGroupName ? {testGroupId: await getCreateTestGroupId(getUsersTestGroupName(configFile.testGroupName), configFile.projectToken)} : {}),
...(!!process.env.SBVT_SCM_COMMIT_ID ? {scmCommitId: process.env.SBVT_SCM_COMMIT_ID} : {}),
...(!!process.env.SBVT_SCM_BRANCH ? {scmBranch: process.env.SBVT_SCM_BRANCH} : {}),
});
configFile.testRunId = postResponse.data.testRunId;
logger.debug('config.testRunId: ' + configFile.testRunId);
Expand Down

0 comments on commit 7e352da

Please sign in to comment.