-
-
Notifications
You must be signed in to change notification settings - Fork 8k
137 lines (129 loc) · 4.56 KB
/
ci-javascript.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# 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