Skip to content

CI - JavaScript

CI - JavaScript #2407

Workflow file for this run

# Configuration for JavaScript CI
# To force the execution of this workflow, add [run javascript] to your commit message
name: 'CI - JavaScript'
on:
workflow_dispatch:
schedule:
- cron: '45 9,21 * * *'
push:
pull_request:
jobs:
check_workflow:
permissions:
contents: none
uses: ./.github/workflows/should-workflow-run.yml
with:
bazel-target-prefix: '//javascript'
node_tests:
if: ${{ needs.check_workflow.outputs.result == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(toJson(github.event.commits), '[run javascript]') == true }}
needs: check_workflow
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- { "browser": "firefox", "version": "latest" }
- { "browser": "chrome", "version": "stable" }
steps:
- name: Checkout source tree
uses: actions/checkout@v2
- name: Cache Bazel artifacts
uses: actions/cache@v2
with:
path: |
~/.cache/bazel-disk
~/.cache/bazel-repo
key: ${{ runner.os }}-bazel-node-tests-${{ hashFiles('**/BUILD.bazel') }}
restore-keys: |
${{ runner.os }}-bazel-node-tests-
${{ runner.os }}-bazel-build-
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: '16.x'
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: 11
- name: Setup bazelisk
uses: ./.github/actions/setup-bazelisk
- name: Setup Fluxbox
run: sudo apt-get -y install fluxbox
- name: Setup Firefox and GeckoDriver
uses: ./.github/actions/setup-firefox
with:
version: ${{ matrix.version }}
if: |
matrix.browser == 'firefox'
- name: Setup Chrome and ChromeDriver
uses: ./.github/actions/setup-chrome
with:
version: ${{ matrix.version }}
if: |
matrix.browser == 'chrome'
- name: Start XVFB
run: Xvfb :99 &
- name: Run JavaScript tests
uses: ./.github/actions/bazel-test
with:
query: //javascript/node/selenium-webdriver:tests
attempts: 3
env:
DISPLAY: :99
SELENIUM_BROWSER: ${{ matrix.browser }}
firefox_atom_tests:
if: ${{ needs.check_workflow.outputs.result == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(toJson(github.event.commits), '[run javascript]') == true }}
needs: check_workflow
runs-on: ubuntu-latest
steps:
- name: Checkout source tree
uses: actions/checkout@v2
- name: Cache Bazel artifacts
uses: actions/cache@v2
with:
path: |
~/.cache/bazel-disk
~/.cache/bazel-repo
key: ${{ runner.os }}-bazel-atom-firefox-tests-${{ hashFiles('**/BUILD.bazel') }}
restore-keys: |
${{ runner.os }}-bazel-atom-firefox-tests-
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: 11
- name: Setup bazelisk
uses: ./.github/actions/setup-bazelisk
- name: Setup Fluxbox
run: sudo apt-get -y install fluxbox
- name: Setup Firefox and GeckoDriver
uses: ./.github/actions/setup-firefox
with:
version: ${{ matrix.version }}
- name: Start XVFB
run: Xvfb :99 &
- name: Start Fluxbox
run: fluxbox -display :99 &
- name: Run atom tests on Firefox
uses: ./.github/actions/bazel
with:
command: test --test_tag_filters=firefox //javascript/atoms/... //javascript/selenium-atoms/... //javascript/webdriver/...
env:
DISPLAY: :99
SELENIUM_BROWSER: firefox
# As soon as this gets merged https://github.com/facebook/jest/pull/9351, we should upgrade Jest and
# run bazel test javascript/grid-ui:test for these tests
grid_ui_unit_tests:
if: ${{ needs.check_workflow.outputs.result == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(toJson(github.event.commits), '[run javascript]') == true }}
needs: check_workflow
runs-on: ubuntu-latest
steps:
- name: Checkout source tree
uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '16.x'
- name: NPM install
run: cd javascript/grid-ui && npm install
- name: Run unit tests
run: cd javascript/grid-ui && npm test