Skip to content

Commit

Permalink
chore: switch to pnpm instead of yarn (#8589)
Browse files Browse the repository at this point in the history
Signed-off-by: Florent Benoit <[email protected]>
  • Loading branch information
benoitf authored Aug 29, 2024
1 parent ccbdd9b commit 13577e1
Show file tree
Hide file tree
Showing 41 changed files with 24,139 additions and 21,623 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/add-pnpm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#
# Copyright (C) 2024 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0

name: pnpm-release

on:
workflow_dispatch:
inputs:
tag:
description: 'Tag to build the release from'
required: true

env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:

pnpm-store:
name: pnpm-store-${{ matrix.arch }}
runs-on: ubuntu-24.04
strategy:
matrix:
arch: [amd64, arm64]

steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.tag }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: create the pnpm store from the dependencies
run: |
podman run --platform linux/${{ matrix.arch }} -v $(pwd):/project --rm -it --entrypoint=sh node:20 -c "cd /project && corepack enable pnpm && COREPACK_ENABLE_DOWNLOAD_PROMPT=0 pnpm install --frozen-lockfile --store-dir pnpm-store"
# now the store is in the pnpm-store directory
# create a tarball of the store
echo "Creating the archive store-cache-pnpm-${{ matrix.arch }}.tgz"
tar -czf store-cache-pnpm-${{ matrix.arch }}.tgz pnpm-store
ls -la
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: store-cache-pnpm-${{ matrix.arch }}.tgz
tag: ${{ github.event.inputs.tag }}
36 changes: 15 additions & 21 deletions .github/workflows/argos.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2023 Red Hat, Inc.
# Copyright (C) 2023-2024 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -24,7 +24,7 @@ on:
- main
paths:
- 'package.json'
- 'yarn.lock'
- 'pnpm-lock.yaml'
- 'storybook/**'
- 'website/**'
- 'website-argos/**'
Expand All @@ -34,7 +34,7 @@ on:
paths:
- '.github/workflows/argos.yaml'
- 'package.json'
- 'yarn.lock'
- 'pnpm-lock.yaml'
- 'storybook/**'
- 'website/**'
- 'website-argos/**'
Expand All @@ -45,38 +45,32 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
node-version: 20

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> ${GITHUB_OUTPUT}
run_install: false

- uses: actions/cache@v4
id: yarn-cache
- uses: actions/setup-node@v4
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
node-version: 20
cache: 'pnpm'

- name: Execute yarn
run: yarn --frozen-lockfile
- name: Execute pnpm
run: pnpm install

- name: Run website
run: yarn website:build
run: pnpm website:build

- name: Install Playwright browsers
working-directory: website-argos
run: yarn playwright install --with-deps chromium
run: pnpm playwright install --with-deps chromium

- name: Take screenshots with Playwright
run: yarn website:screenshots
run: pnpm website:screenshots

- name: Upload screenshots to Argos
continue-on-error: true
working-directory: website-argos
run: yarn upload
run: pnpm upload
env:
ARGOS_TOKEN: ${{ secrets.ARGOS_TOKEN }}
29 changes: 13 additions & 16 deletions .github/workflows/e2e-main.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2023 Red Hat, Inc.
# Copyright (C) 2023-2024 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -53,9 +53,18 @@ jobs:
- uses: actions/checkout@v4
if: github.event_name == 'push'

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
run_install: false

- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: Execute pnpm
run: pnpm install

- name: Update podman
run: |
Expand All @@ -73,27 +82,15 @@ jobs:
wget https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_22.04/amd64/conmon_2.1.2~0_amd64.deb -O /tmp/conmon_2.1.2.deb
sudo apt install /tmp/conmon_2.1.2.deb
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> ${GITHUB_OUTPUT}

- uses: actions/cache@v4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Execute yarn
run: yarn --frozen-lockfile
- name: Execute pnpm
run: pnpm install

- name: Run All E2E tests
env:
PODMANDESKTOP_CI_BOT_TOKEN: ${{ secrets.PODMANDESKTOP_CI_BOT_TOKEN }}
TEST_PODMAN_MACHINE: 'true'
SKIP_KIND_INSTALL: 'true'
run: yarn test:e2e
run: pnpm test:e2e

- uses: actions/upload-artifact@v4
if: always()
Expand Down
73 changes: 22 additions & 51 deletions .github/workflows/next-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,50 +86,27 @@ jobs:
- uses: actions/checkout@v4
with:
ref: ${{ needs.tag.outputs.githubTag}}

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
run_install: false

- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Get yarn cache directory path (Windows)
if: ${{ matrix.os=='windows-2022' }}
id: yarn-cache-dir-path-windows
run: echo "dir=$(yarn cache dir)" >> ${env:GITHUB_OUTPUT}

- name: Get yarn cache directory path (mac/Linux)
if: ${{ matrix.os=='ubuntu-24.04' || matrix.os=='macos-14' }}
id: yarn-cache-dir-path-unix
run: echo "dir=$(yarn cache dir)" >> ${GITHUB_OUTPUT}

