From 7144d2b87eeea2d1d732b901482849586c665b1b Mon Sep 17 00:00:00 2001 From: Louis Aussedat Date: Wed, 27 Mar 2024 14:38:42 +0100 Subject: [PATCH 1/7] =?UTF-8?q?=E2=9E=96=20(chore):=20Remove=20husky=20dep?= =?UTF-8?q?endency?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .husky/pre-push | 1 - package.json | 4 +-- pnpm-lock.yaml | 92 ++++++++++++++++++++++++++++++++----------------- 3 files changed, 61 insertions(+), 36 deletions(-) delete mode 100644 .husky/pre-push diff --git a/.husky/pre-push b/.husky/pre-push deleted file mode 100644 index 009b3f89b..000000000 --- a/.husky/pre-push +++ /dev/null @@ -1 +0,0 @@ -pnpm lint diff --git a/package.json b/package.json index ed4da1959..c0e6898b2 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,6 @@ "trusted-apps": "pnpm --filter @ledgerhq/device-sdk-trusted-apps", "ui": "pnpm --filter @ledgerhq/device-sdk-ui", "sample": "pnpm --filter @ledgerhq/device-sdk-sample", - "prepare": "husky", "bump": "changeset version", "release": "changeset publish", "changelog": "changeset add", @@ -37,15 +36,14 @@ "danger": "^11.3.1", "eslint": "^8.56.0", "gitmoji-cli": "^9.1.0", - "husky": "^9.0.10", "hygen": "^6.2.11", "jest": "^29.7.0", "lint-staged": "^15.2.0", "prettier": "^3.1.1", "rimraf": "^5.0.5", + "ts-jest": "^29.1.1", "turbo": "^1.12.3", "typescript": "^5.3.3", - "ts-jest": "^29.1.1", "zx": "^7.2.3" }, "lint-staged": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 72bb584f3..5a074158c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -29,9 +29,6 @@ importers: gitmoji-cli: specifier: ^9.1.0 version: 9.1.0 - husky: - specifier: ^9.0.10 - version: 9.0.10 hygen: specifier: ^6.2.11 version: 6.2.11 @@ -49,7 +46,7 @@ importers: version: 5.0.5 ts-jest: specifier: ^29.1.1 - version: 29.1.1(@babel/core@7.23.9)(jest@29.7.0)(typescript@5.3.3) + version: 29.1.1(@babel/core@7.23.6)(jest@29.7.0)(typescript@5.3.3) turbo: specifier: ^1.12.3 version: 1.12.3 @@ -321,10 +318,10 @@ packages: '@babel/helpers': 7.23.6 '@babel/parser': 7.23.6 '@babel/template': 7.22.15 - '@babel/traverse': 7.23.6(supports-color@5.5.0) + '@babel/traverse': 7.23.6 '@babel/types': 7.23.6 convert-source-map: 2.0.0 - debug: 4.3.4(supports-color@5.5.0) + debug: 4.3.4 gensync: 1.0.0-beta.2 json5: 2.2.3 semver: 6.3.1 @@ -353,6 +350,7 @@ packages: semver: 6.3.1 transitivePeerDependencies: - supports-color + dev: false /@babel/eslint-parser@7.23.3(@babel/core@7.23.6)(eslint@8.56.0): resolution: {integrity: sha512-9bTuNlyx7oSstodm1cR1bECj4fkiknsDa1YniISkJemMY3DGhJNYBECbe6QD/q54mp2J8VO66jW3/7uP//iFCw==} @@ -443,6 +441,7 @@ packages: '@babel/helper-simple-access': 7.22.5 '@babel/helper-split-export-declaration': 7.22.6 '@babel/helper-validator-identifier': 7.22.20 + dev: false /@babel/helper-plugin-utils@7.22.5: resolution: {integrity: sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==} @@ -477,7 +476,7 @@ packages: engines: {node: '>=6.9.0'} dependencies: '@babel/template': 7.22.15 - '@babel/traverse': 7.23.6(supports-color@5.5.0) + '@babel/traverse': 7.23.6 '@babel/types': 7.23.6 transitivePeerDependencies: - supports-color @@ -492,6 +491,7 @@ packages: '@babel/types': 7.23.9 transitivePeerDependencies: - supports-color + dev: false /@babel/highlight@7.23.4: resolution: {integrity: sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==} @@ -514,6 +514,7 @@ packages: hasBin: true dependencies: '@babel/types': 7.23.9 + dev: false /@babel/plugin-syntax-async-generators@7.8.4(@babel/core@7.23.6): resolution: {integrity: sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==} @@ -675,6 +676,25 @@ packages: '@babel/code-frame': 7.23.5 '@babel/parser': 7.23.9 '@babel/types': 7.23.9 + dev: false + + /@babel/traverse@7.23.6: + resolution: {integrity: sha512-czastdK1e8YByZqezMPFiZ8ahwVMh/ESl9vPgvgdB9AmFMGP5jfpFax74AQgl5zj4XHzqeYAg2l8PuUeRS1MgQ==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/code-frame': 7.23.5 + '@babel/generator': 7.23.6 + '@babel/helper-environment-visitor': 7.22.20 + '@babel/helper-function-name': 7.23.0 + '@babel/helper-hoist-variables': 7.22.5 + '@babel/helper-split-export-declaration': 7.22.6 + '@babel/parser': 7.23.6 + '@babel/types': 7.23.6 + debug: 4.3.4 + globals: 11.12.0 + transitivePeerDependencies: + - supports-color + dev: true /@babel/traverse@7.23.6(supports-color@5.5.0): resolution: {integrity: sha512-czastdK1e8YByZqezMPFiZ8ahwVMh/ESl9vPgvgdB9AmFMGP5jfpFax74AQgl5zj4XHzqeYAg2l8PuUeRS1MgQ==} @@ -692,6 +712,7 @@ packages: globals: 11.12.0 transitivePeerDependencies: - supports-color + dev: false /@babel/traverse@7.23.9: resolution: {integrity: sha512-I/4UJ9vs90OkBtY6iiiTORVMyIhJ4kAVmsKo9KFc8UOxMeUfi2hvtIBsET5u9GizXE6/GFSuKCTNfgCswuEjRg==} @@ -709,6 +730,7 @@ packages: globals: 11.12.0 transitivePeerDependencies: - supports-color + dev: false /@babel/types@7.23.6: resolution: {integrity: sha512-+uarb83brBzPKN38NX1MkB6vb6+mwvR6amUulqAE7ccQw1pEl+bCia9TbdG1lsnFP7lZySvUn37CHyXQdfTwzg==} @@ -725,6 +747,7 @@ packages: '@babel/helper-string-parser': 7.23.4 '@babel/helper-validator-identifier': 7.22.20 to-fast-properties: 2.0.0 + dev: false /@bcoe/v8-coverage@0.2.3: resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} @@ -1062,7 +1085,7 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: ajv: 6.12.6 - debug: 4.3.4(supports-color@5.5.0) + debug: 4.3.4 espree: 9.6.1 globals: 13.24.0 ignore: 5.3.0 @@ -1158,7 +1181,7 @@ packages: engines: {node: '>=10.10.0'} dependencies: '@humanwhocodes/object-schema': 2.0.1 - debug: 4.3.4(supports-color@5.5.0) + debug: 4.3.4 minimatch: 3.1.2 transitivePeerDependencies: - supports-color @@ -2723,7 +2746,7 @@ packages: resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} engines: {node: '>= 6.0.0'} dependencies: - debug: 4.3.4(supports-color@5.5.0) + debug: 4.3.4 transitivePeerDependencies: - supports-color @@ -2731,7 +2754,7 @@ packages: resolution: {integrity: sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==} engines: {node: '>= 14'} dependencies: - debug: 4.3.4(supports-color@5.5.0) + debug: 4.3.4 transitivePeerDependencies: - supports-color dev: true @@ -3771,7 +3794,7 @@ packages: chalk: 2.4.2 commander: 2.20.3 core-js: 3.36.0 - debug: 4.3.4(supports-color@5.5.0) + debug: 4.3.4 fast-json-patch: 3.1.1 get-stdin: 6.0.0 http-proxy-agent: 5.0.0 @@ -3846,6 +3869,17 @@ packages: ms: 2.1.3 dev: true + /debug@4.3.4: + resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + dependencies: + ms: 2.1.2 + /debug@4.3.4(supports-color@5.5.0): resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} engines: {node: '>=6.0'} @@ -4731,7 +4765,7 @@ packages: ajv: 6.12.6 chalk: 4.1.2 cross-spawn: 7.0.3 - debug: 4.3.4(supports-color@5.5.0) + debug: 4.3.4 doctrine: 3.0.0 escape-string-regexp: 4.0.0 eslint-scope: 7.2.2 @@ -5243,7 +5277,7 @@ packages: dependencies: basic-ftp: 5.0.4 data-uri-to-buffer: 6.0.2 - debug: 4.3.4(supports-color@5.5.0) + debug: 4.3.4 fs-extra: 11.2.0 transitivePeerDependencies: - supports-color @@ -5537,7 +5571,7 @@ packages: dependencies: '@tootallnate/once': 2.0.0 agent-base: 6.0.2 - debug: 4.3.4(supports-color@5.5.0) + debug: 4.3.4 transitivePeerDependencies: - supports-color dev: true @@ -5547,7 +5581,7 @@ packages: engines: {node: '>= 14'} dependencies: agent-base: 7.1.0 - debug: 4.3.4(supports-color@5.5.0) + debug: 4.3.4 transitivePeerDependencies: - supports-color dev: true @@ -5573,7 +5607,7 @@ packages: engines: {node: '>= 6'} dependencies: agent-base: 6.0.2 - debug: 4.3.4(supports-color@5.5.0) + debug: 4.3.4 transitivePeerDependencies: - supports-color @@ -5582,7 +5616,7 @@ packages: engines: {node: '>= 14'} dependencies: agent-base: 7.1.0 - debug: 4.3.4(supports-color@5.5.0) + debug: 4.3.4 transitivePeerDependencies: - supports-color dev: true @@ -5606,12 +5640,6 @@ packages: engines: {node: '>=16.17.0'} dev: true - /husky@9.0.10: - resolution: {integrity: sha512-TQGNknoiy6bURzIO77pPRu+XHi6zI7T93rX+QnJsoYFf3xdjKOur+IlfqzJGMHIK/wXrLg+GsvMs8Op7vI2jVA==} - engines: {node: '>=18'} - hasBin: true - dev: true - /hygen@6.2.11: resolution: {integrity: sha512-t6/zLI2XozP5gvV74nnl8LZSbwpVNFUkUs/O9DwuOdiiBbws5k4AQNVwKZ9FGzcKjdJ5EBBYkVzlcUHkLyY0FQ==} hasBin: true @@ -5619,7 +5647,7 @@ packages: '@types/node': 17.0.45 chalk: 4.1.2 change-case: 3.1.0 - debug: 4.3.4(supports-color@5.5.0) + debug: 4.3.4 degit: 2.8.4 ejs: 3.1.9 enquirer: 2.4.1 @@ -6169,7 +6197,7 @@ packages: resolution: {integrity: sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==} engines: {node: '>=10'} dependencies: - debug: 4.3.4(supports-color@5.5.0) + debug: 4.3.4 istanbul-lib-coverage: 3.2.2 source-map: 0.6.1 transitivePeerDependencies: @@ -6838,7 +6866,7 @@ packages: dependencies: chalk: 5.3.0 commander: 11.1.0 - debug: 4.3.4(supports-color@5.5.0) + debug: 4.3.4 execa: 8.0.1 lilconfig: 3.0.0 listr2: 8.0.0 @@ -7601,7 +7629,7 @@ packages: dependencies: '@tootallnate/quickjs-emscripten': 0.23.0 agent-base: 7.1.0 - debug: 4.3.4(supports-color@5.5.0) + debug: 4.3.4 get-uri: 6.0.3 http-proxy-agent: 7.0.1 https-proxy-agent: 7.0.3 @@ -7892,7 +7920,7 @@ packages: engines: {node: '>= 14'} dependencies: agent-base: 7.1.0 - debug: 4.3.4(supports-color@5.5.0) + debug: 4.3.4 http-proxy-agent: 7.0.1 https-proxy-agent: 7.0.3 lru-cache: 7.18.3 @@ -8554,7 +8582,7 @@ packages: engines: {node: '>= 14'} dependencies: agent-base: 7.1.0 - debug: 4.3.4(supports-color@5.5.0) + debug: 4.3.4 socks: 2.7.3 transitivePeerDependencies: - supports-color @@ -9046,7 +9074,7 @@ packages: typescript: 5.3.3 dev: true - /ts-jest@29.1.1(@babel/core@7.23.9)(jest@29.7.0)(typescript@5.3.3): + /ts-jest@29.1.1(@babel/core@7.23.6)(jest@29.7.0)(typescript@5.3.3): resolution: {integrity: sha512-D6xjnnbP17cC85nliwGiL+tpoKN0StpgE0TeOjXQTU6MVCfsB4v7aW05CgQ/1OywGb0x/oy9hHFnN+sczTiRaA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} hasBin: true @@ -9067,7 +9095,7 @@ packages: esbuild: optional: true dependencies: - '@babel/core': 7.23.9 + '@babel/core': 7.23.6 bs-logger: 0.2.6 fast-json-stable-stringify: 2.1.0 jest: 29.7.0(@types/node@20.10.6) From 638db3422f9f86894d4910f6c2e50eace88b2fca Mon Sep 17 00:00:00 2001 From: Louis Aussedat Date: Fri, 29 Mar 2024 14:50:20 +0100 Subject: [PATCH 2/7] =?UTF-8?q?=F0=9F=91=B7=20(devx):=20Move=20actions=20t?= =?UTF-8?q?o=20github=20folder?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actions}/setup-toolchain-composite/action.yml | 0 .github/workflows/pull_request.yml | 4 ++-- .github/workflows/version.yml | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) rename {actions => .github/actions}/setup-toolchain-composite/action.yml (100%) diff --git a/actions/setup-toolchain-composite/action.yml b/.github/actions/setup-toolchain-composite/action.yml similarity index 100% rename from actions/setup-toolchain-composite/action.yml rename to .github/actions/setup-toolchain-composite/action.yml diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 8b9388b2f..480e3649e 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -17,7 +17,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: ./actions/setup-toolchain-composite + - uses: ./.github/actions/setup-toolchain-composite - uses: toshimaru/auto-author-assign@v2.1.0 @@ -35,7 +35,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: ./actions/setup-toolchain-composite + - uses: ./.github/actions/setup-toolchain-composite - name: Lint run: pnpm lint diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml index b4b8b7650..d0eeec9ef 100644 --- a/.github/workflows/version.yml +++ b/.github/workflows/version.yml @@ -12,9 +12,12 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: ./actions/setup-toolchain-composite + + - uses: ./.github/actions/setup-toolchain-composite + - name: install dependencies run: pnpm install + - name: create release pull request uses: changesets/action@v1 with: From b53366fa69462488a3c6ab4abf2abdb64913bf2c Mon Sep 17 00:00:00 2001 From: Louis Aussedat Date: Tue, 2 Apr 2024 15:35:45 +0200 Subject: [PATCH 3/7] =?UTF-8?q?=F0=9F=91=B7=20(devx):=20Add=20health=20che?= =?UTF-8?q?ck=20ci=20script?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pull_request.yml | 11 +++-------- package.json | 1 + turbo.json | 3 +++ 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 480e3649e..c21e0c139 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -30,6 +30,7 @@ jobs: run: pnpm danger ci --dangerfile danger/dangerfile.ts --failOnErrors health-check: + name: Pass health check needs: [danger] runs-on: [device-sdk-4xlarge-linux] steps: @@ -37,14 +38,8 @@ jobs: - uses: ./.github/actions/setup-toolchain-composite - - name: Lint - run: pnpm lint - - - name: Prettier - run: pnpm prettier - - - name: Typecheck - run: pnpm typecheck + - name: health check + run: pnpm health-check - name: Test run: pnpm test:coverage -- --max-warnings=0 diff --git a/package.json b/package.json index c0e6898b2..f913f4a16 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "test": "turbo run test --log-order=grouped", "test:coverage": "turbo run test:coverage --log-order=grouped", "typecheck": "turbo run typecheck --log-order=grouped", + "health-check": "turbo run health-check --log-order=grouped --output-logs=errors-only --continue", "core": "pnpm --filter @ledgerhq/device-sdk-core", "signer": "pnpm --filter @ledgerhq/device-sdk-signer", "trusted-apps": "pnpm --filter @ledgerhq/device-sdk-trusted-apps", diff --git a/turbo.json b/turbo.json index f58c258dd..98426dd75 100644 --- a/turbo.json +++ b/turbo.json @@ -35,6 +35,9 @@ }, "typecheck": { "dependsOn": ["build", "^typecheck"] + }, + "health-check": { + "dependsOn": ["build", "prettier", "lint", "typecheck"] } } } From 68a5d62ea03ab5f676fcbc3082464bb6c3628101 Mon Sep 17 00:00:00 2001 From: Louis Aussedat Date: Tue, 2 Apr 2024 15:12:14 +0200 Subject: [PATCH 4/7] =?UTF-8?q?=F0=9F=92=9A=20(devx):=20Fix=20prettier=20a?= =?UTF-8?q?fter=20unit=20test=20run?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/.prettierignore | 3 ++- packages/signer/.prettierignore | 3 ++- packages/trusted-apps/.prettierignore | 3 ++- packages/ui/.prettierignore | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/core/.prettierignore b/packages/core/.prettierignore index 4eb56dc37..af229265b 100644 --- a/packages/core/.prettierignore +++ b/packages/core/.prettierignore @@ -1 +1,2 @@ -lib/* \ No newline at end of file +lib/* +coverage/* diff --git a/packages/signer/.prettierignore b/packages/signer/.prettierignore index 4eb56dc37..af229265b 100644 --- a/packages/signer/.prettierignore +++ b/packages/signer/.prettierignore @@ -1 +1,2 @@ -lib/* \ No newline at end of file +lib/* +coverage/* diff --git a/packages/trusted-apps/.prettierignore b/packages/trusted-apps/.prettierignore index 4eb56dc37..af229265b 100644 --- a/packages/trusted-apps/.prettierignore +++ b/packages/trusted-apps/.prettierignore @@ -1 +1,2 @@ -lib/* \ No newline at end of file +lib/* +coverage/* diff --git a/packages/ui/.prettierignore b/packages/ui/.prettierignore index 4eb56dc37..af229265b 100644 --- a/packages/ui/.prettierignore +++ b/packages/ui/.prettierignore @@ -1 +1,2 @@ -lib/* \ No newline at end of file +lib/* +coverage/* From 8327cde12e4251aaa6acb77737c10464a148a6b9 Mon Sep 17 00:00:00 2001 From: Louis Aussedat Date: Tue, 2 Apr 2024 15:43:50 +0200 Subject: [PATCH 5/7] =?UTF-8?q?=F0=9F=91=B7=20(devx):=20Create=20specific?= =?UTF-8?q?=20job=20for=20unit=20tests/sonar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pull_request.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index c21e0c139..2403489a7 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -41,6 +41,15 @@ jobs: - name: health check run: pnpm health-check + unit-tests: + name: Launch unit tests + needs: [danger] + runs-on: [device-sdk-4xlarge-linux] + steps: + - uses: actions/checkout@v4 + + - uses: ./.github/actions/setup-toolchain-composite + - name: Test run: pnpm test:coverage -- --max-warnings=0 From c324e3c008f4ee708f1fdbceeda6e7afdcfb9e39 Mon Sep 17 00:00:00 2001 From: Louis Aussedat Date: Tue, 2 Apr 2024 10:09:07 +0200 Subject: [PATCH 6/7] =?UTF-8?q?=F0=9F=91=B7=20(devx):=20Create=20specific?= =?UTF-8?q?=20job=20for=20auto=20assign?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit auto assign is not really a check but an action Remove it from danger check job. --- .github/workflows/pull_request.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 2403489a7..a848fc2c6 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -11,6 +11,12 @@ concurrency: cancel-in-progress: true jobs: + auto-assign: + name: Auto assign + runs-on: [ubuntu-latest] + steps: + - uses: toshimaru/auto-author-assign@v2.1.0 + danger: name: Pass Danger check runs-on: [ubuntu-latest] @@ -19,8 +25,6 @@ jobs: - uses: ./.github/actions/setup-toolchain-composite - - uses: toshimaru/auto-author-assign@v2.1.0 - - name: Danger env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 77ce8ef1da3651bd7b7471a826240e734f50e0bd Mon Sep 17 00:00:00 2001 From: Louis Aussedat Date: Tue, 2 Apr 2024 10:36:19 +0200 Subject: [PATCH 7/7] =?UTF-8?q?=F0=9F=91=B7=20(devx):=20Create=20danger=20?= =?UTF-8?q?check=20ci=20script?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allow the possibility to run it locally. For now, we need to set a github token because the repo is private. --- .github/actions/danger-check.sh | 27 +++++++++++++++++++++++++++ .github/workflows/pull_request.yml | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100755 .github/actions/danger-check.sh diff --git a/.github/actions/danger-check.sh b/.github/actions/danger-check.sh new file mode 100755 index 000000000..eca68890c --- /dev/null +++ b/.github/actions/danger-check.sh @@ -0,0 +1,27 @@ +#!/bin/bash +set -e + +is_running_on_github_actions() { + [ -n "$CI" ] && [ -n "$GITHUB_ACTIONS" ] +} + +run_danger_on_github_actions() { + echo "Script is running within GitHub Actions workflow." + pnpm danger ci --dangerfile danger/dangerfile.ts --failOnErrors +} + +run_danger_on_local() { + echo "Script is running locally." + pnpm danger pr --dangerfile danger/dangerfile.ts https://github.com/LedgerHQ/device-sdk-ts/pull/${1} +} + +if is_running_on_github_actions; then + run_danger_on_github_actions +else + if [ -z "$1" ]; then + echo "Argument PR number is missing" + exit 1 + fi + run_danger_on_local "$1" +fi + diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index a848fc2c6..54f90bb1d 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -31,7 +31,7 @@ jobs: # Workaround when using custom runners # https://github.com/danger/danger-js/issues/1374 DANGER_GITHUB_API_BASE_URL: "https://api.github.com" - run: pnpm danger ci --dangerfile danger/dangerfile.ts --failOnErrors + run: ./.github/actions/danger-check.sh health-check: name: Pass health check