|
| 1 | +name: Electron CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ master, main ] |
| 6 | + pull_request: |
| 7 | + |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + name: Build and Test with Electron ${{ matrix.electron-version }} - ${{ matrix.os }} |
| 11 | + runs-on: ${{ matrix.os }} |
| 12 | + |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 16 | + electron-version: ['39.2.7'] |
| 17 | + include: |
| 18 | + # macOS ARM64 (Apple Silicon) |
| 19 | + - os: macos-latest |
| 20 | + electron-version: '39.2.7' |
| 21 | + # macOS x64 (Intel) |
| 22 | + - os: macos-14 |
| 23 | + electron-version: '39.2.7' |
| 24 | + # Linux x64 |
| 25 | + - os: ubuntu-latest |
| 26 | + electron-version: '39.2.7' |
| 27 | + # Windows x64 |
| 28 | + - os: windows-latest |
| 29 | + electron-version: '39.2.7' |
| 30 | + |
| 31 | + steps: |
| 32 | + - name: Checkout code |
| 33 | + uses: actions/checkout@v4 |
| 34 | + |
| 35 | + - name: Setup Node.js |
| 36 | + uses: actions/setup-node@v4 |
| 37 | + with: |
| 38 | + node-version: '20.x' |
| 39 | + |
| 40 | + - name: Install system dependencies (Linux) |
| 41 | + if: runner.os == 'Linux' |
| 42 | + run: | |
| 43 | + sudo apt-get update |
| 44 | + sudo apt-get install -y build-essential python3 libgtk-3-dev libnotify-dev libnss3 libxss1 libasound2t64 || sudo apt-get install -y libasound2 |
| 45 | +
|
| 46 | + - name: Install system dependencies (macOS) |
| 47 | + if: runner.os == 'macOS' |
| 48 | + run: | |
| 49 | + # Xcode Command Line Tools should be pre-installed |
| 50 | + echo "macOS build tools ready" |
| 51 | +
|
| 52 | + - name: Setup MSVC (Windows) |
| 53 | + if: runner.os == 'Windows' |
| 54 | + uses: ilammy/msvc-dev-cmd@v1 |
| 55 | + |
| 56 | + - name: Install npm dependencies |
| 57 | + run: npm install |
| 58 | + |
| 59 | + - name: Install Electron rebuild tools |
| 60 | + run: npm install --save-dev @electron/rebuild electron@${{ matrix.electron-version }} electron-mocha |
| 61 | + |
| 62 | + - name: Rebuild for Electron |
| 63 | + run: npx @electron/rebuild --version ${{ matrix.electron-version }} |
| 64 | + |
| 65 | + - name: Run tests with Electron |
| 66 | + run: npx electron-mocha --no-sandbox test/**/*.test.js --timeout 10000 |
| 67 | + |
| 68 | + - name: Show build output |
| 69 | + shell: bash |
| 70 | + run: | |
| 71 | + echo "Checking for native module..." |
| 72 | + if [ -f "build/Release/sqlanywhere.node" ]; then |
| 73 | + echo "✓ Native module found" |
| 74 | + ls -lh build/Release/sqlanywhere.node |
| 75 | + file build/Release/sqlanywhere.node || true |
| 76 | + else |
| 77 | + echo "✗ Native module NOT found" |
| 78 | + echo "Build directory contents:" |
| 79 | + ls -la build/ || echo "Build directory does not exist" |
| 80 | + fi |
| 81 | +
|
| 82 | + - name: Test module loading with Electron |
| 83 | + shell: bash |
| 84 | + run: | |
| 85 | + npx electron --no-sandbox --version |
| 86 | + npx electron --no-sandbox test/electron-load-test.js |
0 commit comments