- uses: actions/cache@v4
if: ${{ matrix.os=='windows-2022' }}
id: yarn-cache-windows
with:
path: ${{ steps.yarn-cache-dir-path-windows.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- uses: actions/cache@v4
if: ${{ matrix.os=='ubuntu-24.04' || matrix.os=='macos-14' }}
id: yarn-cache-unix
with:
path: ${{ steps.yarn-cache-dir-path-unix.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: setup telemetry key for production
run: |
sed -i -r -e "s/SEGMENT_KEY = '.*'/SEGMENT_KEY = '${{ secrets.SEGMENT_WRITE_KEY }}'/" packages/main/src/plugin/telemetry/telemetry.ts
- name: yarn
run: |
yarn --frozen-lockfile --network-timeout 180000
- name: Execute pnpm
run: pnpm install

- name: Install flatpak on Linux
if: ${{ matrix.os=='ubuntu-24.04' }}
Expand Down Expand Up @@ -162,7 +139,7 @@ jobs:
- name: Run Build
timeout-minutes: 40
run: yarn compile:next
run: pnpm compile:next

release:
needs: [tag, build]
Expand All @@ -185,24 +162,18 @@ jobs:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
node-version: 20
run_install: false

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> ${GITHUB_OUTPUT}

- uses: actions/cache@v4
id: yarn-cache
- uses: actions/setup-node@v4
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
node-version: 20
cache: 'pnpm'

- name: Execute yarn
run: yarn --frozen-lockfile --network-timeout 180000
- name: Execute pnpm
run: pnpm install

- name: Set-up npmjs auth token
run: printf "//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}\n" >> ~/.npmrc
Expand All @@ -211,22 +182,22 @@ jobs:
run: |
echo "Using version ${{ needs.tag.outputs.desktopVersion }}"
sed -i "s#version\":\ \"\(.*\)\",#version\":\ \"${{ needs.tag.outputs.desktopVersion }}\",#g" packages/extension-api/package.json
cd packages/extension-api && yarn publish --tag next --no-git-tag-version --new-version "${{ needs.tag.outputs.desktopVersion }}" --access public
cd packages/extension-api && pnpm publish --tag next --no-git-tag-version --new-version "${{ needs.tag.outputs.desktopVersion }}" --access public
- name: Publish Webview API to npmjs
run: |
echo "Using version ${{ needs.tag.outputs.desktopVersion }}"
sed -i "s#version\":\ \"\(.*\)\",#version\":\ \"${{ needs.tag.outputs.desktopVersion }}\",#g" packages/webview-api/package.json
cd packages/webview-api && yarn publish --tag next --no-git-tag-version --new-version "${{ needs.tag.outputs.desktopVersion }}" --access public
cd packages/webview-api && pnpm publish --tag next --no-git-tag-version --new-version "${{ needs.tag.outputs.desktopVersion }}" --access public
- name: Publish ui/svelte to npmjs
run: |
echo "Using version ${{ needs.tag.outputs.desktopVersion }}"
sed -i "s#version\":\ \"\(.*\)\",#version\":\ \"${{ needs.tag.outputs.desktopVersion }}\",#g" packages/ui/package.json
cd packages/ui && yarn build && yarn publish --tag next --no-git-tag-version --new-version "${{ needs.tag.outputs.desktopVersion }}" --access public
cd packages/ui && pnpm build && pnpm publish --tag next --no-git-tag-version --new-version "${{ needs.tag.outputs.desktopVersion }}" --access public
- name: Publish tests-playwright to npmjs
run: |
echo "Using version ${{ needs.tag.outputs.desktopVersion }}"
sed -i "s#version\":\ \"\(.*\)\",#version\":\ \"${{ needs.tag.outputs.desktopVersion }}\",#g" tests/playwright/package.json
cd tests/playwright && yarn build && yarn publish --tag next --no-git-tag-version --new-version "${{ needs.tag.outputs.desktopVersion }}" --access public
cd tests/playwright && pnpm build && pnpm publish --tag next --no-git-tag-version --new-version "${{ needs.tag.outputs.desktopVersion }}" --access public
26 changes: 10 additions & 16 deletions .github/workflows/pr-check-website.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
pull_request:
paths:
- 'package.json'
- 'yarn.lock'
- 'pnpm-lock.yaml'
- 'website/**'
- 'storybook/**'
- 'packages/extension-api/src/**'
Expand All @@ -32,27 +32,21 @@ jobs:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
node-version: 20

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> ${GITHUB_OUTPUT}
run_install: false

- uses: actions/cache@v4
id: yarn-cache
- uses: actions/setup-node@v4
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
node-version: 20
cache: 'pnpm'

- name: Execute yarn
run: yarn --frozen-lockfile
- name: Execute pnpm
run: pnpm install

- name: Run website
run: yarn website:build
run: pnpm website:build

- name: Store pull request details for publish-netlify
run: |
Expand Down
Loading

0 comments on commit 13577e1

Please sign in to comment.