|
24 | 24 | ELASTICSEARCH_URL: http://localhost:9200/ |
25 | 25 |
|
26 | 26 | jobs: |
27 | | - figureOutMatrix: |
28 | | - if: github.repository == 'github/docs-internal' || github.repository == 'github/docs' |
29 | | - runs-on: ubuntu-latest |
30 | | - outputs: |
31 | | - matrix: ${{ steps.set-matrix.outputs.result }} |
32 | | - steps: |
33 | | - - uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 |
34 | | - id: set-matrix |
35 | | - with: |
36 | | - script: | |
37 | | - // We only want to run the 'languages' suite when we know |
38 | | - // we're on the private docs-internal repo because only that |
39 | | - // one has ability to clone the remote (private) languages |
40 | | - // repos. |
41 | | - // You can run multiple paths per suite as space-separated in `path`. |
42 | | - // Note that *if you add* to this, remember to also add that |
43 | | - // to the **required checks** in the branch protection rules. |
44 | | - return [ |
45 | | - { name: 'assets', path: 'src/assets/tests', }, |
46 | | - // { name: 'audit-logs', path: 'src/assets/audit-logs', }, |
47 | | - { name: 'automated-pipelines', path: 'src/automated-pipelines/tests', }, |
48 | | - { name: 'color-schemes', path: 'src/color-schemes/tests', }, |
49 | | - { name: 'content', path: 'tests/content', }, |
50 | | - { name: 'content-linter', path: 'src/content-linter/tests', }, |
51 | | - { name: 'content-render', path: 'src/content-render/tests', }, |
52 | | - { name: 'events', path: 'src/events/tests', }, |
53 | | - { name: 'ghes-releases', path: 'src/ghes-releases/tests', }, |
54 | | - { name: 'github-apps', path: 'src/github-apps/tests', }, |
55 | | - { name: 'graphql', path: 'src/graphql/tests', }, |
56 | | - { name: 'landings', path: 'src/landings/tests', }, |
57 | | - { name: 'learning-track', path: 'src/learning-track/tests', }, |
58 | | - { name: 'observability', path: 'src/observability/tests' }, |
59 | | - { name: 'pageinfo', path: 'src/pageinfo/tests', }, |
60 | | - { name: 'redirects', path: 'src/redirects/tests', }, |
61 | | - { name: 'release-notes', path: 'src/release-notes/tests', }, |
62 | | - { name: 'rendering', path: 'tests/rendering', }, |
63 | | - { name: 'rendering-fixtures', path: 'tests/rendering-fixtures', }, |
64 | | - { name: 'rest', path: 'src/rest/tests', }, |
65 | | - { name: 'routing', path: 'tests/routing', }, |
66 | | - { name: 'search', path: 'src/search/tests', }, |
67 | | - { name: 'secret-scanning', path: 'src/secret-scanning/tests',}, |
68 | | - { name: 'shielding', path: 'src/shielding/tests', }, |
69 | | - context.payload.repository.full_name === 'github/docs-internal' && |
70 | | - { name: 'languages', path: 'src/languages/tests', }, |
71 | | - { name: 'unit', path: 'tests/unit', }, |
72 | | - // { name: 'tools', path: 'src/tools/tests', } |
73 | | - { name: 'webhooks', path: 'src/webhooks/tests', }, |
74 | | - ].filter(Boolean) |
75 | | -
|
76 | 27 | test: |
77 | 28 | name: ${{ matrix.name }} |
78 | | - needs: figureOutMatrix |
| 29 | + if: github.repository == 'github/docs-internal' || github.repository == 'github/docs' |
| 30 | + |
79 | 31 | # Run on ubuntu-20.04-xl if the private repo or ubuntu-latest if the public repo |
80 | 32 | # See pull # 17442 in the private repo for context |
81 | 33 | runs-on: ${{ fromJSON('["ubuntu-latest", "ubuntu-20.04-xl"]')[github.repository == 'github/docs-internal'] }} |
82 | 34 | timeout-minutes: 60 |
83 | 35 | strategy: |
84 | 36 | fail-fast: false |
85 | 37 | matrix: |
86 | | - include: ${{ fromJSON(needs.figureOutMatrix.outputs.matrix) }} |
| 38 | + # Note that *if you add* to this, remember to also add that |
| 39 | + # to the **required checks** in the branch protection rules. |
| 40 | + name: |
| 41 | + # tests/ directory |
| 42 | + - content |
| 43 | + - rendering |
| 44 | + - rendering-fixtures |
| 45 | + - routing |
| 46 | + - unit |
| 47 | + |
| 48 | + # src/ directory |
| 49 | + - archives |
| 50 | + - assets |
| 51 | + # - audit-logs |
| 52 | + - automated-pipelines |
| 53 | + # - codeql-cli |
| 54 | + - color-schemes |
| 55 | + - content-linter |
| 56 | + - content-render |
| 57 | + - early-access |
| 58 | + - events |
| 59 | + # - frame |
| 60 | + - ghes-releases |
| 61 | + - github-apps |
| 62 | + - graphql |
| 63 | + - landings |
| 64 | + - languages |
| 65 | + - learning-track |
| 66 | + # - links |
| 67 | + - observability |
| 68 | + # - open-source |
| 69 | + - pageinfo |
| 70 | + # - pages |
| 71 | + - redirects |
| 72 | + - release-notes |
| 73 | + - rest |
| 74 | + - search |
| 75 | + - secret-scanning |
| 76 | + - shielding |
| 77 | + # - tools |
| 78 | + - versions |
| 79 | + - webhooks |
| 80 | + |
| 81 | + # The languages suite only runs on docs-internal |
| 82 | + isPrivateRepo: |
| 83 | + - ${{ github.repository == 'github/docs-internal' }} |
| 84 | + exclude: |
| 85 | + - name: languages |
| 86 | + isPrivateRepo: false |
| 87 | + |
87 | 88 | steps: |
88 | 89 | # Each of these ifs needs to be repeated at each step to make sure the required check still runs |
89 | 90 | # Even if if doesn't do anything |
@@ -185,4 +186,10 @@ jobs: |
185 | 186 | ENABLED_LANGUAGES: ${{ matrix.name == 'languages' && 'all' || '' }} |
186 | 187 | ROOT: ${{ (matrix.name == 'rendering-fixtures' || matrix.name == 'pageinfo' || matrix.name == 'landings' ) && 'tests/fixtures' || '' }} |
187 | 188 | TRANSLATIONS_FIXTURE_ROOT: ${{ (matrix.name == 'rendering-fixtures' || matrix.name == 'pageinfo') && 'tests/fixtures/translations' || '' }} |
188 | | - run: npm test -- ${{ matrix.path }}/ |
| 189 | + run: | |
| 190 | + if [ -d "tests/${{ matrix.name }}/" ] |
| 191 | + then |
| 192 | + npm test -- tests/${{ matrix.name }}/ |
| 193 | + else |
| 194 | + npm test -- src/${{ matrix.name }}/tests/ |
| 195 | + fi |
0 commit comments