Skip to content

Commit

Permalink
test: add pnpm workspaces example
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeMcC399 committed Oct 15, 2023
1 parent 645f789 commit 0475245
Show file tree
Hide file tree
Showing 12 changed files with 1,730 additions and 0 deletions.
107 changes: 107 additions & 0 deletions .github/workflows/example-start-and-pnpm-workspaces.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: example-start-and-pnpm-workspaces
on:
push:
branches:
- 'master'
pull_request:
workflow_dispatch:

jobs:

single:
# the example has pnpm workspace in its "root" folder
# examples/start-and-pnpm-workspaces
# and tests in a subfolder like "workspace-1"
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Set up pnpm cache
uses: actions/cache@v3
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('examples/start-and-pnpm-workspaces/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Set up Cypress binary cache
uses: actions/cache@v3
with:
path: ~/.cache/Cypress
key: cypress-${{ runner.os }}-cypress-${{ hashFiles('examples/start-and-pnpm-workspaces/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-cypress-
- run: pnpm install --frozen-lockfile
working-directory: examples/start-and-pnpm-workspaces
- name: Test workspace-1
uses: ./
with:
working-directory: examples/start-and-pnpm-workspaces/workspace-1
install: false
build: pnpm run build
start: pnpm start
wait-on: 'http://localhost:5000'

multiple:
# example with web application build,
# server start and waiting for the server
# to respond before running tests
# in each pnpm workspaces subfolder
runs-on: ubuntu-22.04
strategy:
# when one test fails, DO NOT cancel the other
# containers, because this will kill Cypress processes
# leaving the Cypress Cloud hanging ...
# https://github.com/cypress-io/github-action/issues/48
fail-fast: false
matrix:
cypress:
- working_directory: examples/start-and-pnpm-workspaces/workspace-1
- working_directory: examples/start-and-pnpm-workspaces/workspace-2
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Set up pnpm cache
uses: actions/cache@v3
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('examples/start-and-pnpm-workspaces/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Set up Cypress binary cache
uses: actions/cache@v3
with:
path: ~/.cache/Cypress
key: cypress-${{ runner.os }}-cypress-${{ hashFiles('examples/start-and-pnpm-workspaces/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-cypress-
- run: pnpm install --frozen-lockfile
working-directory: examples/start-and-pnpm-workspaces

- name: Test multiple
uses: ./
with:
working-directory: ${{ matrix.cypress.working_directory }}
install: false
build: pnpm run build
start: pnpm start
wait-on: 'http://localhost:5000'
6 changes: 6 additions & 0 deletions examples/start-and-pnpm-workspaces/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "start-and-pnpm-workspaces",
"version": "1.0.0",
"description": "example using pnpm with workspaces",
"private": true
}
Loading

0 comments on commit 0475245

Please sign in to comment.