fix(action): detect existing Node ≥18 before calling setup-node #3
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test Action | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| jobs: | |
| test-latest: | |
| name: Install latest | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run setup-devhelm | |
| id: setup | |
| uses: ./ | |
| with: | |
| devhelm-version: latest | |
| - name: Verify devhelm is on PATH | |
| run: which devhelm | |
| - name: Verify version output | |
| run: | | |
| VERSION="${{ steps.setup.outputs.devhelm-version }}" | |
| echo "Reported version: $VERSION" | |
| [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]] || { echo "::error::Invalid version format: $VERSION"; exit 1; } | |
| - name: Verify CLI runs | |
| run: devhelm --help | |
| - name: Verify validate works without API | |
| run: | | |
| devhelm init --force | |
| devhelm validate devhelm.yml | |
| test-pinned: | |
| name: Install pinned version | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run setup-devhelm | |
| id: setup | |
| uses: ./ | |
| with: | |
| devhelm-version: '0.1.4' | |
| - name: Verify exact version | |
| run: | | |
| EXPECTED="0.1.4" | |
| ACTUAL="${{ steps.setup.outputs.devhelm-version }}" | |
| echo "Expected: $EXPECTED, Got: $ACTUAL" | |
| [[ "$ACTUAL" == "$EXPECTED" ]] || { echo "::error::Version mismatch: expected $EXPECTED, got $ACTUAL"; exit 1; } | |
| test-env-export: | |
| name: Environment variables | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run setup-devhelm with env inputs | |
| uses: ./ | |
| with: | |
| api-token: test-token-value | |
| api-url: https://api.staging.devhelm.io | |
| org-id: '42' | |
| workspace-id: '7' | |
| - name: Verify DEVHELM_API_TOKEN | |
| run: | | |
| [[ "$DEVHELM_API_TOKEN" == "test-token-value" ]] || { echo "::error::DEVHELM_API_TOKEN not set"; exit 1; } | |
| - name: Verify DEVHELM_API_URL | |
| run: | | |
| [[ "$DEVHELM_API_URL" == "https://api.staging.devhelm.io" ]] || { echo "::error::DEVHELM_API_URL not set"; exit 1; } | |
| - name: Verify DEVHELM_ORG_ID | |
| run: | | |
| [[ "$DEVHELM_ORG_ID" == "42" ]] || { echo "::error::DEVHELM_ORG_ID not set"; exit 1; } | |
| - name: Verify DEVHELM_WORKSPACE_ID | |
| run: | | |
| [[ "$DEVHELM_WORKSPACE_ID" == "7" ]] || { echo "::error::DEVHELM_WORKSPACE_ID not set"; exit 1; } | |
| test-no-env-when-empty: | |
| name: No env vars when inputs are empty | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run setup-devhelm without auth inputs | |
| uses: ./ | |
| - name: Verify no DEVHELM_API_TOKEN | |
| run: | | |
| [[ -z "$DEVHELM_API_TOKEN" ]] || { echo "::error::DEVHELM_API_TOKEN should not be set"; exit 1; } | |
| - name: Verify no DEVHELM_ORG_ID | |
| run: | | |
| [[ -z "$DEVHELM_ORG_ID" ]] || { echo "::error::DEVHELM_ORG_ID should not be set"; exit 1; } | |
| test-skip-node-setup: | |
| name: Skip built-in Node setup | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Run setup-devhelm without auto Node | |
| id: setup | |
| uses: ./ | |
| with: | |
| node-version: '' | |
| - name: Verify Node version unchanged | |
| run: | | |
| NODE_V=$(node -v) | |
| echo "Node version: $NODE_V" | |
| [[ "$NODE_V" == v22.* ]] || { echo "::error::Expected Node 22.x, got $NODE_V"; exit 1; } | |
| - name: Verify devhelm works | |
| run: devhelm --help | |
| test-macos: | |
| name: Install on macOS | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run setup-devhelm | |
| id: setup | |
| uses: ./ | |
| - name: Verify CLI runs | |
| run: devhelm --help | |
| test-cache: | |
| name: Cache behavior | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run setup-devhelm | |
| id: setup | |
| uses: ./ | |
| - name: Report cache status | |
| run: echo "Cache hit = ${{ steps.setup.outputs.cache-hit }}" |