Update GitHub Actions workflow to use pnpm v4.1.0 and improve error handling in test scripts

- Upgraded pnpm action version in the CI workflow.
- Enhanced error messages for missing test and typecheck scripts in adapter-appwrite and examples.
- Cleaned up conditional checks for better readability.
This commit is contained in:
Luke Hagar
2025-07-13 10:30:21 -05:00
parent 26b1f98523
commit fef066e29e
2 changed files with 70 additions and 70 deletions

View File

@@ -19,17 +19,17 @@ jobs:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4.1.0
with:
version: 8
- name: Setup Node.js ${{ matrix.node-version }} - name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
cache: 'pnpm' cache: 'pnpm'
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Install dependencies - name: Install dependencies
run: pnpm install --frozen-lockfile run: pnpm install --frozen-lockfile
@@ -39,22 +39,22 @@ jobs:
pnpm test pnpm test
- name: Run adapter-appwrite tests (if exists) - name: Run adapter-appwrite tests (if exists)
run: | run: |
if [ -f "packages/adapter-appwrite/package.json" ]; then if [ -f "packages/adapter-appwrite/package.json" ]; then
cd packages/adapter-appwrite cd packages/adapter-appwrite
if grep -q '"test"' package.json; then if grep -q '"test"' package.json; then
pnpm test pnpm test
else
echo "No tests found for adapter-appwrite"
fi
else else
echo "No tests found for adapter-appwrite" echo "adapter-appwrite package not found"
fi fi
else
echo "adapter-appwrite package not found" - name: Generate test coverage
fi run: |
cd packages/adapter-electron
- name: Generate test coverage pnpm run test:coverage
run: |
cd packages/adapter-electron
pnpm run test:coverage
- name: Upload coverage to Codecov - name: Upload coverage to Codecov
uses: codecov/codecov-action@v3 uses: codecov/codecov-action@v3
@@ -72,17 +72,17 @@ jobs:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4.1.0
with:
version: 8
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 20
cache: 'pnpm' cache: 'pnpm'
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Install dependencies - name: Install dependencies
run: pnpm install --frozen-lockfile run: pnpm install --frozen-lockfile
@@ -92,39 +92,39 @@ jobs:
pnpm run typecheck pnpm run typecheck
- name: Type check adapter-appwrite - name: Type check adapter-appwrite
run: | run: |
if [ -f "packages/adapter-appwrite/package.json" ]; then if [ -f "packages/adapter-appwrite/package.json" ]; then
cd packages/adapter-appwrite cd packages/adapter-appwrite
if grep -q '"typecheck"' package.json; then if grep -q '"typecheck"' package.json; then
pnpm run typecheck pnpm run typecheck
else
echo "No typecheck script found for adapter-appwrite"
fi
else else
echo "No typecheck script found for adapter-appwrite" echo "adapter-appwrite package not found"
fi fi
else
echo "adapter-appwrite package not found"
fi
- name: Type check examples - name: Type check examples
run: | run: |
# Type check electron example # Type check electron example
if [ -f "examples/electron/package.json" ]; then if [ -f "examples/electron/package.json" ]; then
cd examples/electron cd examples/electron
if grep -q '"check"' package.json; then if grep -q '"check"' package.json; then
pnpm run check pnpm run check
else else
echo "No check script found for electron example" echo "No check script found for electron example"
fi
fi fi
fi
# Type check appwrite example
# Type check appwrite example if [ -f "examples/appwrite/package.json" ]; then
if [ -f "examples/appwrite/package.json" ]; then cd examples/appwrite
cd examples/appwrite if grep -q '"check"' package.json; then
if grep -q '"check"' package.json; then pnpm run check
pnpm run check else
else echo "No check script found for appwrite example"
echo "No check script found for appwrite example" fi
fi fi
fi
build-test: build-test:
name: Build Test name: Build Test
@@ -134,17 +134,17 @@ jobs:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4.1.0
with:
version: 8
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 20
cache: 'pnpm' cache: 'pnpm'
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Install dependencies - name: Install dependencies
run: pnpm install --frozen-lockfile run: pnpm install --frozen-lockfile
@@ -165,14 +165,14 @@ jobs:
test -f "out/preload/index.js" || (echo "❌ Missing preload/index.js" && exit 1) test -f "out/preload/index.js" || (echo "❌ Missing preload/index.js" && exit 1)
echo "✅ All required build files exist" echo "✅ All required build files exist"
- name: Build appwrite example - name: Build appwrite example
run: | run: |
if [ -f "examples/appwrite/package.json" ]; then if [ -f "examples/appwrite/package.json" ]; then
cd examples/appwrite cd examples/appwrite
pnpm run build pnpm run build
else else
echo "appwrite example not found" echo "appwrite example not found"
fi fi
lint: lint:
name: Lint Code name: Lint Code
@@ -182,17 +182,17 @@ jobs:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4.1.0
with:
version: 8
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 20
cache: 'pnpm' cache: 'pnpm'
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Install dependencies - name: Install dependencies
run: pnpm install --frozen-lockfile run: pnpm install --frozen-lockfile

View File

@@ -28,7 +28,7 @@ ${error.message}
Stack trace: Stack trace:
${error.stack} ${error.stack}
Please report this issue at: https://github.com/your-repo/sveltekit-adapters/issues`; Please report this issue at: https://github.com/lukehagar/sveltekit-adapters/issues`;
console.error(errorMessage); console.error(errorMessage);