From fbc847b5ec3b1771da6ebc698c74e517624e6455 Mon Sep 17 00:00:00 2001 From: kazizi55 <kaz.redhot1201@gmail.com> Date: Mon, 9 Oct 2023 20:21:17 +0900 Subject: [PATCH 1/8] ci: add lint and format check --- .github/workflows/node.yml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml index 477131b4d..b04b8aef0 100644 --- a/.github/workflows/node.yml +++ b/.github/workflows/node.yml @@ -42,5 +42,18 @@ jobs: - name: Install dependencies run: pnpm install - - name: Run Vitest - run: cd ./library && pnpm test + - name: Run linter in website + working-directory: website + run: pnpm lint + + - name: Run formatter in website + working-directory: website + run: pnpm format.check + + - name: Run linter in library + working-directory: library + run: pnpm lint + + - name: Run Vitest in library + working-directory: library + run: pnpm test From 23d04e652594e11a57860812969656a08ca6b7ab Mon Sep 17 00:00:00 2001 From: kazizi55 <kaz.redhot1201@gmail.com> Date: Fri, 13 Oct 2023 07:23:12 +0900 Subject: [PATCH 2/8] ci: run in parallel --- .github/workflows/node.yml | 39 +++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml index b04b8aef0..bbbcd6d2d 100644 --- a/.github/workflows/node.yml +++ b/.github/workflows/node.yml @@ -6,7 +6,8 @@ on: pull_request: jobs: - test: + install: + name: Checkout and Install runs-on: ubuntu-latest steps: @@ -42,18 +43,38 @@ jobs: - name: Install dependencies run: pnpm install - - name: Run linter in website + lint_website: + name: Run linter in website + needs: install + runs-on: ubuntu-latest + + steps: + - run: pnpm lint working-directory: website - run: pnpm lint - - name: Run formatter in website + format_website: + name: Run formatter in website + needs: install + runs-on: ubuntu-latest + + steps: + - run: pnpm format.check working-directory: website - run: pnpm format.check - - name: Run linter in library + lint_library: + name: Run linter in library + needs: install + runs-on: ubuntu-latest + + steps: + - run: pnpm lint working-directory: library - run: pnpm lint - - name: Run Vitest in library + test_library: + name: Run Vitest in library + needs: install + runs-on: ubuntu-latest + + steps: + - run: pnpm test working-directory: library - run: pnpm test From 28893d8545f5964d8958554e4773acb30f20f317 Mon Sep 17 00:00:00 2001 From: kazizi55 <kaz.redhot1201@gmail.com> Date: Fri, 13 Oct 2023 08:54:30 +0900 Subject: [PATCH 3/8] ci: add composite action --- .github/actions/setup-pnpm-cache/action.yml | 31 +++++++++++ .github/workflows/node.yml | 61 +++++++++++---------- 2 files changed, 63 insertions(+), 29 deletions(-) create mode 100644 .github/actions/setup-pnpm-cache/action.yml diff --git a/.github/actions/setup-pnpm-cache/action.yml b/.github/actions/setup-pnpm-cache/action.yml new file mode 100644 index 000000000..a62c0e9a7 --- /dev/null +++ b/.github/actions/setup-pnpm-cache/action.yml @@ -0,0 +1,31 @@ +name: "Setup pnpm cache" +description: "Setups pnpm cache by installing Node.js and pnpm, and getting the pnpm store directory." + +runs: + using: "composite" + steps: + - name: Install Node.js + uses: actions/setup-node@v3 + with: + node-version: 16 + + - uses: pnpm/action-setup@v2 + name: Install pnpm + id: pnpm-install + with: + version: 8 + run_install: false + + - name: Get pnpm store directory + id: pnpm-cache + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT + + - uses: actions/cache@v3 + name: Setup pnpm cache + with: + path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml index bbbcd6d2d..69cae611b 100644 --- a/.github/workflows/node.yml +++ b/.github/workflows/node.yml @@ -13,32 +13,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - - - name: Install Node.js - uses: actions/setup-node@v3 - with: - node-version: 16 - - - uses: pnpm/action-setup@v2 - name: Install pnpm - id: pnpm-install - with: - version: 8 - run_install: false - - - name: Get pnpm store directory - id: pnpm-cache - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT - - - uses: actions/cache@v3 - name: Setup pnpm cache - with: - path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- + - name: Setup pnpm cache + uses: ./.github/actions/setup-pnpm-cache - name: Install dependencies run: pnpm install @@ -49,7 +25,13 @@ jobs: runs-on: ubuntu-latest steps: - - run: pnpm lint + - name: Checkout + uses: actions/checkout@v3 + - name: Setup pnpm cache + uses: ./.github/actions/setup-pnpm-cache + + - name: Run lint check + run: pnpm lint working-directory: website format_website: @@ -58,7 +40,13 @@ jobs: runs-on: ubuntu-latest steps: - - run: pnpm format.check + - name: Checkout + uses: actions/checkout@v3 + - name: Setup pnpm cache + uses: ./.github/actions/setup-pnpm-cache + + - name: Run format check + run: pnpm format.check working-directory: website lint_library: @@ -67,6 +55,15 @@ jobs: runs-on: ubuntu-latest steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup pnpm cache + uses: ./.github/actions/setup-pnpm-cache + + - name: Run lint check + run: pnpm lint + working-directory: library + - run: pnpm lint working-directory: library @@ -76,5 +73,11 @@ jobs: runs-on: ubuntu-latest steps: - - run: pnpm test + - name: Checkout + uses: actions/checkout@v3 + - name: Setup pnpm cache + uses: ./.github/actions/setup-pnpm-cache + + - name: Run Vitest + run: pnpm test working-directory: library From 013ca408adc00bbf4367b5c04c3f6af47e4787a7 Mon Sep 17 00:00:00 2001 From: kazizi55 <kaz.redhot1201@gmail.com> Date: Fri, 13 Oct 2023 08:54:59 +0900 Subject: [PATCH 4/8] ci: add format library --- .github/workflows/node.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml index 69cae611b..168fdf62a 100644 --- a/.github/workflows/node.yml +++ b/.github/workflows/node.yml @@ -64,7 +64,19 @@ jobs: run: pnpm lint working-directory: library - - run: pnpm lint + format_library: + name: Run formatter in library + needs: install + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup pnpm cache + uses: ./.github/actions/setup-pnpm-cache + + - name: Run format check + run: pnpm format.check working-directory: library test_library: From fe6f7fc5ffadfdd39d5c0928d2434b0ad0f97118 Mon Sep 17 00:00:00 2001 From: kazizi55 <kaz.redhot1201@gmail.com> Date: Fri, 13 Oct 2023 09:14:40 +0900 Subject: [PATCH 5/8] ci: add pnpm cache to setup node --- .github/actions/setup-pnpm-cache/action.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/actions/setup-pnpm-cache/action.yml b/.github/actions/setup-pnpm-cache/action.yml index a62c0e9a7..112b6805e 100644 --- a/.github/actions/setup-pnpm-cache/action.yml +++ b/.github/actions/setup-pnpm-cache/action.yml @@ -4,11 +4,6 @@ description: "Setups pnpm cache by installing Node.js and pnpm, and getting the runs: using: "composite" steps: - - name: Install Node.js - uses: actions/setup-node@v3 - with: - node-version: 16 - - uses: pnpm/action-setup@v2 name: Install pnpm id: pnpm-install @@ -16,6 +11,12 @@ runs: version: 8 run_install: false + - name: Install Node.js + uses: actions/setup-node@v3 + with: + node-version: 16 + cache: "pnpm" + - name: Get pnpm store directory id: pnpm-cache shell: bash From b7ec31d52563750b39f60c8f5adad28a5967bddf Mon Sep 17 00:00:00 2001 From: kazizi55 <kaz.redhot1201@gmail.com> Date: Fri, 13 Oct 2023 09:17:25 +0900 Subject: [PATCH 6/8] ci: change compiste action to pnpm install --- .../action.yml | 5 +++- .github/workflows/node.yml | 27 +++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) rename .github/actions/{setup-pnpm-cache => pnpm-install-with-cache}/action.yml (91%) diff --git a/.github/actions/setup-pnpm-cache/action.yml b/.github/actions/pnpm-install-with-cache/action.yml similarity index 91% rename from .github/actions/setup-pnpm-cache/action.yml rename to .github/actions/pnpm-install-with-cache/action.yml index 112b6805e..cf7bb180e 100644 --- a/.github/actions/setup-pnpm-cache/action.yml +++ b/.github/actions/pnpm-install-with-cache/action.yml @@ -15,7 +15,6 @@ runs: uses: actions/setup-node@v3 with: node-version: 16 - cache: "pnpm" - name: Get pnpm store directory id: pnpm-cache @@ -30,3 +29,7 @@ runs: key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + shell: "bash" + run: pnpm install diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml index 168fdf62a..607fd81a9 100644 --- a/.github/workflows/node.yml +++ b/.github/workflows/node.yml @@ -13,11 +13,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - - name: Setup pnpm cache - uses: ./.github/actions/setup-pnpm-cache - - - name: Install dependencies - run: pnpm install + - name: PNPM Install With Cache + uses: ./.github/actions/pnpm-install-with-cache lint_website: name: Run linter in website @@ -27,8 +24,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - - name: Setup pnpm cache - uses: ./.github/actions/setup-pnpm-cache + - name: PNPM Install With Cache + uses: ./.github/actions/pnpm-install-with-cache - name: Run lint check run: pnpm lint @@ -42,8 +39,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - - name: Setup pnpm cache - uses: ./.github/actions/setup-pnpm-cache + - name: PNPM Install With Cache + uses: ./.github/actions/pnpm-install-with-cache - name: Run format check run: pnpm format.check @@ -57,8 +54,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - - name: Setup pnpm cache - uses: ./.github/actions/setup-pnpm-cache + - name: PNPM Install With Cache + uses: ./.github/actions/pnpm-install-with-cache - name: Run lint check run: pnpm lint @@ -72,8 +69,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - - name: Setup pnpm cache - uses: ./.github/actions/setup-pnpm-cache + - name: PNPM Install With Cache + uses: ./.github/actions/pnpm-install-with-cache - name: Run format check run: pnpm format.check @@ -87,8 +84,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - - name: Setup pnpm cache - uses: ./.github/actions/setup-pnpm-cache + - name: PNPM Install With Cache + uses: ./.github/actions/pnpm-install-with-cache - name: Run Vitest run: pnpm test From cafe9b99dc1b9d3e76047017be221c871c6c7756 Mon Sep 17 00:00:00 2001 From: Fabian Hiller <hillerfabian11@gmail.com> Date: Sun, 15 Oct 2023 23:34:43 -0400 Subject: [PATCH 7/8] Rename labels of new GitHub CI --- .../action.yml | 29 ++++++------ .github/workflows/{node.yml => ci.yml} | 46 +++++++++---------- 2 files changed, 37 insertions(+), 38 deletions(-) rename .github/actions/{pnpm-install-with-cache => pnpm}/action.yml (58%) rename .github/workflows/{node.yml => ci.yml} (56%) diff --git a/.github/actions/pnpm-install-with-cache/action.yml b/.github/actions/pnpm/action.yml similarity index 58% rename from .github/actions/pnpm-install-with-cache/action.yml rename to .github/actions/pnpm/action.yml index cf7bb180e..3aeb6d3d0 100644 --- a/.github/actions/pnpm-install-with-cache/action.yml +++ b/.github/actions/pnpm/action.yml @@ -1,35 +1,34 @@ -name: "Setup pnpm cache" -description: "Setups pnpm cache by installing Node.js and pnpm, and getting the pnpm store directory." +name: Setup pnpm with cache runs: - using: "composite" + using: 'composite' steps: - - uses: pnpm/action-setup@v2 - name: Install pnpm + - name: Install Node.js + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: Install pnpm + uses: pnpm/action-setup@v2 id: pnpm-install with: version: 8 run_install: false - - name: Install Node.js - uses: actions/setup-node@v3 - with: - node-version: 16 - - - name: Get pnpm store directory + - name: Get store directory id: pnpm-cache shell: bash run: | echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 - name: Setup pnpm cache + - name: Setup pnpm cache + uses: actions/cache@v3 with: path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}-pnpm-store- - - name: Install dependencies - shell: "bash" + - name: Install packages + shell: 'bash' run: pnpm install diff --git a/.github/workflows/node.yml b/.github/workflows/ci.yml similarity index 56% rename from .github/workflows/node.yml rename to .github/workflows/ci.yml index 607fd81a9..d8f756f82 100644 --- a/.github/workflows/node.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: Node.js CI +name: CI on: push: @@ -7,72 +7,72 @@ on: jobs: install: - name: Checkout and Install + name: Install packages runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - - name: PNPM Install With Cache - uses: ./.github/actions/pnpm-install-with-cache + - name: Setup pnpm + uses: ./.github/actions/pnpm lint_website: - name: Run linter in website + name: Run ESLint in website needs: install runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - - name: PNPM Install With Cache - uses: ./.github/actions/pnpm-install-with-cache + - name: Setup pnpm + uses: ./.github/actions/pnpm - - name: Run lint check + - name: ESLint check run: pnpm lint working-directory: website format_website: - name: Run formatter in website + name: Run Prettier in website needs: install runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - - name: PNPM Install With Cache - uses: ./.github/actions/pnpm-install-with-cache + - name: Setup pnpm + uses: ./.github/actions/pnpm - - name: Run format check + - name: Prettier check run: pnpm format.check working-directory: website lint_library: - name: Run linter in library + name: Run ESLint in library needs: install runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - - name: PNPM Install With Cache - uses: ./.github/actions/pnpm-install-with-cache + - name: Setup pnpm + uses: ./.github/actions/pnpm - - name: Run lint check + - name: ESLint check run: pnpm lint working-directory: library format_library: - name: Run formatter in library + name: Run Prettier in library needs: install runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - - name: PNPM Install With Cache - uses: ./.github/actions/pnpm-install-with-cache + - name: Setup pnpm + uses: ./.github/actions/pnpm - - name: Run format check + - name: Prettier check run: pnpm format.check working-directory: library @@ -84,9 +84,9 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - - name: PNPM Install With Cache - uses: ./.github/actions/pnpm-install-with-cache + - name: Setup pnpm + uses: ./.github/actions/pnpm - - name: Run Vitest + - name: Vitest tests run: pnpm test working-directory: library From 66be71dd3489492d25b8b1842caf956dba34e38c Mon Sep 17 00:00:00 2001 From: Fabian Hiller <hillerfabian11@gmail.com> Date: Sun, 15 Oct 2023 23:51:46 -0400 Subject: [PATCH 8/8] Reorder CI jobs and improve pnpm setup --- .github/actions/pnpm/action.yml | 6 ++-- .github/workflows/ci.yml | 55 +++++++++++++-------------------- 2 files changed, 25 insertions(+), 36 deletions(-) diff --git a/.github/actions/pnpm/action.yml b/.github/actions/pnpm/action.yml index 3aeb6d3d0..d04c09d3b 100644 --- a/.github/actions/pnpm/action.yml +++ b/.github/actions/pnpm/action.yml @@ -19,16 +19,16 @@ runs: id: pnpm-cache shell: bash run: | - echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - name: Setup pnpm cache uses: actions/cache@v3 with: - path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} + path: ${{ env.STORE_PATH }} key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}-pnpm-store- - name: Install packages - shell: 'bash' + shell: bash run: pnpm install diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d8f756f82..2c5baf9f4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,84 +9,73 @@ jobs: install: name: Install packages runs-on: ubuntu-latest - steps: - name: Checkout uses: actions/checkout@v3 - name: Setup pnpm uses: ./.github/actions/pnpm - lint_website: - name: Run ESLint in website + library_prettier: + name: Run Prettier in library needs: install runs-on: ubuntu-latest - steps: - name: Checkout uses: actions/checkout@v3 - name: Setup pnpm uses: ./.github/actions/pnpm + - name: Prettier check + run: pnpm format.check + working-directory: library - - name: ESLint check - run: pnpm lint - working-directory: website - - format_website: - name: Run Prettier in website + library_eslint: + name: Run ESLint in library needs: install runs-on: ubuntu-latest - steps: - name: Checkout uses: actions/checkout@v3 - name: Setup pnpm uses: ./.github/actions/pnpm + - name: ESLint check + run: pnpm lint + working-directory: library - - name: Prettier check - run: pnpm format.check - working-directory: website - - lint_library: - name: Run ESLint in library + library_vitest: + name: Run Vitest in library needs: install runs-on: ubuntu-latest - steps: - name: Checkout uses: actions/checkout@v3 - name: Setup pnpm uses: ./.github/actions/pnpm - - - name: ESLint check - run: pnpm lint + - name: Vitest tests + run: pnpm test working-directory: library - format_library: - name: Run Prettier in library + website_prettier: + name: Run Prettier in website needs: install runs-on: ubuntu-latest - steps: - name: Checkout uses: actions/checkout@v3 - name: Setup pnpm uses: ./.github/actions/pnpm - - name: Prettier check run: pnpm format.check - working-directory: library + working-directory: website - test_library: - name: Run Vitest in library + website_eslint: + name: Run ESLint in website needs: install runs-on: ubuntu-latest - steps: - name: Checkout uses: actions/checkout@v3 - name: Setup pnpm uses: ./.github/actions/pnpm - - - name: Vitest tests - run: pnpm test - working-directory: library + - name: ESLint check + run: pnpm lint + working-directory: website