setup-node-environment-test.yaml

This commit is contained in:
mini2024
2025-04-04 21:25:36 +08:00
parent 4a3df28bbf
commit 2a7a660cc4
2 changed files with 18 additions and 21 deletions

View File

@ -56,15 +56,12 @@ jobs:
strategy:
fail-fast: false
matrix:
checkout:
- true
- false
container:
- 'yanhao98/runner-images:pnpm'
- '' # gitea/runner-images:ubuntu-latest
npmrc_content:
- ''
-
- |
use-node-version=22.14.0 # https://pnpm.io/zh/npmrc#use-node-version
lock_file:
- 'true'
@ -74,13 +71,11 @@ jobs:
- 'test'
container: ${{ matrix.container }}
steps:
- uses: actions/checkout@main
if: matrix.checkout == 'true'
# - uses: actions/checkout@main
- name: 打印 matrix
run: |
echo "🤖---- 打印 matrix ----🤖"
echo "container: ${{ matrix.container }}"
echo "checkout: ${{ matrix.checkout }}"
echo "npmrc_content: ${{ matrix.npmrc_content }}"
echo "lock_file: ${{ matrix.lock_file }}"
echo "cwd: ${{ matrix.cwd }}"
@ -90,18 +85,21 @@ jobs:
if: matrix.cwd != ''
run: |
mkdir -p ${{ matrix.cwd }}
set -x;
ls -l -R .
pwd
- name: Create .npmrc
working-directory: ${{ matrix.cwd }}
if: matrix.npmrc_content != ''
run: |
set -x;
ls -l -R .
cat <<EOF > .npmrc
${{ matrix.npmrc_content }}
EOF
set -x;
ls -l -R .
pwd
cat .npmrc
- name: Create package.json
working-directory: ${{ matrix.cwd }}
@ -112,22 +110,21 @@ jobs:
EOF
set -x;
ls -l -R .
cat package.json
pwd
cat package.json
- name: Create pnpm-lock.yaml
working-directory: ${{ matrix.cwd }}
if: matrix.lock_file == 'true'
run: |
mkdir -p ${{ github.workspace }}/.git
cat <<EOF > pnpm-lock.yaml
${{ needs.generate_lock.outputs.lock_file_content }}
EOF
set -x;
ls -l -R .
pwd
cat pnpm-lock.yaml
- uses: yanhao98/composite-actions/setup-node-environment@main
with:
package_json_cwd: ${{ matrix.cwd }}
# pnpm_standalone: true
working-directory: ${{ matrix.cwd }}