From 9e31f5a53dc4da299f4cb37fd54104c749b9a897 Mon Sep 17 00:00:00 2001 From: Derek Croote Date: Mon, 26 Aug 2024 19:55:39 -0700 Subject: [PATCH 01/10] Add Actions workflow to check commons for breaking changes --- .github/workflows/check-against-commons.yml | 43 +++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/check-against-commons.yml diff --git a/.github/workflows/check-against-commons.yml b/.github/workflows/check-against-commons.yml new file mode 100644 index 0000000..02c5112 --- /dev/null +++ b/.github/workflows/check-against-commons.yml @@ -0,0 +1,43 @@ +name: Check Breaking Changes in Commons + +on: + pull_request: + branches: + - main + +jobs: + check-breaking-changes: + runs-on: ubuntu-latest + steps: + - name: Clone repo + uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install + + - name: Package repository + run: pnpm pack + + - name: Checkout commons repository + uses: actions/checkout@v4 + with: + repository: api3dao/commons + path: commons + + - name: Install packaged version in commons + working-directory: commons + run: | + pnpm add -D file:${{ github.workspace }}/*.tgz + + - name: Run ESLint on commons + working-directory: commons + run: pnpm eslint . From c431c35c7e0787c85a7d604ddf02d17b4a121ecb Mon Sep 17 00:00:00 2001 From: Derek Croote Date: Mon, 26 Aug 2024 20:54:11 -0700 Subject: [PATCH 02/10] Use variables and separate directories --- .github/workflows/check-against-commons.yml | 28 ++++++++++++++------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/.github/workflows/check-against-commons.yml b/.github/workflows/check-against-commons.yml index 02c5112..ddfd78e 100644 --- a/.github/workflows/check-against-commons.yml +++ b/.github/workflows/check-against-commons.yml @@ -5,12 +5,18 @@ on: branches: - main +env: + PLUGIN_DIR: eslint-plugin-commons + COMMONS_DIR: commons + jobs: check-breaking-changes: runs-on: ubuntu-latest steps: - - name: Clone repo + - name: Checkout eslint-plugin-commons uses: actions/checkout@v4 + with: + path: ${{ env.PLUGIN_DIR }} - name: Install pnpm uses: pnpm/action-setup@v4 @@ -21,23 +27,27 @@ jobs: node-version: '20' cache: 'pnpm' - - name: Install dependencies + - name: Install dependencies for eslint-plugin-commons + working-directory: ${{ env.PLUGIN_DIR }} run: pnpm install - - name: Package repository - run: pnpm pack + - name: Package eslint-plugin-commons + working-directory: ${{ env.PLUGIN_DIR }} + run: | + PACKAGE_PATH=$(pnpm pack | tail -n 1) + echo "PACKAGE_PATH=${{ env.PLUGIN_DIR }}/$PACKAGE_PATH" >> $GITHUB_ENV - name: Checkout commons repository uses: actions/checkout@v4 with: repository: api3dao/commons - path: commons + path: ${{ env.COMMONS_DIR }} - name: Install packaged version in commons - working-directory: commons + working-directory: ${{ env.COMMONS_DIR }} run: | - pnpm add -D file:${{ github.workspace }}/*.tgz + pnpm add -D file:../${{ env.PACKAGE_PATH }} - name: Run ESLint on commons - working-directory: commons - run: pnpm eslint . + working-directory: ${{ env.COMMONS_DIR }} + run: pnpm eslint . \ No newline at end of file From f067d2bb91996d7006dada48d7f182d5917c73fc Mon Sep 17 00:00:00 2001 From: Derek Croote Date: Mon, 26 Aug 2024 21:00:13 -0700 Subject: [PATCH 03/10] Tell pnpm where to look for version --- .github/workflows/check-against-commons.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/check-against-commons.yml b/.github/workflows/check-against-commons.yml index ddfd78e..75e52d9 100644 --- a/.github/workflows/check-against-commons.yml +++ b/.github/workflows/check-against-commons.yml @@ -20,6 +20,8 @@ jobs: - name: Install pnpm uses: pnpm/action-setup@v4 + with: + package_json_file: ${{ env.PLUGIN_DIR }}/package.json - name: Setup Node uses: actions/setup-node@v4 From c9371e8a3d0f69cc34ed1eb1118e939b07e64e4d Mon Sep 17 00:00:00 2001 From: Derek Croote Date: Mon, 26 Aug 2024 21:03:44 -0700 Subject: [PATCH 04/10] Simplify to one directory --- .github/workflows/check-against-commons.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/check-against-commons.yml b/.github/workflows/check-against-commons.yml index 75e52d9..31a08f0 100644 --- a/.github/workflows/check-against-commons.yml +++ b/.github/workflows/check-against-commons.yml @@ -6,7 +6,6 @@ on: - main env: - PLUGIN_DIR: eslint-plugin-commons COMMONS_DIR: commons jobs: @@ -15,13 +14,9 @@ jobs: steps: - name: Checkout eslint-plugin-commons uses: actions/checkout@v4 - with: - path: ${{ env.PLUGIN_DIR }} - name: Install pnpm uses: pnpm/action-setup@v4 - with: - package_json_file: ${{ env.PLUGIN_DIR }}/package.json - name: Setup Node uses: actions/setup-node@v4 @@ -30,14 +25,12 @@ jobs: cache: 'pnpm' - name: Install dependencies for eslint-plugin-commons - working-directory: ${{ env.PLUGIN_DIR }} run: pnpm install - name: Package eslint-plugin-commons - working-directory: ${{ env.PLUGIN_DIR }} run: | PACKAGE_PATH=$(pnpm pack | tail -n 1) - echo "PACKAGE_PATH=${{ env.PLUGIN_DIR }}/$PACKAGE_PATH" >> $GITHUB_ENV + echo "PACKAGE_PATH=$PACKAGE_PATH" >> $GITHUB_ENV - name: Checkout commons repository uses: actions/checkout@v4 From c644175748e9e932c4a7d6a3722d50ab0327abe0 Mon Sep 17 00:00:00 2001 From: Derek Croote Date: Mon, 26 Aug 2024 21:08:28 -0700 Subject: [PATCH 05/10] Move commons up a directory --- .github/workflows/check-against-commons.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-against-commons.yml b/.github/workflows/check-against-commons.yml index 31a08f0..0dd9469 100644 --- a/.github/workflows/check-against-commons.yml +++ b/.github/workflows/check-against-commons.yml @@ -6,7 +6,7 @@ on: - main env: - COMMONS_DIR: commons + COMMONS_DIR: ../commons jobs: check-breaking-changes: From bab6038495748d2404fa86fe6327ccb34ae89fa6 Mon Sep 17 00:00:00 2001 From: Derek Croote Date: Mon, 26 Aug 2024 21:16:18 -0700 Subject: [PATCH 06/10] Move commons up --- .github/workflows/check-against-commons.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/check-against-commons.yml b/.github/workflows/check-against-commons.yml index 0dd9469..6d44d82 100644 --- a/.github/workflows/check-against-commons.yml +++ b/.github/workflows/check-against-commons.yml @@ -5,9 +5,6 @@ on: branches: - main -env: - COMMONS_DIR: ../commons - jobs: check-breaking-changes: runs-on: ubuntu-latest @@ -36,13 +33,16 @@ jobs: uses: actions/checkout@v4 with: repository: api3dao/commons - path: ${{ env.COMMONS_DIR }} + path: commons + + - name: Move commons outside of the repo + run: mv commons ../ - name: Install packaged version in commons - working-directory: ${{ env.COMMONS_DIR }} + working-directory: ../commons run: | - pnpm add -D file:../${{ env.PACKAGE_PATH }} + pnpm add -D file:eslint-plugin-commons/${{ env.PACKAGE_PATH }} - name: Run ESLint on commons - working-directory: ${{ env.COMMONS_DIR }} + working-directory: ../commons run: pnpm eslint . \ No newline at end of file From 9392a43e4b6337a50dc88b81bfd60365332788ee Mon Sep 17 00:00:00 2001 From: Derek Croote Date: Mon, 26 Aug 2024 21:18:31 -0700 Subject: [PATCH 07/10] Fix tgz path --- .github/workflows/check-against-commons.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-against-commons.yml b/.github/workflows/check-against-commons.yml index 6d44d82..08f88ae 100644 --- a/.github/workflows/check-against-commons.yml +++ b/.github/workflows/check-against-commons.yml @@ -41,7 +41,7 @@ jobs: - name: Install packaged version in commons working-directory: ../commons run: | - pnpm add -D file:eslint-plugin-commons/${{ env.PACKAGE_PATH }} + pnpm add -D file:../eslint-plugin-commons/${{ env.PACKAGE_PATH }} - name: Run ESLint on commons working-directory: ../commons From e1993df51be15bdd63c5ddf2f3cb2cf1f5fb1e62 Mon Sep 17 00:00:00 2001 From: Derek Croote Date: Mon, 26 Aug 2024 21:28:17 -0700 Subject: [PATCH 08/10] Use env for simplicity --- .github/workflows/check-against-commons.yml | 23 ++++++++++++--------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/check-against-commons.yml b/.github/workflows/check-against-commons.yml index 08f88ae..680b8f7 100644 --- a/.github/workflows/check-against-commons.yml +++ b/.github/workflows/check-against-commons.yml @@ -1,10 +1,13 @@ -name: Check Breaking Changes in Commons +name: Check Breaking Changes on: pull_request: branches: - main +env: + repo_name: commons + jobs: check-breaking-changes: runs-on: ubuntu-latest @@ -29,20 +32,20 @@ jobs: PACKAGE_PATH=$(pnpm pack | tail -n 1) echo "PACKAGE_PATH=$PACKAGE_PATH" >> $GITHUB_ENV - - name: Checkout commons repository + - name: Checkout api3dao/${{ env.repo_name }} repository uses: actions/checkout@v4 with: - repository: api3dao/commons - path: commons + repository: api3dao/${{ env.repo_name }} + path: ${{ env.repo_name }} - - name: Move commons outside of the repo - run: mv commons ../ + - name: Move ${{ env.repo_name }} outside of the repo + run: mv ${{ env.repo_name }} ../ - - name: Install packaged version in commons - working-directory: ../commons + - name: Install packaged version in ${{ env.repo_name }} + working-directory: ../${{ env.repo_name }} run: | pnpm add -D file:../eslint-plugin-commons/${{ env.PACKAGE_PATH }} - - name: Run ESLint on commons - working-directory: ../commons + - name: Run ESLint on ${{ env.repo_name }} + working-directory: ../${{ env.repo_name }} run: pnpm eslint . \ No newline at end of file From ebfebab310a5401910fd2e7051b386984c55ca66 Mon Sep 17 00:00:00 2001 From: Derek Croote Date: Tue, 27 Aug 2024 21:59:51 -0700 Subject: [PATCH 09/10] Cleanup and add comment --- .github/workflows/check-against-commons.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/check-against-commons.yml b/.github/workflows/check-against-commons.yml index 680b8f7..0694a08 100644 --- a/.github/workflows/check-against-commons.yml +++ b/.github/workflows/check-against-commons.yml @@ -1,4 +1,4 @@ -name: Check Breaking Changes +name: Check for breaking changes on: pull_request: @@ -32,20 +32,22 @@ jobs: PACKAGE_PATH=$(pnpm pack | tail -n 1) echo "PACKAGE_PATH=$PACKAGE_PATH" >> $GITHUB_ENV - - name: Checkout api3dao/${{ env.repo_name }} repository + - name: Checkout api3dao/${{ env.repo_name }} repo uses: actions/checkout@v4 with: repository: api3dao/${{ env.repo_name }} path: ${{ env.repo_name }} - - name: Move ${{ env.repo_name }} outside of the repo + # Workaround for inability clone outside of workspace directory + # See: https://github.com/actions/checkout/issues/197#issuecomment-603651324 + - name: Move ${{ env.repo_name }} directory outside of eslint-plugin-commons repo run: mv ${{ env.repo_name }} ../ - - name: Install packaged version in ${{ env.repo_name }} + - name: Install packaged eslint-plugin-commons in ${{ env.repo_name }} working-directory: ../${{ env.repo_name }} run: | pnpm add -D file:../eslint-plugin-commons/${{ env.PACKAGE_PATH }} - name: Run ESLint on ${{ env.repo_name }} working-directory: ../${{ env.repo_name }} - run: pnpm eslint . \ No newline at end of file + run: pnpm eslint . From d93a49a9430da583676a6abbf3bc3b5124432b7f Mon Sep 17 00:00:00 2001 From: Derek Croote Date: Wed, 28 Aug 2024 07:43:59 -0700 Subject: [PATCH 10/10] Update .github/workflows/check-against-commons.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Emanuel Tesaƙ --- .github/workflows/check-against-commons.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-against-commons.yml b/.github/workflows/check-against-commons.yml index 0694a08..82850bd 100644 --- a/.github/workflows/check-against-commons.yml +++ b/.github/workflows/check-against-commons.yml @@ -38,7 +38,7 @@ jobs: repository: api3dao/${{ env.repo_name }} path: ${{ env.repo_name }} - # Workaround for inability clone outside of workspace directory + # Workaround for inability to clone outside of workspace directory # See: https://github.com/actions/checkout/issues/197#issuecomment-603651324 - name: Move ${{ env.repo_name }} directory outside of eslint-plugin-commons repo run: mv ${{ env.repo_name }} ../