From 994125da83059d6010b968bbb0aae6e9e96515c2 Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Tue, 30 Jan 2024 15:37:19 +0100 Subject: [PATCH 1/4] ci: Run lint step for markdown-only PRs --- .github/workflows/build.yml | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 62b713e73def..e9722011d457 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -165,8 +165,7 @@ jobs: runs-on: ubuntu-20.04 timeout-minutes: 15 if: | - (needs.job_get_metadata.outputs.is_gitflow_sync == 'false' && needs.job_get_metadata.outputs.has_gitflow_label == 'false') && - (needs.job_get_metadata.outputs.changed_any_code == 'true' || github.event_name != 'pull_request') + (needs.job_get_metadata.outputs.is_gitflow_sync == 'false' && needs.job_get_metadata.outputs.has_gitflow_label == 'false') steps: - name: 'Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})' uses: actions/checkout@v4 @@ -215,6 +214,8 @@ jobs: needs: [job_get_metadata, job_install_deps] runs-on: ubuntu-20.04 timeout-minutes: 30 + if: | + (needs.job_get_metadata.outputs.changed_any_code == 'true' || github.event_name != 'pull_request') steps: - name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }}) uses: actions/checkout@v4 @@ -323,6 +324,28 @@ jobs: - name: Validate ES5 builds run: yarn validate:es5 + job_lint_md: + name: Lint Markdown + needs: [job_get_metadata, job_install_deps] + timeout-minutes: 10 + runs-on: ubuntu-20.04 + if: needs.job_get_metadata.outputs.changed_any_code != 'true' && github.event_name == 'pull_request' + steps: + - name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }}) + uses: actions/checkout@v4 + with: + ref: ${{ env.HEAD_COMMIT }} + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version-file: 'package.json' + - name: Restore caches + uses: ./.github/actions/restore-cache + env: + DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }} + - name: Lint .md files + run: yarn lint:prettier + job_circular_dep_check: name: Circular Dependency Check needs: [job_get_metadata, job_build] @@ -1015,6 +1038,7 @@ jobs: job_e2e_tests, job_artifacts, job_lint, + job_lint_md, job_circular_dep_check, ] # Always run this, even if a dependent job failed From 3a91e99e1354665a1c977b6407ce655b4ba9f501 Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Tue, 30 Jan 2024 15:42:45 +0100 Subject: [PATCH 2/4] fix job --- .github/workflows/build.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e9722011d457..08b10e349106 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -339,10 +339,6 @@ jobs: uses: actions/setup-node@v4 with: node-version-file: 'package.json' - - name: Restore caches - uses: ./.github/actions/restore-cache - env: - DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }} - name: Lint .md files run: yarn lint:prettier From ece4484272c50c6051a0b6ff2ef5757438e75c5c Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Tue, 30 Jan 2024 15:47:27 +0100 Subject: [PATCH 3/4] always check formatting --- .github/workflows/build.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 08b10e349106..39f9ddb41b9e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -320,16 +320,15 @@ jobs: env: DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }} - name: Lint source files - run: yarn lint + run: lint:lerna - name: Validate ES5 builds run: yarn validate:es5 - job_lint_md: - name: Lint Markdown + job_check_format: + name: Check file formatting needs: [job_get_metadata, job_install_deps] timeout-minutes: 10 runs-on: ubuntu-20.04 - if: needs.job_get_metadata.outputs.changed_any_code != 'true' && github.event_name == 'pull_request' steps: - name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }}) uses: actions/checkout@v4 @@ -339,8 +338,14 @@ jobs: uses: actions/setup-node@v4 with: node-version-file: 'package.json' - - name: Lint .md files - run: yarn lint:prettier + - name: Check dependency cache + uses: actions/cache/restore@v3 + with: + path: ${{ env.CACHED_DEPENDENCY_PATHS }} + key: ${{ needs.job_install_deps.outputs.dependency_cache_key }} + fail-on-cache-miss: true + - name: Check file formatting + run: yarn lint:prettier && yarn lint:biome job_circular_dep_check: name: Circular Dependency Check @@ -1034,7 +1039,7 @@ jobs: job_e2e_tests, job_artifacts, job_lint, - job_lint_md, + job_check_format, job_circular_dep_check, ] # Always run this, even if a dependent job failed From a99664a43ec13d2b1082ac20f02fc6c03b3fd6f6 Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Tue, 30 Jan 2024 15:52:10 +0100 Subject: [PATCH 4/4] fix lint --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 39f9ddb41b9e..e26addc89fd1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -320,7 +320,7 @@ jobs: env: DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }} - name: Lint source files - run: lint:lerna + run: yarn lint:lerna - name: Validate ES5 builds run: yarn validate:es5