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: Node.js CI | |
| on: | |
| push: | |
| pull_request: | |
| jobs: | |
| build: | |
| name: Build and Test on Node ${{ matrix.node-version }} - ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| node-version: [18.x, 20.x, 22.x] | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| - name: Install dependencies (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential python3 | |
| - name: Install dependencies (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| # Xcode Command Line Tools should be pre-installed | |
| - name: Install dependencies (Windows) | |
| if: runner.os == 'Windows' | |
| run: | | |
| npm install --global windows-build-tools || echo "Build tools may already be installed" | |
| - name: Install npm dependencies | |
| run: npm install | |
| - name: Run tests | |
| run: npm test | |
| - name: Verify build output | |
| shell: bash | |
| run: | | |
| if [ -f "build/Release/sqlanywhere.node" ]; then | |
| echo "Native module built successfully" | |
| ls -lh build/Release/sqlanywhere.node | |
| else | |
| echo "Warning: Native module not found" | |
| exit 1 | |
| fi |