Skip to content

Commit 882e849

Browse files
author
Tim McMackin
committed
Tests
1 parent 523b649 commit 882e849

1 file changed

Lines changed: 74 additions & 0 deletions

File tree

.github/workflows/pr-tests.yml

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

0 commit comments

Comments
 (0)