From fcbe287b2b75caf1dde1af615887c19d1ff29252 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Costa?= Date: Sun, 28 Jan 2024 13:47:49 -0800 Subject: [PATCH] Move node.js & pnpm setup into a separate action --- .github/setup/action.yaml | 12 ++++++++ .github/workflows/ci.yaml | 62 ++++++++------------------------------- 2 files changed, 24 insertions(+), 50 deletions(-) create mode 100644 .github/setup/action.yaml diff --git a/.github/setup/action.yaml b/.github/setup/action.yaml new file mode 100644 index 0000000..ba90cfc --- /dev/null +++ b/.github/setup/action.yaml @@ -0,0 +1,12 @@ +name: Setup requirements +runs: + using: 'composite' + steps: + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + - name: Install Node.js + uses: actions/setup-node@v3 + with: + node-version: 20 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f713170..f65da94 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -3,24 +3,16 @@ name: ci on: pull_request: push: - branches: - - monorepo jobs: build: name: Build runs-on: ubuntu-latest steps: + - name: Setup requirements + uses: ../setup - name: Checkout source code uses: actions/checkout@v4 - - name: Install pnpm - uses: pnpm/action-setup@v2 - with: - version: 8 - - name: Install Node.js - uses: actions/setup-node@v3 - with: - node-version: 20 - name: Install dependencies run: pnpm install - name: Lint library @@ -53,14 +45,8 @@ jobs: name: Test bundling with Vite runs-on: ubuntu-latest steps: - - name: Install pnpm - uses: pnpm/action-setup@v2 - with: - version: 8 - - name: Install Node.js - uses: actions/setup-node@v3 - with: - node-version: 20 + - name: Setup requirements + uses: ../setup - name: Create a Vite project run: pnpm create vite sample --template vanilla-ts - name: Download package @@ -88,14 +74,8 @@ jobs: name: Test bundling with Webpack runs-on: ubuntu-latest steps: - - name: Install pnpm - uses: pnpm/action-setup@v2 - with: - version: 8 - - name: Install Node.js - uses: actions/setup-node@v3 - with: - node-version: 20 + - name: Setup requirements + uses: ../setup - name: Create a Next.js project run: pnpm create next-app sample --ts --eslint --tailwind --src-dir --app --import-alias="@/*" - name: Download package @@ -125,14 +105,8 @@ jobs: name: Test bundling with Turbopack runs-on: ubuntu-latest steps: - - name: Install pnpm - uses: pnpm/action-setup@v2 - with: - version: 8 - - name: Install Node.js - uses: actions/setup-node@v3 - with: - node-version: 20 + - name: Setup requirements + uses: ../setup - name: Create a Next.js project run: pnpm create next-app sample --ts --eslint --tailwind --src-dir --app --import-alias="@/*" - name: Download package @@ -190,16 +164,10 @@ jobs: needs.check_for_version_upgrade.outputs.is_pre_release == 'true' ) steps: + - name: Setup requirements + uses: ../setup - name: Checkout source code uses: actions/checkout@v4 - - name: Install pnpm - uses: pnpm/action-setup@v2 - with: - version: 8 - - name: Install Node.js - uses: actions/setup-node@v3 - with: - node-version: 20 - name: Skip GitHub actions run: rm -r .github - name: Remove deno-dist branch if it exists @@ -246,16 +214,10 @@ jobs: needs.check_for_version_upgrade.outputs.is_pre_release == 'true' ) steps: + - name: Setup requirements + uses: ../setup - name: Checkout source code uses: actions/checkout@v4 - - name: Install pnpm - uses: pnpm/action-setup@v2 - with: - version: 8 - - name: Install Node.js - uses: actions/setup-node@v3 - with: - node-version: 20 - name: Install dependencies run: pnpm install - name: Build library