Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support cache computation on windows #157

Merged
merged 5 commits into from
Sep 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion .circleci/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ executors:
machine:
machine:
image: ubuntu-2004:202111-01

windows:
machine:
image: windows-server-2022-gui:current
shell: bash.exe
resource_class: windows.medium
jobs:
# Install Node.js into a non-node container.
integration-test-install-specified-version:
Expand Down Expand Up @@ -110,6 +114,21 @@ jobs:
cache-version: override-v3
app-dir: "~/project/sample"
- run: cd ~/project/sample && npm run test
integration-test-override-ci-windows:
executor: windows
steps:
- checkout
- run:
name: Install Node.js
command: |
nvm install lts
nvm use lts
- node/install-packages:
override-ci-command: npm install
cache-path: ~/project/node_modules
cache-version: override-v3
app-dir: "~/project/sample"
- run: cd ~/project/sample && npm run test
integration-test-yarn:
executor:
name: node/default
Expand Down Expand Up @@ -287,6 +306,10 @@ workflows:
filters:
tags:
only: /.*/
- integration-test-override-ci-windows:
filters:
tags:
only: /.*/
- integration-test-yarn:
filters:
tags:
Expand Down
14 changes: 10 additions & 4 deletions src/scripts/packages/determine-lockfile.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
TARGET_DIR="/tmp"
if [ -n "$HOMEDRIVE" ]; then
TARGET_DIR="$HOMEDRIVE\\tmp"
fi

# Link corresponding lock file to a temporary file used by cache commands
if [ -f "package-lock.json" ]; then
echo "Found package-lock.json file, assuming lockfile"
cp package-lock.json /tmp/node-project-lockfile
cp package-lock.json $TARGET_DIR/node-project-lockfile
elif [ -f "npm-shrinkwrap.json" ]; then
echo "Found npm-shrinkwrap.json file, assuming lockfile"
cp npm-shrinkwrap.json /tmp/node-project-lockfile
cp npm-shrinkwrap.json $TARGET_DIR/node-project-lockfile
elif [ -f "yarn.lock" ]; then
echo "Found yarn.lock file, assuming lockfile"
cp yarn.lock /tmp/node-project-lockfile
cp yarn.lock $TARGET_DIR/node-project-lockfile
fi
cp package.json /tmp/node-project-package.json

cp package.json $TARGET_DIR/node-project-package.json