Skip to content

Commit 1329b83

Browse files
author
Tim McMackin
committed
Tests
1 parent 84f4b94 commit 1329b83

1 file changed

Lines changed: 67 additions & 0 deletions

File tree

.github/workflows/pr-tests.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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+
steps:
32+
- uses: actions/checkout@v2
33+
- uses: actions/setup-node@v1
34+
with:
35+
node-version: 22
36+
37+
- run: npm ci
38+
39+
# Set up remote tests
40+
- run: git clone https://gitlab.com/nomadic-labs/doclib.git
41+
- run: npm i
42+
working-directory: doclib
43+
44+
# Tests:
45+
# - Run tests from the doclib repo
46+
# - Pass the changed files as a comma-separated list
47+
48+
- name: Image links check
49+
run: npm run imageLinks -- --baseFolder=.. --imageFolder=static --docFiles=${{ needs.checkChangedFiles.outputs.files }} --reporter mocha-junit-reporter --reporter-options mochaFile=../imageLinks.xml
50+
continue-on-error: true
51+
working-directory: doclib
52+
53+
- name: Unused images check
54+
run: npm run usedImages -- --baseFolder=.. --docFiles=docs --imageFolder=static --ignoreImages=img/site --reporter mocha-junit-reporter --reporter-options mochaFile=../usedImages.xml
55+
continue-on-error: true
56+
working-directory: doclib
57+
58+
- name: Dependency proposer
59+
run: npm run proposeDependencies -- --baseFolder=.. --docFiles=${{ needs.checkChangedFiles.outputs.files }} --major --reporter mocha-junit-reporter --reporter-options mochaFile=../proposedDependencies.xml
60+
continue-on-error: true
61+
working-directory: doclib
62+
63+
# Report tests on PR
64+
- uses: mikepenz/action-junit-report@v5
65+
if: ${{ !cancelled() }}
66+
with:
67+
report_paths: 'imageLinks.xml,usedImages.xml,proposedDependencies.xml'

0 commit comments

Comments
 (0)