From ffd8483c2718e6ae2c3f2e3905798c10ab71e585 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Vannicatte?= Date: Thu, 6 Jan 2022 10:28:05 +0100 Subject: [PATCH 1/3] chore(ci): add specs lint job --- .github/actions/setup/action.yml | 3 +++ .github/workflows/check.yml | 24 +++++++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 58dc08e778..d895ccadde 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -53,6 +53,9 @@ runs: outputs: # specs variables + RUN_SPECS: + description: 'Determine if the `specs_lint` job should run' + value: ${{ github.ref == 'refs/heads/main' || steps.diff.outputs.GITHUB_ACTIONS_CHANGED > 0 || steps.diff.outputs.SCRIPTS_CHANGED > 0 || steps.diff.outputs.SPECS_CHANGED > 0 }} RUN_SPECS_SEARCH: description: 'Determine if the `specs_search` job should run' value: ${{ github.ref == 'refs/heads/main' || steps.diff.outputs.GITHUB_ACTIONS_CHANGED > 0 || steps.diff.outputs.SCRIPTS_CHANGED > 0 || steps.diff.outputs.COMMON_SPECS_CHANGED > 0 || steps.diff.outputs.SEARCH_SPECS_CHANGED > 0 }} diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 83cecf9a00..e7ed5a957c 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -23,6 +23,7 @@ jobs: id: setup uses: ./.github/actions/setup outputs: + RUN_SPECS: ${{ steps.setup.outputs.RUN_SPECS }} RUN_SPECS_SEARCH: ${{ steps.setup.outputs.RUN_SPECS_SEARCH }} RUN_SPECS_RECOMMEND: ${{ steps.setup.outputs.RUN_SPECS_RECOMMEND }} RUN_SPECS_QS: ${{ steps.setup.outputs.RUN_SPECS_QS }} @@ -92,9 +93,22 @@ jobs: - name: Checking analytics specs run: yarn build:specs analytics + specs_lint: + runs-on: ubuntu-20.04 + needs: [setup, specs_search, specs_recommend, specs_perso, specs_analytics] + if: ${{ always() && needs.setup.outputs.RUN_SPECS == 'true' }} + steps: + - uses: actions/checkout@v2 + + - name: Restore cache + uses: ./.github/actions/cache + + - name: Checking analytics specs + run: yarn specs:lint + client_javascript_search: runs-on: ubuntu-20.04 - needs: [specs_search] + needs: [specs_lint] if: ${{ always() && needs.setup.outputs.RUN_JS_CLIENT_SEARCH == 'true' }} steps: - uses: actions/checkout@v2 @@ -119,7 +133,7 @@ jobs: client_javascript_recommend: runs-on: ubuntu-20.04 - needs: [specs_recommend] + needs: [specs_lint] if: ${{ always() && needs.setup.outputs.RUN_JS_CLIENT_RECOMMEND == 'true' }} steps: - uses: actions/checkout@v2 @@ -144,7 +158,7 @@ jobs: client_javascript_perso: runs-on: ubuntu-20.04 - needs: [specs_perso] + needs: [specs_lint] if: ${{ always() && needs.setup.outputs.RUN_JS_CLIENT_PERSO == 'true' }} steps: - uses: actions/checkout@v2 @@ -169,7 +183,7 @@ jobs: client_javascript_analytics: runs-on: ubuntu-20.04 - needs: [specs_analytics] + needs: [specs_lint] if: ${{ always() && needs.setup.outputs.RUN_JS_CLIENT_ANALYTICS == 'true' }} steps: - uses: actions/checkout@v2 @@ -194,7 +208,7 @@ jobs: client_java_search: runs-on: ubuntu-20.04 - needs: [specs_search] + needs: [specs_lint] if: ${{ always() && needs.setup.outputs.RUN_JAVA_CLIENT == 'true' }} steps: - uses: actions/checkout@v2 From 1a1c9789757176a8f8c087d22556760d8539c51b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Vannicatte?= Date: Thu, 6 Jan 2022 11:39:44 +0100 Subject: [PATCH 2/3] lint specs --- .github/actions/cache/action.yml | 2 +- .github/actions/setup/action.yml | 29 +++++++++--------- .github/workflows/check.yml | 50 ++++++++++++++++---------------- 3 files changed, 39 insertions(+), 42 deletions(-) diff --git a/.github/actions/cache/action.yml b/.github/actions/cache/action.yml index c6a0db5f33..86f733c4c8 100644 --- a/.github/actions/cache/action.yml +++ b/.github/actions/cache/action.yml @@ -4,7 +4,7 @@ description: Restore cached dependencies. inputs: job: - description: 'The job that requires this composite' + description: The job that requires this composite required: true runs: diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index d895ccadde..fa2c370f4e 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -53,51 +53,48 @@ runs: outputs: # specs variables - RUN_SPECS: - description: 'Determine if the `specs_lint` job should run' - value: ${{ github.ref == 'refs/heads/main' || steps.diff.outputs.GITHUB_ACTIONS_CHANGED > 0 || steps.diff.outputs.SCRIPTS_CHANGED > 0 || steps.diff.outputs.SPECS_CHANGED > 0 }} RUN_SPECS_SEARCH: - description: 'Determine if the `specs_search` job should run' + description: Determine if the `specs_search` job should run value: ${{ github.ref == 'refs/heads/main' || steps.diff.outputs.GITHUB_ACTIONS_CHANGED > 0 || steps.diff.outputs.SCRIPTS_CHANGED > 0 || steps.diff.outputs.COMMON_SPECS_CHANGED > 0 || steps.diff.outputs.SEARCH_SPECS_CHANGED > 0 }} RUN_SPECS_RECOMMEND: - description: 'Determine if the `specs_recommend` job should run' + description: Determine if the `specs_recommend` job should run value: ${{ github.ref == 'refs/heads/main' || steps.diff.outputs.GITHUB_ACTIONS_CHANGED > 0 || steps.diff.outputs.SCRIPTS_CHANGED > 0 || steps.diff.outputs.COMMON_SPECS_CHANGED > 0 || steps.diff.outputs.RECOMMEND_SPECS_CHANGED > 0 }} RUN_SPECS_QS: - description: 'Determine if the `specs_qs` job should run' + description: Determine if the `specs_qs` job should run value: ${{ github.ref == 'refs/heads/main' || steps.diff.outputs.GITHUB_ACTIONS_CHANGED > 0 || steps.diff.outputs.SCRIPTS_CHANGED > 0 || steps.diff.outputs.COMMON_SPECS_CHANGED > 0 || steps.diff.outputs.QS_SPECS_CHANGED > 0 }} RUN_SPECS_PERSO: - description: 'Determine if the `specs_perso` job should run' + description: Determine if the `specs_perso` job should run value: ${{ github.ref == 'refs/heads/main' || steps.diff.outputs.GITHUB_ACTIONS_CHANGED > 0 || steps.diff.outputs.SCRIPTS_CHANGED > 0 || steps.diff.outputs.COMMON_SPECS_CHANGED > 0 || steps.diff.outputs.PERSO_SPECS_CHANGED > 0 }} RUN_SPECS_INSIGHTS: - description: 'Determine if the `specs_insights` job should run' + description: Determine if the `specs_insights` job should run value: ${{ github.ref == 'refs/heads/main' || steps.diff.outputs.GITHUB_ACTIONS_CHANGED > 0 || steps.diff.outputs.SCRIPTS_CHANGED > 0 || steps.diff.outputs.COMMON_SPECS_CHANGED > 0 || steps.diff.outputs.INSIGHTS_SPECS_CHANGED > 0 }} RUN_SPECS_ANALYTICS: - description: 'Determine if the `specs_analytics` job should run' + description: Determine if the `specs_analytics` job should run value: ${{ github.ref == 'refs/heads/main' || steps.diff.outputs.GITHUB_ACTIONS_CHANGED > 0 || steps.diff.outputs.SCRIPTS_CHANGED > 0 || steps.diff.outputs.COMMON_SPECS_CHANGED > 0 || steps.diff.outputs.ANALYTICS_SPECS_CHANGED > 0 }} RUN_SPECS_AB: - description: 'Determine if the `specs_ab` job should run' + description: Determine if the `specs_ab` job should run value: ${{ github.ref == 'refs/heads/main' || steps.diff.outputs.GITHUB_ACTIONS_CHANGED > 0 || steps.diff.outputs.SCRIPTS_CHANGED > 0 || steps.diff.outputs.COMMON_SPECS_CHANGED > 0 || steps.diff.outputs.AB_SPECS_CHANGED > 0 }} # js client variables RUN_JS_CLIENT_SEARCH: - description: 'Determine if the `client_javascript_search` job should run' + description: Determine if the `client_javascript_search` job should run value: ${{ github.ref == 'refs/heads/main' || steps.diff.outputs.GITHUB_ACTIONS_CHANGED > 0 || steps.diff.outputs.COMMON_SPECS_CHANGED > 0 || steps.diff.outputs.SEARCH_SPECS_CHANGED > 0 || steps.diff.outputs.SCRIPTS_CHANGED > 0 || steps.diff.outputs.JS_SEARCH_CLIENT_CHANGED > 0 || steps.diff.outputs.JS_TEMPLATE_CHANGED > 0 }} RUN_JS_CLIENT_RECOMMEND: - description: 'Determine if the `client_javascript_recommend` job should run' + description: Determine if the `client_javascript_recommend` job should run value: ${{ github.ref == 'refs/heads/main' || steps.diff.outputs.GITHUB_ACTIONS_CHANGED > 0 || steps.diff.outputs.COMMON_SPECS_CHANGED > 0 || steps.diff.outputs.RECOMMEND_SPECS_CHANGED > 0 || steps.diff.outputs.SCRIPTS_CHANGED > 0 || steps.diff.outputs.JS_RECOMMEND_CLIENT_CHANGED > 0 || steps.diff.outputs.JS_TEMPLATE_CHANGED > 0 }} RUN_JS_CLIENT_PERSO: - description: 'Determine if the `client_javascript_perso` job should run' + description: Determine if the `client_javascript_perso` job should run value: ${{ github.ref == 'refs/heads/main' || steps.diff.outputs.GITHUB_ACTIONS_CHANGED > 0 || steps.diff.outputs.COMMON_SPECS_CHANGED > 0 || steps.diff.outputs.PERSO_SPECS_CHANGED > 0 || steps.diff.outputs.SCRIPTS_CHANGED > 0 || steps.diff.outputs.JS_PERSO_CLIENT_CHANGED > 0 || steps.diff.outputs.JS_TEMPLATE_CHANGED > 0 }} RUN_JS_CLIENT_ANALYTICS: - description: 'Determine if the `client_javascript_analytics` job should run' + description: Determine if the `client_javascript_analytics` job should run value: ${{ github.ref == 'refs/heads/main' || steps.diff.outputs.GITHUB_ACTIONS_CHANGED > 0 || steps.diff.outputs.COMMON_SPECS_CHANGED > 0 || steps.diff.outputs.ANALYTICS_SPECS_CHANGED > 0 || steps.diff.outputs.SCRIPTS_CHANGED > 0 || steps.diff.outputs.JS_ANALYTICS_CLIENT_CHANGED > 0 || steps.diff.outputs.JS_TEMPLATE_CHANGED > 0 }} # java client variables RUN_JAVA_CLIENT: - description: 'Determine if the `client_java_*` job should run' + description: Determine if the `client_java_*` job should run value: ${{ github.ref == 'refs/heads/main' || steps.diff.outputs.GITHUB_ACTIONS_CHANGED > 0 || steps.diff.outputs.COMMON_SPECS_CHANGED > 0 || steps.diff.outputs.SEARCH_SPECS_CHANGED > 0 || steps.diff.outputs.SCRIPTS_CHANGED > 0 || steps.diff.outputs.JAVA_CLIENT_CHANGED > 0 || steps.diff.outputs.JAVA_TEMPLATE_CHANGED > 0 }} # cts variables RUN_CTS: - description: 'Determine if the `cts` job should run' + description: Determine if the `cts` job should run value: ${{ github.ref_name == 'main' || steps.diff.outputs.GITHUB_ACTIONS_CHANGED > 0 || steps.diff.outputs.SPECS_CHANGED > 0 || steps.diff.outputs.TESTS_CHANGED > 0 || steps.diff.outputs.JS_CLIENT_CHANGED > 0 || steps.diff.outputs.JS_TEMPLATE_CHANGED > 0 || steps.diff.outputs.JAVA_CLIENT_CHANGED > 0 || steps.diff.outputs.JAVA_TEMPLATE_CHANGED > 0 }} diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index e7ed5a957c..3f1223e5c0 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -22,8 +22,10 @@ jobs: - name: Setup id: setup uses: ./.github/actions/setup + + - name: Lint GitHub actions + run: eslint --ext=yml .github/actions .github/workflows outputs: - RUN_SPECS: ${{ steps.setup.outputs.RUN_SPECS }} RUN_SPECS_SEARCH: ${{ steps.setup.outputs.RUN_SPECS_SEARCH }} RUN_SPECS_RECOMMEND: ${{ steps.setup.outputs.RUN_SPECS_RECOMMEND }} RUN_SPECS_QS: ${{ steps.setup.outputs.RUN_SPECS_QS }} @@ -54,6 +56,9 @@ jobs: - name: Checking search specs run: yarn build:specs search + - name: Lint search specs + run: eslint --ext=yml specs/search + specs_recommend: runs-on: ubuntu-20.04 needs: setup @@ -67,6 +72,9 @@ jobs: - name: Checking recommend specs run: yarn build:specs recommend + - name: Lint recommend specs + run: eslint --ext=yml specs/recommend + specs_perso: runs-on: ubuntu-20.04 needs: setup @@ -80,6 +88,9 @@ jobs: - name: Checking personalization specs run: yarn build:specs personalization + - name: Lint personalization specs + run: eslint --ext=yml specs/personalization + specs_analytics: runs-on: ubuntu-20.04 needs: setup @@ -93,22 +104,12 @@ jobs: - name: Checking analytics specs run: yarn build:specs analytics - specs_lint: - runs-on: ubuntu-20.04 - needs: [setup, specs_search, specs_recommend, specs_perso, specs_analytics] - if: ${{ always() && needs.setup.outputs.RUN_SPECS == 'true' }} - steps: - - uses: actions/checkout@v2 - - - name: Restore cache - uses: ./.github/actions/cache - - - name: Checking analytics specs - run: yarn specs:lint + - name: Lint analytics specs + run: eslint --ext=yml specs/analytics client_javascript_search: runs-on: ubuntu-20.04 - needs: [specs_lint] + needs: [specs_search] if: ${{ always() && needs.setup.outputs.RUN_JS_CLIENT_SEARCH == 'true' }} steps: - uses: actions/checkout@v2 @@ -133,7 +134,7 @@ jobs: client_javascript_recommend: runs-on: ubuntu-20.04 - needs: [specs_lint] + needs: [specs_recommend] if: ${{ always() && needs.setup.outputs.RUN_JS_CLIENT_RECOMMEND == 'true' }} steps: - uses: actions/checkout@v2 @@ -158,7 +159,7 @@ jobs: client_javascript_perso: runs-on: ubuntu-20.04 - needs: [specs_lint] + needs: [specs_perso] if: ${{ always() && needs.setup.outputs.RUN_JS_CLIENT_PERSO == 'true' }} steps: - uses: actions/checkout@v2 @@ -183,7 +184,7 @@ jobs: client_javascript_analytics: runs-on: ubuntu-20.04 - needs: [specs_lint] + needs: [specs_analytics] if: ${{ always() && needs.setup.outputs.RUN_JS_CLIENT_ANALYTICS == 'true' }} steps: - uses: actions/checkout@v2 @@ -208,7 +209,7 @@ jobs: client_java_search: runs-on: ubuntu-20.04 - needs: [specs_lint] + needs: [specs_search] if: ${{ always() && needs.setup.outputs.RUN_JAVA_CLIENT == 'true' }} steps: - uses: actions/checkout@v2 @@ -236,13 +237,12 @@ jobs: cts: runs-on: ubuntu-20.04 needs: - [ - client_javascript_search, - client_javascript_recommend, - client_javascript_perso, - client_javascript_analytics, - client_java_search, - ] + - client_javascript_search + - client_javascript_recommend + - client_javascript_perso + - client_javascript_analytics + - client_java_search + if: ${{ always() && needs.setup.outputs.RUN_CTS == 'true' }} steps: - uses: actions/checkout@v2 From 1ff86d97d5534e498cefcf1515b09cc925390da7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Vannicatte?= Date: Thu, 6 Jan 2022 11:41:33 +0100 Subject: [PATCH 3/3] use yarn eslint --- .github/workflows/check.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 3f1223e5c0..c7ff569a5f 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -24,7 +24,7 @@ jobs: uses: ./.github/actions/setup - name: Lint GitHub actions - run: eslint --ext=yml .github/actions .github/workflows + run: yarn eslint --ext=yml .github/actions .github/workflows outputs: RUN_SPECS_SEARCH: ${{ steps.setup.outputs.RUN_SPECS_SEARCH }} RUN_SPECS_RECOMMEND: ${{ steps.setup.outputs.RUN_SPECS_RECOMMEND }} @@ -57,7 +57,7 @@ jobs: run: yarn build:specs search - name: Lint search specs - run: eslint --ext=yml specs/search + run: yarn eslint --ext=yml specs/search specs_recommend: runs-on: ubuntu-20.04 @@ -73,7 +73,7 @@ jobs: run: yarn build:specs recommend - name: Lint recommend specs - run: eslint --ext=yml specs/recommend + run: yarn eslint --ext=yml specs/recommend specs_perso: runs-on: ubuntu-20.04 @@ -89,7 +89,7 @@ jobs: run: yarn build:specs personalization - name: Lint personalization specs - run: eslint --ext=yml specs/personalization + run: yarn eslint --ext=yml specs/personalization specs_analytics: runs-on: ubuntu-20.04 @@ -105,7 +105,7 @@ jobs: run: yarn build:specs analytics - name: Lint analytics specs - run: eslint --ext=yml specs/analytics + run: yarn eslint --ext=yml specs/analytics client_javascript_search: runs-on: ubuntu-20.04