Skip to content

Commit 5cbb8fe

Browse files
author
Tim McMackin
committed
Tests
1 parent 0edda9f commit 5cbb8fe

1 file changed

Lines changed: 72 additions & 0 deletions

File tree

.github/workflows/pr-tests.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Tests
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened, synchronize]
6+
7+
jobs:
8+
9+
checkChangedFiles:
10+
runs-on: ubuntu-latest
11+
outputs:
12+
files: ${{ steps.files.outputs.added_modified }}
13+
steps:
14+
- uses: actions/checkout@v2
15+
- id: files
16+
uses: Ana06/get-changed-files@v1.2
17+
with:
18+
format: 'csv'
19+
filter: '*.mdx?'
20+
21+
tests:
22+
runs-on: ubuntu-latest
23+
needs: checkChangedFiles
24+
if: ${{ needs.checkChangedFiles.outputs.files != '' }}
25+
steps:
26+
- uses: actions/checkout@v2
27+
- uses: actions/setup-node@v1
28+
with:
29+
node-version: 22
30+
31+
- run: npm ci
32+
33+
# Set up remote tests
34+
- run: git clone https://gitlab.com/nomadic-labs/doclib.git
35+
- run: cd doclib
36+
- run: npm i
37+
38+
# Tests:
39+
# - Run tests from the doclib repo
40+
# - Pass the changed files as a comma-separated list
41+
42+
# Image links check
43+
- run: npm run imageLinks -- --baseFolder=.. --imageFolder=static --docFiles=${{ needs.checkChangedFiles.outputs.files }} --reporter mocha-junit-reporter --reporter-options mochaFile=../imageLinks.xml
44+
continue-on-error: true
45+
46+
# Unused images check
47+
- run: npm run usedImages -- --baseFolder=.. --docFiles=docs --imageFolder=static --ignoreImages=img/site --reporter mocha-junit-reporter --reporter-options mochaFile=../usedImages.xml
48+
continue-on-error: true
49+
50+
# Dependency proposer
51+
- run: npm run proposeDependencies -- --baseFolder=.. --docFiles=${{ needs.checkChangedFiles.outputs.files }} --major --reporter mocha-junit-reporter --reporter-options mochaFile=../proposedDependencies.json
52+
continue-on-error: true
53+
54+
# Report tests on PR
55+
- uses: dorny/test-reporter@v2
56+
if: ${{ !cancelled() }}
57+
with:
58+
name: Image link tests
59+
path: imageLinks.json
60+
reporter: mocha-json
61+
- uses: dorny/test-reporter@v2
62+
if: ${{ !cancelled() }}
63+
with:
64+
name: Used image tests
65+
path: usedImages.json
66+
reporter: mocha-json
67+
- uses: dorny/test-reporter@v2
68+
if: ${{ !cancelled() }}
69+
with:
70+
name: Propose dependencies
71+
path: proposedDependencies.json
72+
reporter: mocha-json

0 commit comments

Comments
 (0)