diff --git a/.github/actions/install-deps/action.yaml b/.github/actions/install-deps/action.yaml index 12d587bab7..5582515e5d 100644 --- a/.github/actions/install-deps/action.yaml +++ b/.github/actions/install-deps/action.yaml @@ -54,9 +54,11 @@ runs: remove-haskell: "true" remove-codeql: "true" + # Sticking to 3.29 because of: # https://github.com/open-telemetry/opentelemetry-cpp/issues/2998 - name: Setup cmake - uses: jwlawson/actions-setup-cmake@v2 + # uses: jwlawson/actions-setup-cmake@v2 + uses: tomjakubowski/actions-setup-cmake@v0-aarch64-test4 with: cmake-version: "3.29.6" diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index d088828a23..435721208d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -97,9 +97,6 @@ jobs: - name: Lint run: pnpm run lint --nightly - # - name: Docs Build - # run: pnpm run docs - - uses: actions/upload-artifact@v4 with: name: perspective-metadata @@ -188,6 +185,7 @@ jobs: matrix: os: - ubuntu-22.04 + - ubuntu-22.04-arm - macos-14 - windows-2022 arch: @@ -201,26 +199,40 @@ jobs: arch: x86_64 python-version: 3.9 container: pagmo2/manylinux228_x86_64_with_deps + - os: ubuntu-22.04-arm + arch: aarch64 + python-version: 3.9 + container: pagmo2/manylinux228_aarch64_with_deps is-release: - ${{ startsWith(github.ref, 'refs/tags/v') || github.ref_name == 'master' }} exclude: - os: windows-2022 arch: aarch64 - - os: ubuntu-22.04 - arch: aarch64 - os: macos-14 is-release: false - os: macos-14 arch: x86_64 - os: windows-2022 is-release: false + - os: ubuntu-22.04 + arch: aarch64 + - os: ubuntu-22.04-arm + arch: x86_64 steps: + - name: Run df -h + if: ${{ runner.os == 'Linux' }} + run: df -h + - name: Free up disk space if: ${{ runner.os == 'Linux' }} run: | rm -rf /__t/* + - name: Run df -h + if: ${{ runner.os == 'Linux' }} + run: df -h + - name: Checkout uses: actions/checkout@v4 @@ -233,6 +245,10 @@ jobs: name: perspective-metadata path: rust/ + - name: Run df -h + if: ${{ runner.os == 'Linux' }} + run: df -h + - name: Initialize Build id: init-step uses: ./.github/actions/install-deps @@ -242,9 +258,13 @@ jobs: manylinux: ${{ matrix.container && 'true' || 'false' }} skip_cache: ${{ steps.config-step.outputs.SKIP_CACHE }} + - name: Run df -h + if: ${{ runner.os == 'Linux' }} + run: df -h + - name: Python Build run: pnpm run build - if: ${{ !contains(matrix.os, 'windows') }} + if: ${{ runner.os != 'Windows' }} env: PACKAGE: "python" PSP_ARCH: ${{ matrix.arch }} @@ -255,7 +275,7 @@ jobs: run: | New-Item -ItemType Directory -Path $env:CARGO_TARGET_DIR -Force pnpm run build - if: ${{ contains(matrix.os, 'windows') }} + if: ${{ runner.os == 'Windows' }} env: CARGO_TARGET_DIR: D:\psp-rust PSP_CPP_BUILD_DIR: D:\psp-build @@ -264,6 +284,10 @@ jobs: PSP_ARCH: ${{ matrix.arch }} PSP_BUILD_WHEEL: 1 + - name: Run df -h + if: ${{ runner.os == 'Linux' }} + run: df -h + # Windows sucks lol - uses: actions/upload-artifact@v4 if: ${{ runner.os == 'Windows' }} @@ -658,7 +682,7 @@ jobs: matrix: os: - ubuntu-22.04 - - macos-14 + - ubuntu-22.04-arm - macos-14 - windows-2022 arch: @@ -685,6 +709,8 @@ jobs: arch: aarch64 - os: ubuntu-22.04 arch: aarch64 + - os: ubuntu-22.04-arm + arch: x86_64 steps: - name: Checkout uses: actions/checkout@v4 @@ -702,8 +728,7 @@ jobs: - uses: actions/download-artifact@v4 with: - # the macos-14 runner tests artifacts built on macos-14 - name: perspective-python-dist-${{ matrix.arch }}-${{ matrix.os == 'macos-14' && 'macos-14' || matrix.os }}-${{ matrix.python-version }} + name: perspective-python-dist-${{ matrix.arch }}-${{ matrix.os }}-${{ matrix.python-version }} - uses: ./.github/actions/install-wheel @@ -955,6 +980,10 @@ jobs: with: name: perspective-python-dist-aarch64-macos-14-3.9 + - uses: actions/download-artifact@v4 + with: + name: perspective-python-dist-aarch64-ubuntu-22.04-arm-3.9 + # - uses: actions/download-artifact@v4 # with: # name: perspective-python-dist-x86_64-macos-14-3.9 diff --git a/.husky/pre-push b/.husky/pre-push index bf440db5fa..0a4359365c 100755 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -1,4 +1,3 @@ #!/bin/sh -. "$(dirname "$0")/_/husky.sh" pnpm run prepush diff --git a/package.json b/package.json index f1b0c34c3c..eaea302546 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,7 @@ "test_python": "node tools/scripts/test_python.mjs", "clean": "node tools/scripts/clean.mjs", "start": "npm run start --workspace", - "prepush": "npm run lint", + "prepush": "node tools/scripts/prepush.mjs && npm run lint", "prepare": "husky install", "lint": "node tools/scripts/lint.mjs", "fix": "node tools/scripts/fix.mjs", diff --git a/rust/perspective-server/build.rs b/rust/perspective-server/build.rs index 4aae144129..11efda5aee 100644 --- a/rust/perspective-server/build.rs +++ b/rust/perspective-server/build.rs @@ -46,7 +46,12 @@ fn cmake_build() -> Result, std::io::Error> { dst.define("ARROW_BUILD_EXAMPLES", "OFF"); dst.define("RAPIDJSON_BUILD_EXAMPLES", "OFF"); dst.define("ARROW_CXX_FLAGS_DEBUG", "-Wno-error"); - dst.define("PSP_PROTOC_PATH", protoc()); + dst.define( + "PSP_PROTOC_PATH", + protoc() + .parent() + .expect("protoc() returned root path or empty string"), + ); dst.define("CMAKE_COLOR_DIAGNOSTICS", "ON"); dst.define( "PSP_PROTO_PATH", diff --git a/rust/perspective-server/cmake/modules/FindProtoc.cmake b/rust/perspective-server/cmake/modules/FindProtoc.cmake index ae7b65f940..872704dc83 100644 --- a/rust/perspective-server/cmake/modules/FindProtoc.cmake +++ b/rust/perspective-server/cmake/modules/FindProtoc.cmake @@ -9,7 +9,11 @@ function(download_protoc VERSION DESTINATION) elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") set(PROTOC_ZIP "protoc-${VERSION}-osx-x86_64.zip") elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") - set(PROTOC_ZIP "protoc-${VERSION}-linux-x86_64.zip") + if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "aarch64") + set(PROTOC_ZIP "protoc-${VERSION}-linux-aarch_64.zip") + else() + set(PROTOC_ZIP "protoc-${VERSION}-linux-x86_64.zip") + endif() else() message(FATAL_ERROR "Unsupported host system: ${CMAKE_HOST_SYSTEM_NAME}") endif() @@ -56,7 +60,7 @@ else() OUTPUT_VARIABLE PROTOC_VERSION_OUTPUT OUTPUT_STRIP_TRAILING_WHITESPACE ) - + if(NOT PROTOC_VERSION_OUTPUT MATCHES "^libprotoc ([0-9]+)\\.([0-9]+)(:?\\.([0-9]+))?") message(WARNING "Unable to determine protoc version") return() @@ -71,7 +75,7 @@ else() else() set(FOUND_VERSION "${PROTOC_VERSION_MAJOR}.${PROTOC_VERSION_MINOR}.${PROTOC_VERSION_PATCH}") endif() - + # Force the external project to use the same version as our installed protoc CLI set(LIBPROTOBUF_VERSION "v${FOUND_VERSION}" PARENT_SCOPE) @@ -120,4 +124,3 @@ function(protobuf_generate_cpp SRCS HDRS) set(${SRCS} ${_PROTOBUF_GENERATE_CPP_SRCS} PARENT_SCOPE) set(${HDRS} ${_PROTOBUF_GENERATE_CPP_HDRS} PARENT_SCOPE) endfunction() - diff --git a/tools/scripts/lint.mjs b/tools/scripts/lint.mjs index 09469da89e..f0723b3345 100644 --- a/tools/scripts/lint.mjs +++ b/tools/scripts/lint.mjs @@ -53,6 +53,7 @@ if (import.meta.url.startsWith("file:")) { // if (process.env.PSP_PROJECT === "python") { // await import("./lint_python.mjs"); // } else { + await lint_js(); lint_python(); // } diff --git a/tools/scripts/prepush.mjs b/tools/scripts/prepush.mjs new file mode 100644 index 0000000000..e8d52b6cce --- /dev/null +++ b/tools/scripts/prepush.mjs @@ -0,0 +1,70 @@ +// ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ +// ┃ ██████ ██████ ██████ █ █ █ █ █ █▄ ▀███ █ ┃ +// ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█ ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄ ▀█ █ ▀▀▀▀▀ ┃ +// ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄ █ ▄▄▄▄▄ ┃ +// ┃ █ ██████ █ ▀█▄ █ ██████ █ ███▌▐███ ███████▄ █ ┃ +// ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫ +// ┃ Copyright (c) 2017, the Perspective Authors. ┃ +// ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃ +// ┃ This file is part of the Perspective library, distributed under the terms ┃ +// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃ +// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + +import "zx/globals"; + +function lint_git(sha) { + if (!sha || typeof sha !== "string") { + throw new Error(`invalid sha: ${sha}`); + } + const result = $.sync`git log -1 ${sha} | grep -F "Signed-off-by: "`; + if (result.exitCode !== 0) { + console.error( + "`git log -1 " + + sha + + "` is missing a Signed-off-by: and DCO check will surely fail.", + ); + console.error("To sign off, run:\ngit commit --amend --edit --sign"); + process.exit(1); + } +} + +async function readPrePushInput() { + // Git supplies information about the push to the hook on stdin. + // https://git-scm.com/docs/githooks#_pre_push + const chunks = []; + + if (process.stdin.isTTY) { + // Makes developing the pre-push script more convenient. In particular + // when you run `pnpm run prepush` from a shell terminal you don't have + // to send EOF on stdin. + return []; + } + for await (const chunk of process.stdin) { + chunks.push(chunk); + } + + const input = Buffer.concat(chunks).toString(); + const lines = input.split("\n").filter((l) => l.length > 0); + return lines.map((line) => { + const parts = line.trim().split(" "); + + return { + local_ref: parts[0], + local_object_name: parts[1], + remote_ref: parts[2], + remote_object_name: parts[3], + }; + }); +} + +if (import.meta.main) { + // Does not actually run all pre-push hook checks (it does not run the repo + // lint script). These are lints which run only in pre-push. The + // `prepush` script defined in package.json is responsible for running the + // repo lint script. + const pushes = await readPrePushInput(); + for (const push of pushes) { + const { local_object_name } = push; + lint_git(local_object_name); + } +}