From 3d3c403ea35198aba3da92a2f5697b4d11d74af1 Mon Sep 17 00:00:00 2001 From: Alec Larson <1925840+aleclarson@users.noreply.github.com> Date: Sat, 7 Sep 2024 16:17:55 -0400 Subject: [PATCH] ci: fix windows --- .github/workflows/ci.yml | 72 +++++++++++++++++++++-------------- binding.gyp | 55 ++++++++++---------------- scripts/build_libpg_query.bat | 12 ++++++ scripts/build_libpg_query.sh | 13 +++++++ 4 files changed, 90 insertions(+), 62 deletions(-) create mode 100644 scripts/build_libpg_query.bat create mode 100755 scripts/build_libpg_query.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 772bf34..e81456f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,51 +15,67 @@ jobs: fail-fast: false matrix: include: - # - os: ubuntu-24.04 - # container: rockylinux:8 - # nodejs_version: 18 - # - os: ubuntu-24.04 - # container: node:18-alpine3.16 - # - os: macos-12 - # nodejs_version: 18 + # - os: ubuntu-latest + # container: rockylinux:9 + # nodejs_version: 20 + # - os: ubuntu-latest + # container: node:20-alpine3.20 + # - os: macos-latest + # nodejs_version: 20 # nodejs_arch: x64 - # - os: macos-14 - # nodejs_version: 18 + # - os: macos-latest + # nodejs_version: 20 # nodejs_arch: arm64 - # - os: windows-2019 - # nodejs_version: 18 + # - os: windows-latest + # nodejs_version: 20 # nodejs_arch: x86 - - os: windows-2019 - nodejs_version: 18 + - os: windows-latest + nodejs_version: 20 nodejs_arch: x64 steps: - uses: pnpm/action-setup@v4 with: version: 9.7.1 - - name: Dependencies (Rocky Linux glibc) - if: contains(matrix.container, 'rockylinux') - run: | - curl -sL https://rpm.nodesource.com/setup_${{ matrix.nodejs_version }}.x | bash - - dnf install -y gcc-toolset-11-gcc-c++ make git python3.12 nodejs - echo "/opt/rh/gcc-toolset-11/root/usr/bin" >> $GITHUB_PATH - echo "PYTHON=/usr/bin/python3.12" >> $GITHUB_ENV + # - name: Dependencies (Rocky Linux glibc) + # if: contains(matrix.container, 'rockylinux') + # run: | + # curl -sL https://rpm.nodesource.com/setup_${{ matrix.nodejs_version }}.x | bash - + # dnf install -y gcc-toolset-11-gcc-c++ make git python3.12 nodejs + # echo "/opt/rh/gcc-toolset-11/root/usr/bin" >> $GITHUB_PATH + # echo "PYTHON=/usr/bin/python3.12" >> $GITHUB_ENV - - name: Dependencies (Linux musl) - if: contains(matrix.container, 'alpine') - run: apk add build-base git python3 --update-cache + # - name: Dependencies (Linux musl) + # if: contains(matrix.container, 'alpine') + # run: apk add build-base git python3 --update-cache - - name: Dependencies (Python - macOS, Windows) - if: contains(matrix.os, 'macos') || contains(matrix.os, 'windows') - uses: actions/setup-python@v5 - with: - python-version: "3.12" + # - name: Dependencies (Python - macOS, Windows) + # if: contains(matrix.os, 'macos') || contains(matrix.os, 'windows') + # uses: actions/setup-python@v5 + # with: + # python-version: "3.12" - name: Checkout uses: actions/checkout@v4 with: submodules: true + - name: List files (non-Windows) + if: runner.os != 'Windows' + run: | + echo "Current directory:" + pwd + echo "All files recursively:" + find . -type f + + - name: List files (Windows) + if: runner.os == 'Windows' + run: | + echo "Current directory:" + pwd + echo "All files recursively:" + Get-ChildItem -Recurse | ForEach-Object { $_.FullName } + - name: Dependencies (Node.js - macOS, Windows) if: contains(matrix.os, 'macos') || contains(matrix.os, 'windows') uses: actions/setup-node@v4 diff --git a/binding.gyp b/binding.gyp index 30547c9..3ddfb5f 100644 --- a/binding.gyp +++ b/binding.gyp @@ -3,37 +3,6 @@ "NAPI_VERSION=<(napi_build_version)" ], "targets": [ - { - "target_name": "libpg_query", - "type": "none", - "actions": [{ - "action_name": "build_libpg_query", - "inputs": [], - "outputs": ["libpg_query/libpg_query.a"], - "conditions": [ - [ - 'OS=="win"', - { - "action": [ - "cmd", - "/c", - "cd /d libpg_query && MAKEFLAGS=-w nmake /F Makefile.msvc build", - ] - }, - ], - [ - 'OS!="win"', - { - "action": [ - "sh", - "-c", - "cd libpg_query && MAKEFLAGS=-w make build", - ] - }, - ], - ], - }], - }, { "target_name": "queryparser", "sources": [ @@ -63,7 +32,13 @@ "libraries": [ "-L