This is an automated email from the ASF dual-hosted git repository.

kou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-js.git


The following commit(s) were added to refs/heads/main by this push:
     new 974b76f  Enable CI (#18)
974b76f is described below

commit 974b76f827a8792c09bb94a04283902dc72171ce
Author: Sutou Kouhei <[email protected]>
AuthorDate: Tue May 20 17:11:06 2025 +0900

    Enable CI (#18)
    
    Fixes #3
    
    Import
    https://github.com/apache/arrow/blob/main/.github/workflows/js.yml and
    adjust it for apache/arrow-js.
---
 .dockerallow                |  18 ++++++++
 .env                        |  40 +++++++++++++++++
 .github/workflows/test.yaml | 106 ++++++++++++++++++++++++++++++++++++++++++++
 .gitignore                  |   6 +--
 ci/scripts/build.sh         |  44 ++++++++++++++++++
 ci/scripts/test.sh          |  29 ++++++++++++
 compose.yaml                |  52 ++++++++++++++++++++++
 7 files changed, 292 insertions(+), 3 deletions(-)

diff --git a/.dockerallow b/.dockerallow
new file mode 100644
index 0000000..b18aa8e
--- /dev/null
+++ b/.dockerallow
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# We don't use anything when build a Docker image for now.
diff --git a/.env b/.env
new file mode 100644
index 0000000..f3e22f2
--- /dev/null
+++ b/.env
@@ -0,0 +1,40 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Empty prefix means that the Docker Compose configuration will use named
+# volumes which potentially improves the performance on Docker for macOS and
+# Docker for Windows, it also prevents the contamination of the source
+# directory.
+# A non-empty prefix means that directories from the host are bind-mounted
+# into the container, it should be set to ".docker/" on GitHub Actions to keep
+# the cache plugin functional.
+DOCKER_VOLUME_PREFIX=
+
+# turn on inline build cache, this is a docker buildx feature documented
+# at https://github.com/docker/buildx#--cache-tonametypetypekeyvalue
+BUILDKIT_INLINE_CACHE=1
+COMPOSE_DOCKER_CLI_BUILD=1
+DOCKER_BUILDKIT=1
+
+# different architecture notations
+ARCH=amd64
+
+# Default versions for platforms
+DEBIAN_CODE_NAME=bookworm
+
+# Default versions for various dependencies
+NODE=18
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
new file mode 100644
index 0000000..bfc935b
--- /dev/null
+++ b/.github/workflows/test.yaml
@@ -0,0 +1,106 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+name: Test
+
+on:
+  push:
+    branches:
+      - '**'
+      - '!dependabot/**'
+    tags:
+      - '**'
+  pull_request:
+
+concurrency:
+  group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ 
github.workflow }}
+  cancel-in-progress: true
+
+permissions:
+  contents: read
+
+jobs:
+
+  docker:
+    name: AMD64 Debian Node.js 18
+    runs-on: ubuntu-latest
+    timeout-minutes: 60
+    env:
+      DOCKER_VOLUME_PREFIX: .docker/
+    steps:
+      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 
v4.2.2
+      - name: Cache
+        uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
+        with:
+          path: .docker
+          key: jest-docker--${{ hashFiles('src/**/*.ts', 'test/**/*.ts', 
'yarn.lock') }}
+          restore-keys: jest-
+      - name: Run
+        run: |
+          docker compose run debian
+
+  macos:
+    name: AMD64 macOS Node.JS ${{ matrix.node }}
+    runs-on: macos-latest
+    timeout-minutes: 45
+    strategy:
+      fail-fast: false
+      matrix:
+        node: [18]
+    steps:
+      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 
v4.2.2
+      - name: Cache
+        uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
+        with:
+          path: .jest-cache
+          key: jest-${{ runner.os }}-${{ hashFiles('src/**/*.ts', 
'test/**/*.ts', 'yarn.lock') }}
+          restore-keys: jest-${{ runner.os }}-
+      - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # 
v4.4.0
+        with:
+          node-version: ${{ matrix.node }}
+      - name: Build
+        shell: bash
+        run: ci/scripts/build.sh $(pwd)
+      - name: Test
+        shell: bash
+        run: ci/scripts/test.sh $(pwd)
+
+  windows:
+    name: AMD64 Windows NodeJS ${{ matrix.node }}
+    runs-on: windows-latest
+    timeout-minutes: 45
+    strategy:
+      fail-fast: false
+      matrix:
+        node: [18]
+    steps:
+      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 
v4.2.2
+      - name: Cache
+        uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
+        with:
+          path: .jest-cache
+          key: jest-${{ runner.os }}-${{ hashFiles('src/**/*.ts', 
'test/**/*.ts', 'yarn.lock') }}
+          restore-keys: jest-${{ runner.os }}-
+      - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # 
v4.4.0
+        with:
+          node-version: ${{ matrix.node }}
+      - name: Build
+        shell: bash
+        run: ci/scripts/build.sh $(pwd)
+      - name: Test
+        shell: bash
+        run: ci/scripts/test.sh $(pwd)
diff --git a/.gitignore b/.gitignore
index 5752f92..5b99946 100644
--- a/.gitignore
+++ b/.gitignore
@@ -66,9 +66,6 @@ package-lock.json
 # Yarn Integrity file
 .yarn-integrity
 
