Skip to content

Commit 2c9d96f

Browse files
committed
CI TESTS: Update Github workflow to pass integration tests using Xvfb
`npm run test-integration` uses Electron and therefore needs a display to work properly. Other changes: - Add a build step to make sure `npm run build` is always ran (dist/ could change without a package-lock.json change, I think) - Cache: add ~/.npm and fix /tmp/.__tmp_int (test-meteor-desktop path) - Trigger action for all pull requests, not only those against master - Update actions/checkout to v4 - Renaming
1 parent ba03c2e commit 2c9d96f

File tree

1 file changed

+48
-37
lines changed

1 file changed

+48
-37
lines changed

.github/workflows/test.yml

+48-37
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,80 @@
1-
21
on:
3-
push:
4-
branches:
5-
- master
62
pull_request:
3+
push:
74
branches:
85
- master
96

7+
env:
8+
METEOR_VERSION: 2.6.1
9+
1010
jobs:
1111
build:
1212
name: Build and Install
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v3
16-
- name: Cache dependencies
15+
- uses: actions/checkout@v4
16+
- name: Get Cache dependencies
1717
uses: actions/cache@v3
1818
id: files-cache
1919
with:
20-
path: |
21-
node_modules
22-
dist/
23-
~/.meteor
24-
/tmp/tests/.__tmp_int
25-
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
20+
path: |
21+
dist
22+
node_modules
23+
/tmp/.__tmp_int
24+
~/.meteor
25+
~/.npm
26+
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
2627
- name: Install/Retrieve Meteor
2728
if: steps.files-cache.outputs.cache-hit != 'true'
28-
run: curl https://install.meteor.com/?release=2.6.1 | /bin/sh
29+
run: curl https://install.meteor.com/?release=${{ env.METEOR_VERSION }} | /bin/sh
2930
- name: Install NPM Dependencies
31+
# Creates dist/ through postinstall->build script
3032
if: steps.files-cache.outputs.cache-hit != 'true'
31-
run: meteor npm ci
33+
run: ~/.meteor/meteor npm ci
34+
- name: Run build script
35+
# Make sure dist/ is up-to-date when package-lock.json hasn't changed
36+
if: steps.files-cache.outputs.cache-hit == 'true'
37+
run: ~/.meteor/meteor npm run build
3238

33-
test:
39+
unit-tests:
3440
needs: build
3541
name: Unit Tests
3642
runs-on: ubuntu-latest
3743
steps:
38-
- uses: actions/checkout@v3
39-
- name: Get Cache dependencies
40-
uses: actions/cache@v3
41-
id: files-cache
42-
with:
43-
path: |
44-
node_modules
45-
dist/
46-
~/.meteor
47-
/tmp/tests/.__tmp_int
48-
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
49-
- name: Unit Tests
50-
run: ~/.meteor/meteor npm run test
44+
- uses: actions/checkout@v4
45+
- name: Get Cache dependencies
46+
uses: actions/cache@v3
47+
id: files-cache
48+
with:
49+
path: |
50+
dist
51+
node_modules
52+
/tmp/.__tmp_int
53+
~/.meteor
54+
~/.npm
55+
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
56+
- name: Run test script
57+
run: ~/.meteor/meteor npm run test
5158

52-
test-integration:
59+
integration-tests:
5360
needs: build
5461
name: Integration Tests
5562
runs-on: ubuntu-latest
5663
steps:
57-
- uses: actions/checkout@v3
64+
- uses: actions/checkout@v4
5865
- name: Get Cache dependencies
5966
uses: actions/cache@v3
6067
id: files-cache
6168
with:
62-
path: |
63-
node_modules
64-
dist/
65-
~/.meteor
66-
/tmp/tests/.__tmp_int
67-
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
69+
path: |
70+
dist
71+
node_modules
72+
/tmp/.__tmp_int
73+
~/.meteor
74+
~/.npm
75+
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
6876
- run: ~/.meteor/meteor npm run prepare-integration-tests
69-
- run: ~/.meteor/meteor npm run test-integration
77+
- name: Run test-integration script (using Xvfb)
78+
uses: coactions/setup-xvfb@v1
79+
with: # needs full path to meteor
80+
run: /home/runner/.meteor/meteor npm run test-integration

0 commit comments

Comments
 (0)