-
Notifications
You must be signed in to change notification settings - Fork 916
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unit tests to github workflow and also creating a "bad apples" environment variable. Some unit tests just fail on the CI for hardware issues. They should be improved but step one will be calling out the bad apples. Next step will be improving. Also needed to limit the amount of workers because otherwise the hardware can't handle well so then it will accidentally create conflicts. This means we get an accurate test run but it is slower on the CI. Included integration tests which worked out of the box. Included e2e tests as well but it the chrome driver for the application was different from github's chrome so to run it I just upgraded it for the test run. Not ideal, ideally we should probably set up a docker env and install the specific versions since we are now depending on github's virtual env and the dependencies they installed there. But at least this is a first pace. Signed-off-by: Kawika Avilla <[email protected]>
- Loading branch information
Showing
7 changed files
with
115 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,107 @@ | ||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | ||
|
||
name: Node.js CI | ||
name: Build and test | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
build: | ||
env: | ||
CACHE_NAME: osd-node-modules | ||
TEST_BROWSER_HEADLESS: 1 | ||
CI: 1 | ||
GCS_UPLOAD_PREFIX: fake | ||
TEST_OPENSEARCH_DASHBOARDS_HOST: localhost | ||
TEST_OPENSEARCH_DASHBOARDS_PORT: 6610 | ||
TEST_OPENSEARCH_TRANSPORT_PORT: 9403 | ||
TEST_OPENSEARCH_PORT: 9400 | ||
|
||
jobs: | ||
build-lint-test: | ||
runs-on: ubuntu-latest | ||
name: Build and Verify | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: "10.24.1" | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- name: Setup Yarn | ||
run: | | ||
npm uninstall -g yarn | ||
npm i -g [email protected] | ||
- name: Run bootstrap | ||
run: yarn osd bootstrap | ||
|
||
- name: Run linter | ||
run: yarn lint | ||
|
||
- name: Run unit tests | ||
run: node scripts/jest --ci --colors --maxWorkers=10 | ||
env: | ||
SKIP_BAD_APPLES: true | ||
|
||
- name: Run integration tests | ||
run: node scripts/jest_integration --ci --colors --max-old-space-size=5120 | ||
functional-tests: | ||
needs: [ build-lint-test ] | ||
runs-on: ubuntu-latest | ||
name: Run functional tests | ||
strategy: | ||
matrix: | ||
group: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '10.24.1' | ||
check-latest: false | ||
- run: yarn osd bootstrap | ||
- run: yarn lint | ||
- run: echo Running functional tests for ciGroup${{ matrix.group }} | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: "10.24.1" | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- name: Setup Yarn | ||
run: | | ||
npm uninstall -g yarn | ||
npm i -g [email protected] | ||
- name: Get cache path | ||
id: cache-path | ||
run: echo "::set-output name=CACHE_DIR::$(yarn cache dir)" | ||
|
||
- name: Setup cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.cache-path.outputs.CACHE_DIR }} | ||
key: ${{ runner.os }}-yarn-${{ env.CACHE_NAME }}-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn-${{ env.CACHE_NAME }}- | ||
${{ runner.os }}-yarn- | ||
${{ runner.os }}- | ||
# github virtual env is the latest chrome | ||
- name: Setup chromedriver | ||
run: yarn add --dev chromedriver@latest | ||
|
||
- name: Run bootstrap | ||
run: yarn osd bootstrap | ||
|
||
- name: Build plugins | ||
run: node scripts/build_opensearch_dashboards_platform_plugins --no-examples --workers 10 | ||
|
||
- run: node scripts/functional_tests.js --config test/functional/config.js --include ciGroup${{ matrix.group }} | ||
env: | ||
CI_GROUP: ciGroup${{ matrix.group }} | ||
CI_PARALLEL_PROCESS_NUMBER: ciGroup${{ matrix.group }} | ||
JOB: ci${{ matrix.group }} | ||
CACHE_DIR: ciGroup${{ matrix.group }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters