update workflow
Signed-off-by: Derek Anderson <dmikey@users.noreply.github.com>
This commit is contained in:
parent
8178721bd0
commit
4166778a33
53
.github/workflows/ci-cd.yml
vendored
53
.github/workflows/ci-cd.yml
vendored
@ -42,8 +42,12 @@ jobs:
|
|||||||
- name: Install SQLite (Windows)
|
- name: Install SQLite (Windows)
|
||||||
if: matrix.os == 'windows-latest'
|
if: matrix.os == 'windows-latest'
|
||||||
run: |
|
run: |
|
||||||
choco install sqlite
|
choco install sqlite --no-progress
|
||||||
refreshenv
|
# Refresh environment and add SQLite to PATH
|
||||||
|
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
|
||||||
|
# Add SQLite to PATH for subsequent steps
|
||||||
|
echo "C:\ProgramData\chocolatey\lib\SQLite\tools" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
||||||
|
shell: powershell
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
@ -56,9 +60,15 @@ jobs:
|
|||||||
# Test CLI help
|
# Test CLI help
|
||||||
node bin/cli.js help
|
node bin/cli.js help
|
||||||
|
|
||||||
# Create test database
|
# Create test database with cross-platform commands
|
||||||
mkdir -p test-ci
|
mkdir -p test-ci
|
||||||
sqlite3 test-ci/test.db "CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT); INSERT INTO users (name) VALUES ('Test User');"
|
|
||||||
|
# Create test database
|
||||||
|
if [ "${{ matrix.os }}" = "windows-latest" ]; then
|
||||||
|
sqlite3.exe test-ci/test.db "CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT); INSERT INTO users (name) VALUES ('Test User');"
|
||||||
|
else
|
||||||
|
sqlite3 test-ci/test.db "CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT); INSERT INTO users (name) VALUES ('Test User');"
|
||||||
|
fi
|
||||||
|
|
||||||
# Test backup creation
|
# Test backup creation
|
||||||
node bin/cli.js create test-ci/test.db --backup-dir test-ci/backups
|
node bin/cli.js create test-ci/test.db --backup-dir test-ci/backups
|
||||||
@ -67,8 +77,10 @@ jobs:
|
|||||||
node bin/cli.js list test-ci/test.db --backup-dir test-ci/backups
|
node bin/cli.js list test-ci/test.db --backup-dir test-ci/backups
|
||||||
|
|
||||||
# Test backup verification
|
# Test backup verification
|
||||||
BACKUP_FILE=$(ls test-ci/backups/*.db | head -1)
|
BACKUP_FILE=$(find test-ci/backups -name "*.db" | head -1)
|
||||||
node bin/cli.js verify "$BACKUP_FILE"
|
if [ -n "$BACKUP_FILE" ]; then
|
||||||
|
node bin/cli.js verify "$BACKUP_FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
rm -rf test-ci
|
rm -rf test-ci
|
||||||
@ -78,10 +90,33 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
# Create sample database for examples
|
# Create sample database for examples
|
||||||
mkdir -p data
|
mkdir -p data
|
||||||
sqlite3 data/app.db "CREATE TABLE sample (id INTEGER PRIMARY KEY, name TEXT); INSERT INTO sample (name) VALUES ('Sample Data');"
|
|
||||||
|
|
||||||
# Run examples (but skip the interactive parts)
|
# Create test database
|
||||||
timeout 30s node examples/basic-usage.js || true
|
if [ "${{ matrix.os }}" = "windows-latest" ]; then
|
||||||
|
sqlite3.exe data/app.db "CREATE TABLE sample (id INTEGER PRIMARY KEY, name TEXT); INSERT INTO sample (name) VALUES ('Sample Data');"
|
||||||
|
else
|
||||||
|
sqlite3 data/app.db "CREATE TABLE sample (id INTEGER PRIMARY KEY, name TEXT); INSERT INTO sample (name) VALUES ('Sample Data');"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run examples with timeout (cross-platform)
|
||||||
|
if [ "${{ matrix.os }}" = "windows-latest" ]; then
|
||||||
|
# Windows approach - run with a simple timeout mechanism
|
||||||
|
node -e "
|
||||||
|
const { spawn } = require('child_process');
|
||||||
|
const child = spawn('node', ['examples/basic-usage.js'], { stdio: 'inherit' });
|
||||||
|
const timeout = setTimeout(() => {
|
||||||
|
console.log('Example timeout reached, terminating...');
|
||||||
|
child.kill();
|
||||||
|
}, 30000);
|
||||||
|
child.on('exit', (code) => {
|
||||||
|
clearTimeout(timeout);
|
||||||
|
console.log('Example finished with code:', code);
|
||||||
|
process.exit(0);
|
||||||
|
});
|
||||||
|
" || true
|
||||||
|
else
|
||||||
|
timeout 30s node examples/basic-usage.js || true
|
||||||
|
fi
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
rm -rf data
|
rm -rf data
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user