Skip to content

Commit

Permalink
Add new CI check to ensure we can install under JS
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanrainer committed Jun 14, 2024
1 parent 436a677 commit 9eee8cf
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ executors:
environment:
XTASK_TARGET: "x86_64-unknown-linux-gnu"

node_js:
docker:
- image: node:lts
resource_class: medium


tag_matches_prerelease: &tag_matches_prerelease
matches:
pattern: "^.*(beta|alpha|rc|prerelease|draft|test).*$"
Expand Down Expand Up @@ -143,6 +149,11 @@ workflows:
platform: [amd_ubuntu]
rust_channel: [stable]
command: [integration-test]
- install_js:
name: Test installation for Javascript Package Managers (<< matrix.package_manager >>)
matrix:
parameters:
package_manager: [npm, npm_global, pnpm]
release:
jobs:
- xtask:
Expand Down Expand Up @@ -272,6 +283,21 @@ jobs:
- gh_release
- npm_publish

install_js:
parameters:
package_manager:
type: enum
enum: ["npm", "npm_global", "pnpm"]
executor: node_js
steps:
- checkout:
path: "rover"
- run:
name: "Invoke Install Scripts"
command: |
cd rover/.circleci/scripts
./install_<< parameters.package_manager >>.sh
# reusable command snippets can be referred to in any `steps` object
commands:
setup:
Expand Down
16 changes: 16 additions & 0 deletions .circleci/scripts/install_npm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#! /bin/bash
set -euo pipefail

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

mkdir /test
cd /test
echo "Created test directory"
npm init -y
echo "Initialised new npm package"
npm install --install-links=true "$SCRIPT_DIR/../../installers/npm"
echo "Installed rover as local npm package"
cd node_modules/.bin/
echo "Checking version"
./rover --version
echo "Checked version, all ok!"
14 changes: 14 additions & 0 deletions .circleci/scripts/install_npm_global.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#! /bin/bash
set -euo pipefail

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

mkdir /test
cd /test
echo "Created test directory"
npm install --install-links=true -g "$SCRIPT_DIR/../../installers/npm"
echo "Installed rover as global npm package"
cd /usr/local/bin/
echo "Checking version"
./rover --version
echo "Checked version, all ok!"
18 changes: 18 additions & 0 deletions .circleci/scripts/install_pnpm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#! /bin/bash
set -euo pipefail

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )


mkdir /test
cd /test
echo "Created test directory"
npm install -g pnpm@v9.3.0
echo "Installed pnpm"
pnpm init
pnpm add "file:$SCRIPT_DIR/../../installers/npm"
echo "Installed rover as pnpm package"
cd node_modules/.bin/
echo "Checking version"
./rover --version
echo "Checked version, all ok!"

0 comments on commit 9eee8cf

Please sign in to comment.