Skip to content

Commit

Permalink
Add npm install commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Maaaartin committed Jun 30, 2024
1 parent 27958ad commit c132f90
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 31 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Run npm install
run: ./test_versions

- name: Download Artifacts
uses: actions/download-artifact@v2
with:
Expand Down
36 changes: 5 additions & 31 deletions test_versions
Original file line number Diff line number Diff line change
@@ -1,34 +1,8 @@
#!/bin/bash

# Define Node versions
NODE_VERSIONS=(16 17 18 19 20 21)

# Function to install Jest-related dependencies globally
install_jest_deps() {
DEPS=$(jq -r '.dependencies, .devDependencies | to_entries[] | select(.key | test("jest"; "i")) | .key + "@" + .value' package.json)
for DEP in $DEPS
do
echo "Installing $DEP globally..."
npm install -g "$DEP"
done
}

# Loop through Node versions
for VERSION in "${NODE_VERSIONS[@]}"
npm install -g typescript yarn
DEPS=$(jq -r '.dependencies, .devDependencies | to_entries[] | select(.key | test("jest"; "i")) | .key + "@" + .value' package.json)
for DEP in $DEPS
do
echo "Setting up Node $VERSION"
nvm install $VERSION
nvm use $VERSION

# Install Jest-related dependencies globally
echo "Installing Jest-related dependencies for Node $VERSION"
install_jest_deps

# Test the project
echo "Testing the project with Node $VERSION"
npx jest

# Add any additional commands, like running tests, if needed
echo "Installing $DEP globally..."
npm install -g "$DEP"
done

echo "Script completed."

0 comments on commit c132f90

Please sign in to comment.