1
0
mirror of synced 2025-12-30 12:02:01 -05:00

Move events into subject folder (#35262)

This commit is contained in:
Kevin Heis
2023-03-14 08:53:42 -07:00
committed by GitHub
parent 8535653590
commit 0c67aadebc
20 changed files with 88 additions and 54 deletions

View File

@@ -1,4 +1,4 @@
name: Node.js Tests
name: Test
# **What it does**: Runs our tests.
# **Why we have it**: We want our tests to pass before merging code.
@@ -41,22 +41,22 @@ jobs:
// we're on the private docs-internal repo because only that
// one has ability to clone the remote (private) translations
// repos.
const all = [
'content',
'graphql',
'meta',
'rendering',
'routing',
'unit',
'linting',
'rendering-fixtures',
];
if (context.payload.repository.full_name === 'github/docs-internal') {
all.push('translations');
}
return all;
return [
{ name: 'content', path: 'tests/content', },
{ name: 'graphql', path: 'tests/graphql', },
{ name: 'meta', path: 'tests/meta', },
{ name: 'rendering', path: 'tests/rendering', },
{ name: 'routing', path: 'tests/routing', },
{ name: 'unit', path: 'tests/unit', },
{ name: 'linting', path: 'tests/linting', },
{ name: 'rendering-fixtures', path: 'tests/rendering-fixtures', },
{ name: 'events', path: 'src/events/tests', },
context.payload.repository.full_name === 'github/docs-internal' &&
{ name: 'translations', path: 'tests/translations', },
].filter(Boolean)
test:
name: ${{ matrix.name }}
needs: figureOutMatrix
# Run on ubuntu-20.04-xl if the private repo or ubuntu-latest if the public repo
# See pull # 17442 in the private repo for context
@@ -65,7 +65,7 @@ jobs:
strategy:
fail-fast: false
matrix:
test-group: ${{ fromJSON(needs.figureOutMatrix.outputs.matrix) }}
include: ${{ fromJSON(needs.figureOutMatrix.outputs.matrix) }}
steps:
# Each of these ifs needs to be repeated at each step to make sure the required check still runs
# Even if if doesn't do anything
@@ -73,7 +73,7 @@ jobs:
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- uses: ./.github/actions/setup-elasticsearch
if: ${{ matrix.test-group == 'content' || matrix.test-group == 'translations' }}
if: ${{ matrix.name == 'content' || matrix.name == 'translations' }}
- uses: ./.github/actions/node-npm-setup
@@ -83,12 +83,12 @@ jobs:
token: ${{ secrets.DOCUBOT_REPO_PAT }}
- name: Check the test fixture data (if applicable)
if: ${{ matrix.test-group == 'rendering-fixtures' }}
if: ${{ matrix.name == 'rendering-fixtures' }}
run: ./script/copy-fixture-data.js --check
# This keeps our fixture content/data in check
- name: Check the test fixture content (if applicable)
if: ${{ matrix.test-group == 'rendering-fixtures' }}
if: ${{ matrix.name == 'rendering-fixtures' }}
env:
ROOT: tests/fixtures
run: |
@@ -101,12 +101,13 @@ jobs:
tests/fixtures/data
- name: Clone all translations
if: ${{ matrix.test-group == 'translations' }}
if: ${{ matrix.name == 'translations' }}
uses: ./.github/actions/clone-translations
with:
token: ${{ secrets.DOCUBOT_REPO_PAT }}
- name: Gather files changed
if: ${{ matrix.name == 'linting' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR: ${{ github.event.pull_request.number }}
@@ -149,9 +150,9 @@ jobs:
run: npm run build
- name: Index fixtures into the local Elasticsearch
# For the sake of saving time, only run this step if the test-group
# For the sake of saving time, only run this step if the group
# is one that will run tests against an Elasticsearch on localhost.
if: ${{ matrix.test-group == 'content' || matrix.test-group == 'translations' }}
if: ${{ matrix.name == 'content' || matrix.name == 'translations' }}
run: npm run index-test-fixtures
- name: Run tests
@@ -161,6 +162,6 @@ jobs:
# By default, when `process.env.NODE_ENV === 'test'` it forces the
# tests run only in English. The exception is the
# `tests/translations/` suite which needs all languages to be set up.
ENABLED_LANGUAGES: ${{ matrix.test-group == 'translations' && 'all' || '' }}
ROOT: ${{ matrix.test-group == 'rendering-fixtures' && 'tests/fixtures' || ''}}
run: npm test -- tests/${{ matrix.test-group }}/
ENABLED_LANGUAGES: ${{ matrix.name == 'translations' && 'all' || '' }}
ROOT: ${{ matrix.name == 'rendering-fixtures' && 'tests/fixtures' || ''}}
run: npm test -- ${{ matrix.path }}/