Skip to content

Commit

Permalink
Enable corepack if packageManager is defined (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
fcollonval authored Jun 18, 2024
1 parent b92970e commit e255a87
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .github/actions/base-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ runs:
id: yarn-cache-dir-path
shell: bash
run: |
# Enable corepack if the project defines packageManager
if [ -f package.json ]; then
export HAS_PKG_MANAGER=$(grep -e \"packageManager\"\: package.json)
if [ ! -z "$HAS_PKG_MANAGER" ]; then corepack enable; fi
fi
CACHE_DIR=$(yarn config get cacheFolder)
[[ "$CACHE_DIR" == "undefined" ]] && CACHE_DIR=$(yarn cache dir)
echo "dir=$CACHE_DIR" >> $GITHUB_OUTPUT
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- uses: ./.github/actions/base-setup
- name: Run Linters
run: |
hatch run typing:test
Expand Down Expand Up @@ -162,6 +162,9 @@ jobs:
run: |
mkdir -p ${TEST_FOLDER}/tests/example.spec.ts-snapshots
pushd ${TEST_FOLDER}
# Prevent yarn to look up in the folder hierarchy
touch yarn.lock
yarn init -yp
yarn add -D @playwright/test
cat package.json | jq '. += {"scripts": {"start": "echo starting...", "test:update": "yarn playwright test -u"}}' > new_package.json
Expand Down Expand Up @@ -205,6 +208,9 @@ jobs:
run: |
mkdir -p ${TEST_FOLDER}/tests/example.spec.ts-snapshots
pushd ${TEST_FOLDER}
# Prevent yarn to look up in the folder hierarchy
touch yarn.lock
yarn init -yp
yarn add -D @playwright/test
cat package.json | jq '. += {"scripts": {"test:update": "yarn playwright test -u"}}' > new_package.json
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "@jupyterlab/maintainer-tools",
"version": "0.25.9",
"private": true
"private": true,
"packageManager": "yarn@3.5.0"
}

0 comments on commit e255a87

Please sign in to comment.