diff --git a/.github/actions/setup-node/action.yml b/.github/actions/setup-node/action.yml new file mode 100644 index 00000000..9d6a6c58 --- /dev/null +++ b/.github/actions/setup-node/action.yml @@ -0,0 +1,41 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest + +name: Setup Node and pnpm +description: "Setups node + pnpm" + +inputs: + pnpm-version: + description: "pnpm version to install" + default: "8" + +outputs: + pnpm-version: + description: "The pnpm version that was installed" + value: ${{ inputs.pnpm-version }} + +runs: + using: "composite" + steps: + - uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v2 + with: + version: ${{ inputs.pnpm-version }} + + - name: Read .nvmrc + id: nvmrc + shell: bash + run: echo version=$(cat .nvmrc) >> "$GITHUB_OUTPUT" + + - name: Setup Node.js ${{ steps.nvmrc.outputs.version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ steps.nvmrc.outputs.version }} + cache: 'pnpm' + cache-dependency-path: | + pnpm-lock.yaml + + - name: install dependencies + shell: bash + run: pnpm install diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 08484e63..7602e220 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -13,7 +13,7 @@ jobs: check_license_headers: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Check License Header uses: apache/skywalking-eyes/header@main diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 3063ab6d..17fecc68 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -20,29 +20,10 @@ jobs: env: SUBDIR: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || 'main' }} steps: - - uses: actions/checkout@v3 - - name: Use Node.js - uses: actions/setup-node@v3 + - name: Setup node + uses: ./.github/actions/setup-node with: - node-version: '18.x' - - uses: pnpm/action-setup@v2 - name: Install pnpm - with: - version: 8 - run_install: false - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - uses: actions/cache@v3 - name: Setup pnpm cache - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- - - name: Install dependencies - run: pnpm install + pnpm-version: 9 - name: Build run: pnpm build:pages - uses: ahmadnassri/action-workflow-queue@v1 # we have to ensure that no other deployment is running diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index f86412ce..f10fa8f3 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -18,12 +18,10 @@ jobs: matrix: browser: ['electron', 'firefox'] steps: - - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v3 - name: Install pnpm + - name: Setup node + uses: ./.github/actions/setup-node with: - version: 8 - run_install: false + pnpm-version: 9 - name: Run Cypress Tests uses: cypress-io/github-action@v6 with: diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index f92b2cbf..9559d969 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -19,29 +19,10 @@ jobs: package: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Use Node.js - uses: actions/setup-node@v3 + - name: Setup node + uses: ./.github/actions/setup-node with: - node-version: '18.x' - - uses: pnpm/action-setup@v2 - name: Install pnpm - with: - version: 8 - run_install: false - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - uses: actions/cache@v3 - name: Setup pnpm cache - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- - - name: Install dependencies - run: pnpm install + pnpm-version: 9 - name: Build run: pnpm build - name: Tar diff --git a/.github/workflows/shrinkwrap.yml b/.github/workflows/shrinkwrap.yml index 90e9d075..ac125a1e 100644 --- a/.github/workflows/shrinkwrap.yml +++ b/.github/workflows/shrinkwrap.yml @@ -17,10 +17,15 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - - name: Setup Node.js - uses: actions/setup-node@v3 + - name: Read .nvmrc + id: nvmrc + shell: bash + run: echo version=$(cat .nvmrc) >> "$GITHUB_OUTPUT" + + - name: Setup Node.js ${{ steps.nvmrc.outputs.version }} + uses: actions/setup-node@v4 with: - node-version: '20' + node-version: ${{ steps.nvmrc.outputs.version }} - name: Generate npm-shrinkwrap.json run: | diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index ad04a076..3c5134ab 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -19,29 +19,10 @@ jobs: package: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Use Node.js - uses: actions/setup-node@v3 + - name: Setup node + uses: ./.github/actions/setup-node with: - node-version: '18.x' - - uses: pnpm/action-setup@v2 - name: Install pnpm - with: - version: 8 - run_install: false - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - uses: actions/cache@v3 - name: Setup pnpm cache - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- - - name: Install dependencies - run: pnpm install + pnpm-version: 9 - name: Run Vitest run: pnpm test:coverage - name: 'Report Coverage'