From e911f18a938e229687e88538365c2cd4f83ca06e Mon Sep 17 00:00:00 2001 From: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com> Date: Fri, 20 Jan 2023 11:37:11 +0100 Subject: [PATCH] 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. --- .github/workflows/ci.yml | 55 ++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 31 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f68c8d35..143f64c1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,11 +17,11 @@ concurrency: jobs: inspect-code: - name: Inspect code + name: '[Required] Inspect code' runs-on: ubuntu-latest steps: - name: Check out repository - uses: actions/checkout@v3.0.2 + uses: actions/checkout@v3.3.0 with: fetch-depth: 2 - name: Set up Node.js @@ -38,6 +38,19 @@ jobs: - name: Lint commits run: npm run commitlint 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: name: Check which packages changed @@ -46,18 +59,9 @@ jobs: changes: ${{ steps.changes.outputs.changes }} steps: - name: Check out repository - uses: actions/checkout@v3.1.0 + uses: actions/checkout@v3.3.0 with: 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 uses: dorny/paths-filter@v2.11.1 id: changes @@ -78,17 +82,6 @@ jobs: ng-schematics: - '.github/workflows/ci.yml' - '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: needs: check-changes @@ -99,7 +92,7 @@ jobs: contents: write steps: - name: Check out repository - uses: actions/checkout@v3.0.2 + uses: actions/checkout@v3.3.0 - name: Set up Node.js uses: actions/setup-node@v3.5.1 with: @@ -151,7 +144,7 @@ jobs: suite: chrome-bidi steps: - name: Check out repository - uses: actions/checkout@v3.0.2 + uses: actions/checkout@v3.3.0 - name: Set up Node.js uses: actions/setup-node@v3.5.1 with: @@ -181,7 +174,7 @@ jobs: run: xvfb-run --auto-servernum npm run test -- --test-suite ${{ matrix.suite }} chrome-tests-required: - name: Chrome tests required job + name: '[Required] Chrome tests' needs: [check-changes, chrome-tests] runs-on: ubuntu-latest if: ${{ always() }} @@ -239,7 +232,7 @@ jobs: run: xvfb-run --auto-servernum npm run test -- --test-suite ${{ matrix.suite }} firefox-tests-required: - name: Firefox tests required job + name: '[Required] Firefox tests' needs: [check-changes, firefox-tests] runs-on: ubuntu-latest if: ${{ always() }} @@ -317,7 +310,7 @@ jobs: run: ${{ matrix.pkg_manager }} test installation-test-required: - name: Installation tests required job + name: '[Required] Installation tests' needs: [check-changes, installation-test] runs-on: ubuntu-latest if: ${{ always() }} @@ -327,13 +320,13 @@ jobs: - run: 'exit 0' docker-tests: - name: Test Docker image + name: '[Required] Test Docker image' runs-on: ubuntu-latest needs: check-changes if: ${{ contains(fromJSON(needs.check-changes.outputs.changes), 'puppeteer') }} steps: - name: Check out repository - uses: actions/checkout@v3.0.2 + uses: actions/checkout@v3.3.0 with: fetch-depth: 2 - 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`" ng-schematics-tests: - name: Test Angular Schematics + name: '[Required] Test Angular Schematics' runs-on: ubuntu-latest needs: check-changes if: ${{ contains(fromJSON(needs.check-changes.outputs.changes), 'ng-schematics') }}