Skip to content

Commit 18bd42e

Browse files
Raphaël DrozRaphaël Droz
andauthored
ci: Allow running the CI for external PR and optimize the workflow so that CI-based changes do not trigger useless SauceLabs runs (#364)
Co-authored-by: Raphaël Droz <raphael.droz+floss@gmail.com>
1 parent 349c5cc commit 18bd42e

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

.github/workflows/actions.yml

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,42 +17,68 @@ env:
1717
jobs:
1818
prepare:
1919
runs-on: ubuntu-latest
20+
environment: open-env
2021
steps:
2122
- name: Checkout
2223
uses: actions/checkout@v2
24+
with:
25+
fetch-depth: 2
26+
27+
- name: Is environment ok
28+
run: |
29+
echo $SAUCE_USERNAME
30+
31+
- name: Get specific changed files
32+
id: source-changed
33+
uses: tj-actions/changed-files@v1.1.3
34+
with:
35+
files: |
36+
src
37+
test
38+
karma.conf.js
39+
Gruntfile.js
40+
rollup.config.js
2341
2442
- name: Install node.js
43+
if: steps.source-changed.outputs.any_changed == 'true'
2544
uses: actions/setup-node@v1
2645
with:
2746
node-version: 14.x
2847

2948
- name: Install xvfb
49+
if: steps.source-changed.outputs.any_changed == 'true'
3050
run: |
3151
sudo apt-get install xvfb
3252
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
3353
3454
- name: Install dependencies
55+
if: steps.source-changed.outputs.any_changed == 'true'
3556
run: |
3657
npm install
3758
npm install -g grunt-cli
3859
node_modules/.bin/rollup -c
3960
4061
- name: Install saucectl
62+
if: steps.source-changed.outputs.any_changed == 'true'
4163
uses: saucelabs/saucectl-run-action@v1
4264
with:
4365
skip-run: true
4466
testing-environment: ""
4567
concurrency: 10
4668

47-
- run: |
69+
- name: Grunt test
70+
if: steps.source-changed.outputs.any_changed == 'true'
71+
run: |
4872
grunt --version
4973
sed -i '/log.info(`Check out job at/a\\ console.log(`::set-output name=urls-${sessionId}::${getSauceEndpoint(browserData.region)}${sessionId}`);' node_modules/karma-sauce-launcher/dist/reporter/reporter.js || true
5074
5175
- name: Run tests
76+
if: steps.source-changed.outputs.any_changed == 'true'
5277
run: grunt karma:saucelabs
5378
id: test
5479

5580
- name: Run code coverage
81+
if: steps.source-changed.outputs.any_changed == 'true'
5682
uses: paambaati/codeclimate-action@v2.7.5
5783
with:
5884
coverageCommand: grunt karma:coverage
@@ -66,7 +92,7 @@ jobs:
6692
run: ls -lhR coverage || true
6793

6894
- uses: LouisBrunner/checks-action@v1.1.1
69-
if: always()
95+
if: steps.source-changed.outputs.any_changed == 'true'
7096
with:
7197
token: ${{ secrets.GITHUB_TOKEN }}
7298
name: Testsuite passed

0 commit comments

Comments
 (0)