-
Notifications
You must be signed in to change notification settings - Fork 916
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CI] Add tests to github workflow #906
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a particular reason why we're not using |
||
with: | ||
node-version: "10.24.1" | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- name: Setup Yarn | ||
run: | | ||
npm uninstall -g yarn | ||
npm i -g yarn@1.22.10 | ||
|
||
- 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this mean we will skip some unit tests below for now? Any plan to bring them back? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. only for github actions. locally if this env var is not set it will still run them. the next step would be to 'quarantine' the bad apples and fix them or drop them. more likely to fix them since they work well on good hardware but work bad on bad hardware. |
||
|
||
- 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 yarn@1.22.10 | ||
|
||
- 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To clarify, GitHub can only pull the latest? There's no way to specify a particular version? |
||
|
||
- 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 }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we have this run on all branches? That would catch any potential unexpected merge issues/conflicts.