chore: Extract doc checking job to improve speed (#9549)

Extracts the Doc checking in CI to `Inspect code` job, this should speed
up of the reset of the test as they need `check-changes` before running.

Drive-by: Updated `actions/checkout` to latest version. 

Note: Required Jobs should be changed for this to be possible to merge.
This commit is contained in:
Nikolay Vitkov 2023-01-20 11:37:11 +01:00 committed by GitHub
parent 094632781d
commit e911f18a93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,11 +17,11 @@ concurrency:
jobs: jobs:
inspect-code: inspect-code:
name: Inspect code name: '[Required] Inspect code'
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v3.0.2 uses: actions/checkout@v3.3.0
with: with:
fetch-depth: 2 fetch-depth: 2
- name: Set up Node.js - name: Set up Node.js
@ -38,6 +38,19 @@ jobs:
- name: Lint commits - name: Lint commits
run: npm run commitlint run: npm run commitlint
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
- name: Generate documents
run: npm run docs
- name: Check if autogenerated docs differ
run: |
diff_file=$(mktemp doc_diff_XXXXXX)
git diff --color > $diff_file
if [[ -s $diff_file ]]; then
echo "Please update the documentation by running 'npm run docs'. The following was the diff"
cat $diff_file
rm $diff_file
exit 1
fi
rm $diff_file
check-changes: check-changes:
name: Check which packages changed name: Check which packages changed
@ -46,18 +59,9 @@ jobs:
changes: ${{ steps.changes.outputs.changes }} changes: ${{ steps.changes.outputs.changes }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v3.1.0 uses: actions/checkout@v3.3.0
with: with:
fetch-depth: 2 fetch-depth: 2
- name: Set up Node.js
uses: actions/setup-node@v3.5.1
with:
cache: npm
node-version: latest
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Build
run: npm run docs
- name: Detect changed packages - name: Detect changed packages
uses: dorny/paths-filter@v2.11.1 uses: dorny/paths-filter@v2.11.1
id: changes id: changes
@ -78,17 +82,6 @@ jobs:
ng-schematics: ng-schematics:
- '.github/workflows/ci.yml' - '.github/workflows/ci.yml'
- 'packages/ng-schematics/**' - 'packages/ng-schematics/**'
- name: Check if autogenerated docs differ
run: |
diff_file=$(mktemp doc_diff_XXXXXX)
git diff --color > $diff_file
if [[ -s $diff_file ]]; then
echo "Please update the documentation by running 'npm run docs'. The following was the diff"
cat $diff_file
rm $diff_file
exit 1
fi
rm $diff_file
deploy-docs: deploy-docs:
needs: check-changes needs: check-changes
@ -99,7 +92,7 @@ jobs:
contents: write contents: write
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v3.0.2 uses: actions/checkout@v3.3.0
- name: Set up Node.js - name: Set up Node.js
uses: actions/setup-node@v3.5.1 uses: actions/setup-node@v3.5.1
with: with:
@ -151,7 +144,7 @@ jobs:
suite: chrome-bidi suite: chrome-bidi
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v3.0.2 uses: actions/checkout@v3.3.0
- name: Set up Node.js - name: Set up Node.js
uses: actions/setup-node@v3.5.1 uses: actions/setup-node@v3.5.1
with: with:
@ -181,7 +174,7 @@ jobs:
run: xvfb-run --auto-servernum npm run test -- --test-suite ${{ matrix.suite }} run: xvfb-run --auto-servernum npm run test -- --test-suite ${{ matrix.suite }}
chrome-tests-required: chrome-tests-required:
name: Chrome tests required job name: '[Required] Chrome tests'
needs: [check-changes, chrome-tests] needs: [check-changes, chrome-tests]
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: ${{ always() }} if: ${{ always() }}
@ -239,7 +232,7 @@ jobs:
run: xvfb-run --auto-servernum npm run test -- --test-suite ${{ matrix.suite }} run: xvfb-run --auto-servernum npm run test -- --test-suite ${{ matrix.suite }}
firefox-tests-required: firefox-tests-required:
name: Firefox tests required job name: '[Required] Firefox tests'
needs: [check-changes, firefox-tests] needs: [check-changes, firefox-tests]
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: ${{ always() }} if: ${{ always() }}
@ -317,7 +310,7 @@ jobs:
run: ${{ matrix.pkg_manager }} test run: ${{ matrix.pkg_manager }} test
installation-test-required: installation-test-required:
name: Installation tests required job name: '[Required] Installation tests'
needs: [check-changes, installation-test] needs: [check-changes, installation-test]
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: ${{ always() }} if: ${{ always() }}
@ -327,13 +320,13 @@ jobs:
- run: 'exit 0' - run: 'exit 0'
docker-tests: docker-tests:
name: Test Docker image name: '[Required] Test Docker image'
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: check-changes needs: check-changes
if: ${{ contains(fromJSON(needs.check-changes.outputs.changes), 'puppeteer') }} if: ${{ contains(fromJSON(needs.check-changes.outputs.changes), 'puppeteer') }}
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v3.0.2 uses: actions/checkout@v3.3.0
with: with:
fetch-depth: 2 fetch-depth: 2
- name: Set up Node.js - name: Set up Node.js
@ -357,7 +350,7 @@ jobs:
docker run -i --init --cap-add=SYS_ADMIN --rm puppeteer-test-image node -e "`cat test/smoke-test.js`" docker run -i --init --cap-add=SYS_ADMIN --rm puppeteer-test-image node -e "`cat test/smoke-test.js`"
ng-schematics-tests: ng-schematics-tests:
name: Test Angular Schematics name: '[Required] Test Angular Schematics'
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: check-changes needs: check-changes
if: ${{ contains(fromJSON(needs.check-changes.outputs.changes), 'ng-schematics') }} if: ${{ contains(fromJSON(needs.check-changes.outputs.changes), 'ng-schematics') }}