From 831df924aa24cf673e28daa6abb07019384863ae Mon Sep 17 00:00:00 2001 From: Steven Date: Thu, 30 Mar 2023 14:39:33 -0400 Subject: [PATCH 1/6] chore(ci): fix codemod tests --- .github/workflows/build_test_deploy.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build_test_deploy.yml b/.github/workflows/build_test_deploy.yml index 63e2da47fff9f..a713974809c82 100644 --- a/.github/workflows/build_test_deploy.yml +++ b/.github/workflows/build_test_deploy.yml @@ -35,6 +35,7 @@ jobs: TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} outputs: docsChange: ${{ steps.docs-change.outputs.DOCS_CHANGE }} + codemodChange: ${{ steps.codemod-change.outputs.CODEMOD_CHANGE }} isRelease: ${{ steps.check-release.outputs.IS_RELEASE }} swcChange: ${{ steps.swc-change.outputs.SWC_CHANGE }} turboToken: ${{ steps.turbo-token.outputs.TURBO_TOKEN }} @@ -671,7 +672,7 @@ jobs: TEST_TIMINGS_TOKEN: ${{ secrets.TEST_TIMINGS_TOKEN }} steps: - - run: echo "${{needs.build.outputs.docsChange}}" + - run: echo "${{needs.build.outputs.codemodChange}}" # https://github.com/actions/virtual-environments/issues/1187 - name: tune linux network @@ -679,17 +680,15 @@ jobs: - uses: actions/cache@v3 timeout-minutes: 5 - if: ${{ needs.build.outputs.docsChange == 'nope' }} + if: ${{ needs.build.outputs.codemodChange == 'yep' }} id: restore-build with: path: ./* key: ${{ github.sha }}-${{ github.run_number }} - - run: echo "CODEMOD_CHANGE<> $GITHUB_OUTPUT; echo "$(node scripts/run-for-change.js --type next-codemod --always-canary --exec echo 'yup')" >> $GITHUB_OUTPUT; echo "EOF" >> $GITHUB_OUTPUT - id: codemodChange - - - run: docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.28.1-jammy /bin/bash -c "cd /work && curl -s https://install-node.vercel.app/v${{ env.NODE_LTS_VERSION }} | FORCE=1 bash && npm i -g pnpm@${PNPM_VERSION} > /dev/null && cd ./packages/next-codemod && pnpm build && pnpm test >> /proc/1/fd/1" - if: ${{ needs.build.outputs.docsChange == 'nope' && steps.codemodChange.outputs.CODEMOD_CHANGE == 'yup' }} + - name: Test if changes were found + run: docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.28.1-jammy /bin/bash -c "cd /work && curl -s https://install-node.vercel.app/v${{ env.NODE_LTS_VERSION }} | FORCE=1 bash && npm i -g pnpm@${PNPM_VERSION} > /dev/null && cd ./packages/next-codemod && pnpm build && pnpm test >> /proc/1/fd/1" + if: ${{ needs.build.outputs.codemodChange == 'yup' }} testIntegration: name: Test Integration @@ -1173,6 +1172,10 @@ jobs: - run: echo "${{ steps.docs-chang.outputs.DOCS_CHANGE }}" + - name: Check codemod only change + run: echo "CODEMOD_CHANGE<> $GITHUB_OUTPUT; echo "$(node scripts/run-for-change.js --type next-codemod --always-canary --exec echo 'yup')" >> $GITHUB_OUTPUT; echo "EOF" >> $GITHUB_OUTPUT + id: codemod-change + - name: Install if: ${{ steps.docs-chang.outputs.DOCS_CHANGE != 'yep' }} uses: actions-rs/toolchain@v1 From 2029d26ee4cbbba9625ce150090223565a12a549 Mon Sep 17 00:00:00 2001 From: Steven Date: Thu, 30 Mar 2023 15:10:47 -0400 Subject: [PATCH 2/6] Move if statement to top --- .github/workflows/build_test_deploy.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_test_deploy.yml b/.github/workflows/build_test_deploy.yml index a713974809c82..4b56da8b91ce0 100644 --- a/.github/workflows/build_test_deploy.yml +++ b/.github/workflows/build_test_deploy.yml @@ -666,6 +666,7 @@ jobs: name: Test Codemods runs-on: ubuntu-latest needs: [build] + if: ${{ needs.build.outputs.codemodChange == 'yep' }} timeout-minutes: 5 env: NEXT_TELEMETRY_DISABLED: 1 @@ -680,15 +681,13 @@ jobs: - uses: actions/cache@v3 timeout-minutes: 5 - if: ${{ needs.build.outputs.codemodChange == 'yep' }} id: restore-build with: path: ./* key: ${{ github.sha }}-${{ github.run_number }} - - name: Test if changes were found + - name: Run tests run: docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.28.1-jammy /bin/bash -c "cd /work && curl -s https://install-node.vercel.app/v${{ env.NODE_LTS_VERSION }} | FORCE=1 bash && npm i -g pnpm@${PNPM_VERSION} > /dev/null && cd ./packages/next-codemod && pnpm build && pnpm test >> /proc/1/fd/1" - if: ${{ needs.build.outputs.codemodChange == 'yup' }} testIntegration: name: Test Integration From 8af7c53c60ab5acbd14ba78dd909e6e92af7e89c Mon Sep 17 00:00:00 2001 From: Steven Date: Thu, 30 Mar 2023 15:15:44 -0400 Subject: [PATCH 3/6] Move into build job --- .github/workflows/build_test_deploy.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_test_deploy.yml b/.github/workflows/build_test_deploy.yml index 4b56da8b91ce0..fa13a99b7f69b 100644 --- a/.github/workflows/build_test_deploy.yml +++ b/.github/workflows/build_test_deploy.yml @@ -62,6 +62,10 @@ jobs: - run: echo "${{steps.docs-change.outputs.DOCS_CHANGE}}" + - name: Check codemod only change + run: echo "CODEMOD_CHANGE<> $GITHUB_OUTPUT; echo "$(node scripts/run-for-change.js --type next-codemod --always-canary --exec echo 'yup')" >> $GITHUB_OUTPUT; echo "EOF" >> $GITHUB_OUTPUT + id: codemod-change + - run: echo "SWC_CHANGE<> $GITHUB_OUTPUT; echo "$(node scripts/run-for-change.js --type next-swc --exec echo 'yup')" >> $GITHUB_OUTPUT; echo 'EOF' >> $GITHUB_OUTPUT id: swc-change @@ -1171,10 +1175,6 @@ jobs: - run: echo "${{ steps.docs-chang.outputs.DOCS_CHANGE }}" - - name: Check codemod only change - run: echo "CODEMOD_CHANGE<> $GITHUB_OUTPUT; echo "$(node scripts/run-for-change.js --type next-codemod --always-canary --exec echo 'yup')" >> $GITHUB_OUTPUT; echo "EOF" >> $GITHUB_OUTPUT - id: codemod-change - - name: Install if: ${{ steps.docs-chang.outputs.DOCS_CHANGE != 'yep' }} uses: actions-rs/toolchain@v1 From b66c4d74c765ce0bfad7467386fa67d5d6c98159 Mon Sep 17 00:00:00 2001 From: Steven Date: Thu, 30 Mar 2023 15:27:21 -0400 Subject: [PATCH 4/6] Add repository to package.json --- packages/next-codemod/package.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/next-codemod/package.json b/packages/next-codemod/package.json index c1492470584d5..68bc8dc4203f4 100644 --- a/packages/next-codemod/package.json +++ b/packages/next-codemod/package.json @@ -2,6 +2,11 @@ "name": "@next/codemod", "version": "13.2.5-canary.21", "license": "MIT", + "repository": { + "type": "git", + "url": "vercel/next.js", + "directory": "packages/next-codemod" + }, "dependencies": { "chalk": "4.1.0", "cheerio": "1.0.0-rc.9", From d2cf22479552bb8b9ca7bc1d9a02ab410269e468 Mon Sep 17 00:00:00 2001 From: Steven Date: Thu, 30 Mar 2023 15:46:51 -0400 Subject: [PATCH 5/6] Add debug logic --- .github/workflows/build_test_deploy.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_test_deploy.yml b/.github/workflows/build_test_deploy.yml index fa13a99b7f69b..55ef166c8e0fd 100644 --- a/.github/workflows/build_test_deploy.yml +++ b/.github/workflows/build_test_deploy.yml @@ -62,10 +62,12 @@ jobs: - run: echo "${{steps.docs-change.outputs.DOCS_CHANGE}}" - - name: Check codemod only change - run: echo "CODEMOD_CHANGE<> $GITHUB_OUTPUT; echo "$(node scripts/run-for-change.js --type next-codemod --always-canary --exec echo 'yup')" >> $GITHUB_OUTPUT; echo "EOF" >> $GITHUB_OUTPUT + - name: Check codemod change + run: echo "CODEMOD_CHANGE<> $GITHUB_OUTPUT; echo "$(node scripts/run-for-change.js --type next-codemod --exec echo 'yup')" >> $GITHUB_OUTPUT; echo 'EOF' >> $GITHUB_OUTPUT id: codemod-change + - run: echo "${{steps.codemod-change.outputs.CODEMOD_CHANGE}}" + - run: echo "SWC_CHANGE<> $GITHUB_OUTPUT; echo "$(node scripts/run-for-change.js --type next-swc --exec echo 'yup')" >> $GITHUB_OUTPUT; echo 'EOF' >> $GITHUB_OUTPUT id: swc-change From ebdf7df6f5ae902e4ffbe76bb1874bbdad010b25 Mon Sep 17 00:00:00 2001 From: Steven Date: Thu, 30 Mar 2023 15:47:53 -0400 Subject: [PATCH 6/6] Fix typo --- .github/workflows/build_test_deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_test_deploy.yml b/.github/workflows/build_test_deploy.yml index 55ef166c8e0fd..df71e5c4c4741 100644 --- a/.github/workflows/build_test_deploy.yml +++ b/.github/workflows/build_test_deploy.yml @@ -672,7 +672,7 @@ jobs: name: Test Codemods runs-on: ubuntu-latest needs: [build] - if: ${{ needs.build.outputs.codemodChange == 'yep' }} + if: ${{ needs.build.outputs.codemodChange == 'yup' }} timeout-minutes: 5 env: NEXT_TELEMETRY_DISABLED: 1