|
| 1 | +# |
| 2 | +name: Setup and Test |
| 3 | + |
| 4 | +description: Common setup and test steps for all workflows |
| 5 | + |
| 6 | +runs: |
| 7 | + using: "composite" |
| 8 | + steps: |
| 9 | + |
| 10 | + - name: Initial Debug Show working directory and package.json |
| 11 | + run: | |
| 12 | + pwd && ls -al && cat package.json |
| 13 | + shell: bash |
| 14 | + |
| 15 | + - name: Checkout code |
| 16 | + uses: actions/checkout@v4.2.2 |
| 17 | + |
| 18 | + - name: Post checkout Debug Show working directory and package.json |
| 19 | + run: | |
| 20 | + pwd && ls -al && cat package.json |
| 21 | + shell: bash |
| 22 | + |
| 23 | + # - name: PNPM |
| 24 | + # run: corepack enable && corepack prepare pnpm@latest --activate |
| 25 | + # run: corepack enable && corepack prepare pnpm@latest --activate |
| 26 | + # shell: bash |
| 27 | + |
| 28 | + - name: Setup pnpm |
| 29 | + uses: pnpm/action-setup@v4 |
| 30 | + with: |
| 31 | + version: latest |
| 32 | + |
| 33 | + - name: Debug after pnpm action setup, Show working directory and package.json |
| 34 | + run: | |
| 35 | + pwd && ls -al && cat package.json |
| 36 | + shell: bash |
| 37 | + |
| 38 | + - name: Setup CI, Build and Test Package |
| 39 | + uses: actions/setup-node@v4 |
| 40 | + with: |
| 41 | + node-version: "lts/*" |
| 42 | + cache: "pnpm" |
| 43 | + |
| 44 | + - name: Debug post node, Show working directory and package.json |
| 45 | + run: | |
| 46 | + pwd && ls -al && cat package.json |
| 47 | + shell: bash |
| 48 | + |
| 49 | + - name: Debug pnpm environment |
| 50 | + run: | |
| 51 | + echo "PATH: $PATH" |
| 52 | + echo "NODE VERSION: $(node --version)" |
| 53 | + echo "NPM VERSION: $(npm --version)" |
| 54 | + echo "PNPM VERSION: $(pnpm --version)" |
| 55 | + which pnpm |
| 56 | + env | grep -E 'PNPM|NPM|NODE|PATH' |
| 57 | + shell: bash |
| 58 | + |
| 59 | + # - name: pnpm help |
| 60 | + # run: pnpm help |
| 61 | + # shell: bash |
| 62 | + |
| 63 | + - name: Debug Show working directory and package.json |
| 64 | + run: | |
| 65 | + pwd && ls -al && cat package.json |
| 66 | + shell: bash |
| 67 | + |
| 68 | + - name: Install dependencies |
| 69 | + run: pnpm install --frozen-lockfile --loglevel debug |
| 70 | + shell: bash |
| 71 | + |
| 72 | + - name: Debug post install, Show working directory and package.json |
| 73 | + run: | |
| 74 | + pwd && ls -al && cat package.json |
| 75 | + shell: bash |
| 76 | + |
| 77 | + - name: Run lint |
| 78 | + run: | |
| 79 | + if [ "$RUN_LINT" = "1" ]; then |
| 80 | + pnpm run lint |
| 81 | + else |
| 82 | + echo "Skipping lint. Set RUN_LINT=1 to enable." |
| 83 | + fi |
| 84 | + shell: bash |
| 85 | + - name: Run build |
| 86 | + run: | |
| 87 | + if [ "$RUN_BUILD" = "1" ]; then |
| 88 | + pnpm run build |
| 89 | + else |
| 90 | + echo "Skipping build. Set RUN_BUILD=1 to enable." |
| 91 | + fi |
| 92 | + shell: bash |
| 93 | + - name: Run tests |
| 94 | + run: | |
| 95 | + if [ "$RUN_TEST" = "1" ]; then |
| 96 | + pnpm vitest --coverage --reporter=verbose |
| 97 | + else |
| 98 | + echo "Skipping tests. Set RUN_TEST=1 to enable." |
| 99 | + fi |
| 100 | + env: |
| 101 | + SMOKE: 1 |
| 102 | + DEBUG: 1 |
| 103 | + shell: bash |
0 commit comments