-# dotenv environment variables file
-.env
-
 # compilation targets
 doc
 dist
@@ -87,5 +84,8 @@ test/__snapshots__/
 # jest cache
 .jest-cache/
 
+# Docker cache
+.docker/
+
 # VSCode
 !.vscode
diff --git a/ci/scripts/build.sh b/ci/scripts/build.sh
new file mode 100755
index 0000000..4914828
--- /dev/null
+++ b/ci/scripts/build.sh
@@ -0,0 +1,44 @@
+#!/usr/bin/env bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set -exu
+
+source_dir="${1}"
+
+: "${BUILD_DOCS_JS:=OFF}"
+
+pushd "${source_dir}"
+
+yarn --immutable
+yarn build
+
+if [ "${BUILD_DOCS_JS}" = "ON" ]; then
+  # If upstream is defined, use it as remote.
+  # Otherwise use origin which could be a fork on PRs.
+  if [[ "$(git config --get remote.upstream.url)" =~ 
"https://github.com/apache/arrow-js"; ]]; then
+    yarn doc --gitRemote upstream
+  elif [[ "$(basename -s .git $(git config --get remote.origin.url))" == 
"arrow-js" ]]; then
+    yarn doc
+  else
+    echo "Failed to build docs because the remote is not set correctly. Please 
set the origin or upstream remote to https://github.com/apache/arrow-js.git.";
+    exit 0
+  fi
+fi
+
+popd
diff --git a/ci/scripts/test.sh b/ci/scripts/test.sh
new file mode 100755
index 0000000..498bcbe
--- /dev/null
+++ b/ci/scripts/test.sh
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set -ex
+
+source_dir="${1}"
+
+pushd "${source_dir}"
+
+yarn test
+yarn test:bundle
+
+popd
diff --git a/compose.yaml b/compose.yaml
new file mode 100644
index 0000000..4a17439
--- /dev/null
+++ b/compose.yaml
@@ -0,0 +1,52 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Usage
+# -----
+#
+# The docker compose file is parametrized using environment variables, the
+# defaults are set in .env file.
+#
+# Example:
+# $ ARCH=arm64v8 docker compose build debian
+# $ ARCH=arm64v8 docker compose run debian
+
+x-common: &common
+  GITHUB_ACTIONS:
+
+volumes:
+  jest-cache:
+    name: jest-cache
+
+services:
+  debian:
+    # Usage:
+    #   docker compose build debian
+    #   docker compose run debian
+    image: ${ARCH}/node:${NODE}-${DEBIAN_CODE_NAME}
+    shm_size: &shm-size 2G
+    volumes: &debian-volumes
+      - .:/arrow-js:delegated
+      - ${DOCKER_VOLUME_PREFIX}jest-cache:/jest-cache:delegated
+    environment:
+      <<: *common
+      BUILD_DOCS_JS: "ON"
+      NODE_NO_WARNINGS: "1"
+    command: &command >
+      /bin/bash -c "
+        /arrow-js/ci/scripts/build.sh /arrow-js &&
+        /arrow-js/ci/scripts/test.sh /arrow-js"

Reply via email to