Fix workflows to run on all pushes and PRs #1
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: Electron CI | |
| on: | |
| push: | |
| pull_request: | |
| jobs: | |
| build: | |
| name: Build and Test with Electron ${{ matrix.electron-version }} - ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| electron-version: ['30.0.0', '32.0.0', '33.0.0', '39.2.7'] | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| - name: Install system dependencies (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential python3 libgtk-3-dev libnotify-dev libnss3 libxss1 libasound2 | |
| - name: Install system dependencies (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| # Xcode Command Line Tools should be pre-installed | |
| echo "macOS build tools ready" | |
| - name: Install npm dependencies | |
| run: npm install | |
| - name: Install Electron rebuild tools | |
| run: npm install --save-dev @electron/rebuild electron@${{ matrix.electron-version }} | |
| - name: Rebuild for Electron | |
| run: npx @electron/rebuild --version ${{ matrix.electron-version }} | |
| - name: Run tests with Electron | |
| run: | | |
| npm test | |
| - name: Verify Electron build | |
| shell: bash | |
| run: | | |
| if [ -f "build/Release/sqlanywhere.node" ]; then | |
| echo "Native module built successfully for Electron ${{ matrix.electron-version }}" | |
| ls -lh build/Release/sqlanywhere.node | |
| else | |
| echo "Error: Native module not found" | |
| exit 1 | |
| fi | |
| - name: Test module loading with Electron | |
| shell: bash | |
| run: | | |
| npx electron --version | |
| node -e "console.log('Testing module load...'); const db = require('./lib/index'); console.log('Module loaded successfully'); const conn = db.createConnection(); console.log('Connection created:', typeof conn);" |