Merge pull request #46 from privilegedescalation/feat/pnpm-support-in-ci
ci: add pnpm auto-detection to shared plugin CI workflow
This commit is contained in:
@@ -18,29 +18,74 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: Detect package manager
|
||||||
|
id: pkg-manager
|
||||||
|
run: |
|
||||||
|
if [ -f "pnpm-lock.yaml" ]; then
|
||||||
|
echo "manager=pnpm" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "manager=npm" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Setup pnpm
|
||||||
|
if: steps.pkg-manager.outputs.manager == 'pnpm'
|
||||||
|
uses: pnpm/action-setup@v4
|
||||||
|
with:
|
||||||
|
run_install: false
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: ${{ inputs.node-version }}
|
node-version: ${{ inputs.node-version }}
|
||||||
cache: 'npm'
|
cache: ${{ steps.pkg-manager.outputs.manager }}
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: |
|
||||||
|
if [ "${{ steps.pkg-manager.outputs.manager }}" = "pnpm" ]; then
|
||||||
|
pnpm install --frozen-lockfile
|
||||||
|
else
|
||||||
|
npm ci
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Build plugin
|
- name: Build plugin
|
||||||
run: npx @kinvolk/headlamp-plugin build
|
run: npx @kinvolk/headlamp-plugin build
|
||||||
|
|
||||||
- name: Lint
|
- name: Lint
|
||||||
run: npm run lint
|
run: |
|
||||||
|
if [ "${{ steps.pkg-manager.outputs.manager }}" = "pnpm" ]; then
|
||||||
|
pnpm run lint
|
||||||
|
else
|
||||||
|
npm run lint
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Type-check
|
- name: Type-check
|
||||||
run: npm run tsc
|
run: |
|
||||||
|
if [ "${{ steps.pkg-manager.outputs.manager }}" = "pnpm" ]; then
|
||||||
|
pnpm run tsc
|
||||||
|
else
|
||||||
|
npm run tsc
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Format check
|
- name: Format check
|
||||||
run: npm run format:check
|
run: |
|
||||||
|
if [ "${{ steps.pkg-manager.outputs.manager }}" = "pnpm" ]; then
|
||||||
|
pnpm run format:check
|
||||||
|
else
|
||||||
|
npm run format:check
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: npm test
|
run: |
|
||||||
|
if [ "${{ steps.pkg-manager.outputs.manager }}" = "pnpm" ]; then
|
||||||
|
pnpm test
|
||||||
|
else
|
||||||
|
npm test
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Security audit
|
- name: Security audit
|
||||||
run: npm audit --omit=dev
|
run: |
|
||||||
|
if [ "${{ steps.pkg-manager.outputs.manager }}" = "pnpm" ]; then
|
||||||
|
pnpm audit --prod
|
||||||
|
else
|
||||||
|
npm audit --omit=dev
|
||||||
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user