From e5267c73f83ceb0b4255940e27302babc162adf3 Mon Sep 17 00:00:00 2001 From: Cristiano Tofani Date: Wed, 4 Dec 2024 16:41:08 +0100 Subject: [PATCH 1/8] wip test shards --- .github/workflows/staticcheck.yaml | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/staticcheck.yaml b/.github/workflows/staticcheck.yaml index affc86909b1..b049a16f190 100644 --- a/.github/workflows/staticcheck.yaml +++ b/.github/workflows/staticcheck.yaml @@ -8,6 +8,9 @@ jobs: concurrency: group: ${{ github.workflow }}-pr-staticcheck-${{ github.head_ref || github.run_id }} cancel-in-progress: true + strategy: + matrix: + shard: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] steps: - id: checkout uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 @@ -20,8 +23,27 @@ jobs: - id: run-prettier run: yarn prettier:check - id: run-test - run: yarn test:ci + run: yarn test:ci --shard=${{ matrix.shard }}/${{ strategy.job-total }} + - id: move-coverage-file + run: mv coverage/coverage-final.json coverage/${{matrix.shard}}.json + - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 + with: + name: coverage-artifacts + path: coverage/ + coverage: + runs-on: ubuntu-latest + environment: dev + needs: checks + steps: + - id: checkout + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + - uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 + with: + name: coverage-artifacts + path: coverage + - id: merge-coverage + run: npx nyc merge coverage/ coverage/coverage-final.json - id: codecov-script uses: codecov/codecov-action@84508663e988701840491b86de86b666e8a86bed # v4.3.0 with: - token: ${{ secrets.CODECOV_TOKEN }} + token: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file From 999514a55c003639a9123a662559648e5fc53cb8 Mon Sep 17 00:00:00 2001 From: Cristiano Tofani Date: Wed, 4 Dec 2024 16:42:10 +0100 Subject: [PATCH 2/8] fix --- .github/workflows/staticcheck.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/staticcheck.yaml b/.github/workflows/staticcheck.yaml index b049a16f190..c9098e5182b 100644 --- a/.github/workflows/staticcheck.yaml +++ b/.github/workflows/staticcheck.yaml @@ -4,7 +4,6 @@ on: jobs: checks: runs-on: ubuntu-latest - environment: dev concurrency: group: ${{ github.workflow }}-pr-staticcheck-${{ github.head_ref || github.run_id }} cancel-in-progress: true From 3a0ffdb18bb407147411ed6e5787985778bef4ea Mon Sep 17 00:00:00 2001 From: Cristiano Tofani Date: Wed, 4 Dec 2024 16:43:51 +0100 Subject: [PATCH 3/8] fix job concurrency --- .github/workflows/staticcheck.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/staticcheck.yaml b/.github/workflows/staticcheck.yaml index c9098e5182b..314c6ad3ede 100644 --- a/.github/workflows/staticcheck.yaml +++ b/.github/workflows/staticcheck.yaml @@ -5,7 +5,7 @@ jobs: checks: runs-on: ubuntu-latest concurrency: - group: ${{ github.workflow }}-pr-staticcheck-${{ github.head_ref || github.run_id }} + group: ${{ github.workflow }}-pr-staticcheck-${{ github.head_ref || github.run_id }}-${{ matrix.shard }} cancel-in-progress: true strategy: matrix: From 55b2c7fb64fb15af48f669175313f926f51d1636 Mon Sep 17 00:00:00 2001 From: Cristiano Tofani Date: Wed, 4 Dec 2024 17:25:30 +0100 Subject: [PATCH 4/8] wip fix --- .github/workflows/staticcheck.yaml | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/staticcheck.yaml b/.github/workflows/staticcheck.yaml index 314c6ad3ede..27f38ec485b 100644 --- a/.github/workflows/staticcheck.yaml +++ b/.github/workflows/staticcheck.yaml @@ -2,14 +2,11 @@ on: - pull_request - workflow_call jobs: - checks: + static-checks: runs-on: ubuntu-latest concurrency: - group: ${{ github.workflow }}-pr-staticcheck-${{ github.head_ref || github.run_id }}-${{ matrix.shard }} + group: ${{ github.workflow }}-pr-staticcheck-${{ github.head_ref || github.run_id }} cancel-in-progress: true - strategy: - matrix: - shard: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] steps: - id: checkout uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 @@ -21,18 +18,29 @@ jobs: run: yarn lint - id: run-prettier run: yarn prettier:check + unit-test: + runs-on: ubuntu-latest + needs: static-checks + strategy: + matrix: + shard: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] + steps: + - id: checkout + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + - id: setup + uses: ./.github/actions/setup-composite - id: run-test - run: yarn test:ci --shard=${{ matrix.shard }}/${{ strategy.job-total }} - - id: move-coverage-file + run: yarn test:ci --shard=${{ matrix.shard }}/${{ strategy.job-total }} --coverage + - id: rename-coverage-file run: mv coverage/coverage-final.json coverage/${{matrix.shard}}.json - - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 + - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 with: name: coverage-artifacts path: coverage/ coverage: runs-on: ubuntu-latest environment: dev - needs: checks + needs: unit-test steps: - id: checkout uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 From 8350cb6d234879403d889496526e056ba6ff1d62 Mon Sep 17 00:00:00 2001 From: Cristiano Tofani Date: Wed, 4 Dec 2024 20:43:51 +0100 Subject: [PATCH 5/8] test --- .github/actions/setup-composite/action.yml | 16 ++++++-- .github/workflows/staticcheck.yaml | 44 +++++++++++----------- 2 files changed, 36 insertions(+), 24 deletions(-) diff --git a/.github/actions/setup-composite/action.yml b/.github/actions/setup-composite/action.yml index bcf2e107204..56f32d10ffc 100644 --- a/.github/actions/setup-composite/action.yml +++ b/.github/actions/setup-composite/action.yml @@ -1,12 +1,12 @@ name: Actions to setup environment for all workflows -description: 'This action collects the steps to setup any job' +description: "This action collects the steps to setup any job" runs: using: "composite" steps: - id: setup-node uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 with: - node-version-file: '.node-version' + node-version-file: ".node-version" - id: yarn-cache-dir-path run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT shell: bash @@ -23,4 +23,14 @@ runs: shell: bash - id: generate-api-client run: yarn generate - shell: bash \ No newline at end of file + shell: bash + - id: upload-locales-artifact + uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 + with: + name: locales.ts + path: locales/locales.ts + - id: upload-clients-artifact + uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 + with: + name: api-client + path: definitions/ diff --git a/.github/workflows/staticcheck.yaml b/.github/workflows/staticcheck.yaml index 27f38ec485b..4a141ef3096 100644 --- a/.github/workflows/staticcheck.yaml +++ b/.github/workflows/staticcheck.yaml @@ -27,29 +27,31 @@ jobs: steps: - id: checkout uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - - id: setup - uses: ./.github/actions/setup-composite - - id: run-test - run: yarn test:ci --shard=${{ matrix.shard }}/${{ strategy.job-total }} --coverage - - id: rename-coverage-file - run: mv coverage/coverage-final.json coverage/${{matrix.shard}}.json - - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 + - id: setup-node + uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 with: - name: coverage-artifacts - path: coverage/ - coverage: - runs-on: ubuntu-latest - environment: dev - needs: unit-test - steps: - - id: checkout - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - - uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 + node-version-file: ".node-version" + - id: yarn-cache + uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} + - id: install-packages + run: yarn install --frozen-lockfile + - id: download-locales + uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 with: - name: coverage-artifacts - path: coverage - - id: merge-coverage - run: npx nyc merge coverage/ coverage/coverage-final.json + name: locales.ts + path: locales/locales.ts + - id: download-api-client + uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 + with: + name: api-client + - id: run-test + run: yarn test:ci --shard=${{ matrix.shard }}/${{ strategy.job-total }} - id: codecov-script uses: codecov/codecov-action@84508663e988701840491b86de86b666e8a86bed # v4.3.0 with: From 57538fb8e454f97df8c7eef0528202b6e95915aa Mon Sep 17 00:00:00 2001 From: Cristiano Tofani Date: Wed, 4 Dec 2024 20:58:08 +0100 Subject: [PATCH 6/8] fix artifacts --- .github/actions/setup-composite/action.yml | 4 ++-- .github/workflows/staticcheck.yaml | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/actions/setup-composite/action.yml b/.github/actions/setup-composite/action.yml index 56f32d10ffc..b0dcfc285f4 100644 --- a/.github/actions/setup-composite/action.yml +++ b/.github/actions/setup-composite/action.yml @@ -27,8 +27,8 @@ runs: - id: upload-locales-artifact uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 with: - name: locales.ts - path: locales/locales.ts + name: locales + path: locales/ - id: upload-clients-artifact uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 with: diff --git a/.github/workflows/staticcheck.yaml b/.github/workflows/staticcheck.yaml index 4a141ef3096..6a3ddac5c96 100644 --- a/.github/workflows/staticcheck.yaml +++ b/.github/workflows/staticcheck.yaml @@ -44,12 +44,13 @@ jobs: - id: download-locales uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 with: - name: locales.ts - path: locales/locales.ts + name: locales + path: locales/ - id: download-api-client uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 with: name: api-client + path: definitions/ - id: run-test run: yarn test:ci --shard=${{ matrix.shard }}/${{ strategy.job-total }} - id: codecov-script From e3e7e0fc83a9da3c18c971d546b47e3a8ff3bc93 Mon Sep 17 00:00:00 2001 From: Cristiano Tofani Date: Tue, 10 Dec 2024 14:53:39 +0100 Subject: [PATCH 7/8] Update .github/workflows/staticcheck.yaml --- .github/workflows/staticcheck.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/staticcheck.yaml b/.github/workflows/staticcheck.yaml index 6a3ddac5c96..d7bd4815f7b 100644 --- a/.github/workflows/staticcheck.yaml +++ b/.github/workflows/staticcheck.yaml @@ -20,6 +20,7 @@ jobs: run: yarn prettier:check unit-test: runs-on: ubuntu-latest + environment: dev needs: static-checks strategy: matrix: From ba5e32f4cfde8248f5825ce037097b41dd6c44bd Mon Sep 17 00:00:00 2001 From: Cristiano Tofani Date: Tue, 17 Dec 2024 15:58:46 +0100 Subject: [PATCH 8/8] fixes --- .github/actions/setup-composite/action.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/actions/setup-composite/action.yml b/.github/actions/setup-composite/action.yml index 10eaf7a56eb..1d181fc5f81 100644 --- a/.github/actions/setup-composite/action.yml +++ b/.github/actions/setup-composite/action.yml @@ -10,9 +10,6 @@ runs: uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3.8.2 with: node-version-file: ".node-version" - - id: yarn-cache-dir-path - run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - shell: bash - id: yarn-cache uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 with: @@ -23,7 +20,6 @@ runs: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} ${{ runner.os }}-yarn- - name: Install dependencies - if: steps.yarn-cache.outputs.cache-hit != 'true' run: yarn install --frozen-lockfile shell: bash - id: generate-api-client