diff --git a/.github/workflows/actions/install-node-modules/action.yml b/.github/workflows/actions/install-node-modules/action.yml index cf87577e..6d01bedc 100644 --- a/.github/workflows/actions/install-node-modules/action.yml +++ b/.github/workflows/actions/install-node-modules/action.yml @@ -7,6 +7,9 @@ inputs: package_locks: description: JS packages.lock list required: true + node_modules: + description: Node modules folders list + required: true runs: using: "composite" @@ -19,17 +22,13 @@ runs: buildCommandJson='[' # Install plus build when the cache is not found installCommandJson='[' - # Build list of node_modules folders - nodeModules='' IFS=$' \t\n' commaSeparator='' - spaceSeparator='' while read -r package_lock; do if test -f "$package_lock"; then js_folder=$(echo $package_lock | sed s_/package-lock\.json__) package_json=$(echo $package_lock | sed s_package-lock\.json_package\.json_) - nodeModules+="$spaceSeparator$js_folder/node_modules" # Only build when the action is in the package.json if grep -q '"build":' "$package_json"; then buildCommandJson+="$commaSeparator\"(pushd $js_folder; npm run build; popd)\"" @@ -38,7 +37,6 @@ runs: installCommandJson+="$commaSeparator\"(pushd $js_folder; npm ci; popd)\"" fi commaSeparator=', ' - spaceSeparator=' ' fi done <<< "${{ inputs.package_locks }}" @@ -47,15 +45,14 @@ runs: echo "build-command=$buildCommandJson" >> $GITHUB_OUTPUT echo "install-command=$installCommandJson" >> $GITHUB_OUTPUT - echo "node-modules=$nodeModules" >> $GITHUB_OUTPUT shell: bash # Try and restore cache if it exists, then build assets only (no npm ci needed) - - name: Restore dependencies + - name: Save dependencies id: save-dependencies uses: actions/cache@v3 with: - path: ${{ steps.action-parameters.outputs.node-modules }} + path: ${{ inputs.node_modules }} key: node-modules-${{ inputs.node_version }}-${{ hashFiles(inputs.package_locks) }} - name: Build assets only (dependencies came from cache) if: steps.save-dependencies.outputs.cache-hit == 'true' diff --git a/.github/workflows/actions/run-tests/action.yml b/.github/workflows/actions/run-tests/action.yml index 72f1471d..e5d9b300 100644 --- a/.github/workflows/actions/run-tests/action.yml +++ b/.github/workflows/actions/run-tests/action.yml @@ -38,6 +38,8 @@ runs: node_version: ${{ inputs.node_version }} package_locks: | ${{ inputs.ps_dir }}/tests/UI/package-lock.json + node_modules: | + ${{ inputs.ps_dir }}/tests/UI/node_modules # Always rebuild, it seems required although the cache should speed that up - run: npm ci working-directory: ${{ inputs.ps_dir }}/tests/UI diff --git a/.github/workflows/build-shop.yml b/.github/workflows/build-shop.yml index bcc50ae8..717f25d5 100644 --- a/.github/workflows/build-shop.yml +++ b/.github/workflows/build-shop.yml @@ -127,6 +127,11 @@ jobs: ${{ env.PS_DIR }}/admin-dev/themes/default/package-lock.json ${{ env.PS_DIR }}/themes/classic/_dev/package-lock.json ${{ env.PS_DIR }}/themes/package-lock.json + node_modules: | + ${{ env.PS_DIR }}/admin-dev/themes/new-theme/node_modules + ${{ env.PS_DIR }}/admin-dev/themes/default/node_modules + ${{ env.PS_DIR }}/themes/classic/_dev/node_modules + ${{ env.PS_DIR }}/themes/node_modules # Create shop with Docker build assets, and initialize database and shop content - name: Build and run shop with docker diff --git a/.github/workflows/test-sanity.yml b/.github/workflows/test-sanity.yml index 67deb452..a885b27d 100644 --- a/.github/workflows/test-sanity.yml +++ b/.github/workflows/test-sanity.yml @@ -129,6 +129,11 @@ jobs: ${{ env.PS_DIR }}/admin-dev/themes/default/package-lock.json ${{ env.PS_DIR }}/themes/classic/_dev/package-lock.json ${{ env.PS_DIR }}/themes/package-lock.json + node_modules: | + ${{ env.PS_DIR }}/admin-dev/themes/new-theme/node_modules + ${{ env.PS_DIR }}/admin-dev/themes/default/node_modules + ${{ env.PS_DIR }}/themes/classic/_dev/node_modules + ${{ env.PS_DIR }}/themes/node_modules # Create shop with Docker build assets, and initialize database and shop content - name: Build and run shop with docker