From 1650ca08948681a594ffbeea8c0892286d756b02 Mon Sep 17 00:00:00 2001 From: Aad Rijnberg <83588870+aadrijnberg@users.noreply.github.com> Date: Thu, 12 Aug 2021 11:02:59 +0200 Subject: [PATCH 1/3] feat: add fomat checking for lambdas in CI (#899) --- .github/workflows/lambda-runner-binaries-syncer.yml | 2 ++ .github/workflows/lambda-runners.yml | 2 ++ .github/workflows/lambda-webhook.yml | 2 ++ 3 files changed, 6 insertions(+) diff --git a/.github/workflows/lambda-runner-binaries-syncer.yml b/.github/workflows/lambda-runner-binaries-syncer.yml index 150484fa86..241bf9dec6 100644 --- a/.github/workflows/lambda-runner-binaries-syncer.yml +++ b/.github/workflows/lambda-runner-binaries-syncer.yml @@ -22,6 +22,8 @@ jobs: - uses: actions/checkout@v2 - name: Install dependencies run: yarn install + - name: Run prettier + run: yarn format-check - name: Run linter run: yarn lint - name: Run tests diff --git a/.github/workflows/lambda-runners.yml b/.github/workflows/lambda-runners.yml index 79763512fd..f7b2a15be7 100644 --- a/.github/workflows/lambda-runners.yml +++ b/.github/workflows/lambda-runners.yml @@ -20,6 +20,8 @@ jobs: - uses: actions/checkout@v2 - name: Install dependencies run: yarn install + - name: Run prettier + run: yarn format-check - name: Run linter run: yarn lint - name: Run tests diff --git a/.github/workflows/lambda-webhook.yml b/.github/workflows/lambda-webhook.yml index 383bf65fed..9cef0f4494 100644 --- a/.github/workflows/lambda-webhook.yml +++ b/.github/workflows/lambda-webhook.yml @@ -20,6 +20,8 @@ jobs: - uses: actions/checkout@v2 - name: Install dependencies run: yarn install + - name: Run prettier + run: yarn format-check - name: Run linter run: yarn lint - name: Run tests From e8a0c60a198290223a2b68f33ca60d86c0556f2f Mon Sep 17 00:00:00 2001 From: Aad Rijnberg <83588870+aadrijnberg@users.noreply.github.com> Date: Thu, 12 Aug 2021 11:29:42 +0200 Subject: [PATCH 2/3] FIx build issues. - fix prettier issue - add dependencies for the syncer module - use same eslint in all 3 modules --- .../lambdas/runner-binaries-syncer/package.json | 4 +++- modules/runners/lambdas/runners/package.json | 2 +- .../lambdas/runners/src/scale-runners/scale-up.test.ts | 4 ++-- modules/webhook/lambdas/webhook/package.json | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/package.json b/modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/package.json index c0a15f145e..f4516121b5 100644 --- a/modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/package.json +++ b/modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/package.json @@ -23,8 +23,10 @@ "@typescript-eslint/parser": "^4.29.1", "@vercel/ncc": "^0.29.0", "aws-sdk": "^2.965.0", - "eslint": "^7.24.0", + "eslint": "^7.32.0", + "eslint-plugin-prettier": "3.4.0", "jest": "^26.6.3", + "prettier": "2.3.2", "ts-jest": "^26.5.5", "ts-node-dev": "^1.1.6", "typescript": "^4.3.4" diff --git a/modules/runners/lambdas/runners/package.json b/modules/runners/lambdas/runners/package.json index ea0ea08811..f5d47f7483 100644 --- a/modules/runners/lambdas/runners/package.json +++ b/modules/runners/lambdas/runners/package.json @@ -22,7 +22,7 @@ "@typescript-eslint/eslint-plugin": "^4.29.1", "@typescript-eslint/parser": "^4.29.1", "@vercel/ncc": "^0.29.0", - "eslint": "^7.22.0", + "eslint": "^7.32.0", "eslint-plugin-prettier": "3.4.0", "jest": "27.0.6", "jest-mock-extended": "^2.0.1", diff --git a/modules/runners/lambdas/runners/src/scale-runners/scale-up.test.ts b/modules/runners/lambdas/runners/src/scale-runners/scale-up.test.ts index 6f82aedcdb..b44e887b90 100644 --- a/modules/runners/lambdas/runners/src/scale-runners/scale-up.test.ts +++ b/modules/runners/lambdas/runners/src/scale-runners/scale-up.test.ts @@ -271,7 +271,7 @@ describe('scaleUp with GHES', () => { expect(mockOctokit.actions.createRegistrationTokenForOrg).not.toBeCalled(); expect(mockOctokit.actions.createRegistrationTokenForRepo).not.toBeCalled(); }); - + it('creates a token when maximum runners has not been reached', async () => { await scaleUpModule.scaleUp('aws:sqs', TEST_DATA); expect(mockOctokit.actions.createRegistrationTokenForOrg).not.toBeCalled(); @@ -481,7 +481,7 @@ describe('scaleUp with public GH', () => { expect(mockOctokit.actions.createRegistrationTokenForOrg).not.toBeCalled(); expect(mockOctokit.actions.createRegistrationTokenForRepo).not.toBeCalled(); }); - + it('creates a token when maximum runners has not been reached', async () => { await scaleUpModule.scaleUp('aws:sqs', TEST_DATA); expect(mockOctokit.actions.createRegistrationTokenForOrg).not.toBeCalled(); diff --git a/modules/webhook/lambdas/webhook/package.json b/modules/webhook/lambdas/webhook/package.json index 2d42a0819f..47a2a582a8 100644 --- a/modules/webhook/lambdas/webhook/package.json +++ b/modules/webhook/lambdas/webhook/package.json @@ -26,7 +26,7 @@ "@vercel/ncc": "0.29.0", "aws-sdk": "^2.965.0", "body-parser": "^1.19.0", - "eslint": "^7.29.0", + "eslint": "^7.32.0", "eslint-plugin-prettier": "3.4.0", "express": "^4.17.1", "jest": "^26.6.3", From 3b0796fa0fef19a6d70a5118f4f048066bf200c5 Mon Sep 17 00:00:00 2001 From: Aad Rijnberg <83588870+aadrijnberg@users.noreply.github.com> Date: Thu, 12 Aug 2021 11:38:17 +0200 Subject: [PATCH 3/3] Fix prettier issue, and update the yarn.lock files --- .../src/syncer/handler.test.ts | 2 +- .../lambdas/runner-binaries-syncer/yarn.lock | 26 ++++++++++++++++++- modules/webhook/lambdas/webhook/yarn.lock | 2 +- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/src/syncer/handler.test.ts b/modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/src/syncer/handler.test.ts index 6958429ca7..ddca0b3633 100644 --- a/modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/src/syncer/handler.test.ts +++ b/modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/src/syncer/handler.test.ts @@ -70,7 +70,7 @@ describe('Synchronize action distribution.', () => { }, }; }); - + await handle(); expect(mockOctokit.repos.listReleases).toBeCalledTimes(1); expect(mockS3.getObjectTagging).toBeCalledWith({ diff --git a/modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/yarn.lock b/modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/yarn.lock index 3f4d29b410..d3242414e7 100644 --- a/modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/yarn.lock +++ b/modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/yarn.lock @@ -1694,6 +1694,13 @@ escodegen@^2.0.0: optionalDependencies: source-map "~0.6.1" +eslint-plugin-prettier@3.4.0: + version "3.4.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.4.0.tgz#cdbad3bf1dbd2b177e9825737fe63b476a08f0c7" + integrity sha512-UDK6rJT6INSfcOo545jiaOwB701uAIt2/dR7WnFQoGCVl1/EMqdANBmwUaqqQ45aXprsTGzSa39LI1PyuRBxxw== + dependencies: + prettier-linter-helpers "^1.0.0" + eslint-scope@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" @@ -1726,7 +1733,7 @@ eslint-visitor-keys@^2.0.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303" integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== -eslint@^7.24.0: +eslint@^7.32.0: version "7.32.0" resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.32.0.tgz#c6d328a14be3fb08c8d1d21e12c02fdb7a2a812d" integrity sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA== @@ -1932,6 +1939,11 @@ fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== +fast-diff@^1.1.2: + version "1.2.0" + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03" + integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w== + fast-glob@^3.1.1: version "3.2.7" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.7.tgz#fd6cb7a2d7e9aa7a7846111e85a196d6b2f766a1" @@ -3561,6 +3573,18 @@ prelude-ls@~1.1.2: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= +prettier-linter-helpers@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" + integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== + dependencies: + fast-diff "^1.1.2" + +prettier@2.3.2: + version "2.3.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.3.2.tgz#ef280a05ec253712e486233db5c6f23441e7342d" + integrity sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ== + pretty-format@^26.0.0, pretty-format@^26.6.2: version "26.6.2" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-26.6.2.tgz#e35c2705f14cb7fe2fe94fa078345b444120fc93" diff --git a/modules/webhook/lambdas/webhook/yarn.lock b/modules/webhook/lambdas/webhook/yarn.lock index 4043eb0434..a05a0eb342 100644 --- a/modules/webhook/lambdas/webhook/yarn.lock +++ b/modules/webhook/lambdas/webhook/yarn.lock @@ -2439,7 +2439,7 @@ eslint-visitor-keys@^2.0.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303" integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== -eslint@^7.29.0: +eslint@^7.32.0: version "7.32.0" resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.32.0.tgz#c6d328a14be3fb08c8d1d21e12c02fdb7a2a812d" integrity sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA==