-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix GH-11 This part: https://github.com/apache/arrow/blob/58415d1fac50cb829b3dcf08526033d6db8c30db/.github/workflows/go.yml#L305-L360 This also imports `ci/scripts/go_{build,test}.sh` from apache/arrow. This also introduce ShellCheck and shfmt with pre-commit. This also adds apache/arrow-testing and apache/parquet-testing submodules.
- Loading branch information
Showing
10 changed files
with
363 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# 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. | ||
|
||
[*.sh] | ||
indent_style = space | ||
indent_size = 2 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# 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. | ||
|
||
# All of the following environment variables are required to set default values | ||
# for the parameters in docker-compose.yml. | ||
|
||
STATICCHECK=v0.5.1 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# 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: Lint | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
concurrency: | ||
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }} | ||
cancel-in-progress: true | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup Python | ||
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 | ||
with: | ||
python-version: 3.12 | ||
- name: Install pre-commit | ||
run: | | ||
python -m pip install pre-commit | ||
- name: Cache pre-commit | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.cache/pre-commit | ||
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} | ||
- name: Run pre-commit | ||
run: | | ||
pre-commit run --all-files --color=always --show-diff-on-failure |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# 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: | ||
pull_request: | ||
|
||
concurrency: | ||
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }} | ||
cancel-in-progress: true | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
macos: | ||
name: AMD64 macOS 12 Go ${{ matrix.go }} | ||
runs-on: macos-12 | ||
timeout-minutes: 30 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
go: | ||
- '1.21' | ||
- '1.22' | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 | ||
with: | ||
submodules: recursive | ||
- name: Setup Go | ||
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | ||
with: | ||
go-version: ${{ matrix.go }} | ||
cache: true | ||
cache-dependency-path: go.sum | ||
- name: Install bash via Homebrew | ||
run: | | ||
brew install bash | ||
- name: Install staticcheck | ||
run: | | ||
. .env | ||
go install honnef.co/go/tools/cmd/staticcheck@${STATICCHECK} | ||
- name: Build | ||
run: | | ||
$(brew --prefix)/bin/bash ci/scripts/build.sh $(pwd) | ||
- name: Test | ||
run: | | ||
$(brew --prefix)/bin/bash ci/scripts/test.sh $(pwd) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[submodule "arrow-testing"] | ||
path = arrow-testing | ||
url = https://github.com/apache/arrow-testing.git | ||
[submodule "parquet-testing"] | ||
path = parquet-testing | ||
url = https://github.com/apache/parquet-testing.git |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# 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. | ||
|
||
repos: | ||
- repo: https://github.com/koalaman/shellcheck-precommit | ||
rev: v0.10.0 | ||
hooks: | ||
- id: shellcheck | ||
- repo: https://github.com/scop/pre-commit-shfmt | ||
rev: v3.9.0-1 | ||
hooks: | ||
- id: shfmt | ||
args: | ||
# The default args is "--write --simplify" but we don't use | ||
# "--simplify". Because it's conflicted will ShellCheck. | ||
- "--write" |
Submodule arrow-testing
added at
4d2094
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#!/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 -eux | ||
|
||
source_dir=${1} | ||
|
||
# Need "all=" as per https://github.com/golang/go/issues/42131#issuecomment-713917379 | ||
export GOFLAGS="${GOFLAGS:-} -gcflags=all=-d=checkptr" | ||
|
||
pushd "${source_dir}/arrow" | ||
|
||
: "${ARROW_GO_TESTCGO:=}" | ||
|
||
go_install_arrow_options=() | ||
if [[ -n "${ARROW_GO_TESTCGO}" ]]; then | ||
if [[ "${MSYSTEM:-}" = "MINGW64" ]]; then | ||
export PATH=${MINGW_PREFIX}/bin:${PATH} | ||
go clean -cache | ||
go clean -testcache | ||
fi | ||
go_install_arrow_options+=("-tags" "assert,test,ccalloc") | ||
fi | ||
|
||
go install "${go_install_arrow_options[@]}" -v ./... | ||
|
||
popd | ||
|
||
pushd "${source_dir}/parquet" | ||
|
||
go install -v ./... | ||
|
||
popd | ||
|
||
: "${ARROW_INTEGRATION_GO:=ON}" | ||
|
||
if [[ "${ARROW_INTEGRATION_GO}" = "ON" ]]; then | ||
pushd "${source_dir}/arrow/internal/cdata_integration" | ||
|
||
case "$(uname)" in | ||
Linux) | ||
go_lib="arrow_go_integration.so" | ||
;; | ||
Darwin) | ||
go_lib="arrow_go_integration.dylib" | ||
;; | ||
MINGW*) | ||
go_lib="arrow_go_integration.dll" | ||
;; | ||
esac | ||
go build \ | ||
-buildvcs=false \ | ||
-tags cdata_integration,assert \ | ||
-buildmode=c-shared \ | ||
-o "${go_lib}" \ | ||
. | ||
|
||
popd | ||
fi |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
#!/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 -eux | ||
|
||
# simplistic semver comparison | ||
verlte() { | ||
[ "$1" = "$(echo -e "$1\n$2" | sort -V | head -n1)" ] | ||
} | ||
|
||
ver=$(go env GOVERSION) | ||
|
||
source_dir=${1} | ||
|
||
case "$(uname)" in | ||
MINGW*) | ||
# -race and -asan don't work on Windows currently | ||
test_args=() | ||
;; | ||
*) | ||
if [[ "$(go env GOHOSTARCH)" == "s390x" ]]; then | ||
# -race and -asan not supported on s390x | ||
test_args=() | ||
else | ||
test_args=("-race") | ||
if verlte "1.18" "${ver#go}" && [ "$(go env GOOS)" != "darwin" ]; then | ||
# asan not supported on darwin/amd64 | ||
test_args+=("-asan") | ||
fi | ||
fi | ||
;; | ||
esac | ||
|
||
# Go static check (skipped in MinGW) | ||
if [[ -z "${MINGW_LINT:-}" ]]; then | ||
pushd "${source_dir}" | ||
"$(go env GOPATH)"/bin/staticcheck ./... | ||
popd | ||
fi | ||
|
||
pushd "${source_dir}/arrow" | ||
|
||
: "${ARROW_GO_TESTCGO:=}" | ||
|
||
tags="assert,test" | ||
if [[ -n "${ARROW_GO_TESTCGO}" ]]; then | ||
if [[ "${MSYSTEM:-}" = "MINGW64" ]]; then | ||
export PATH=${MINGW_PREFIX}\\bin:${MINGW_PREFIX}\\lib:$PATH | ||
fi | ||
tags+=",ccalloc" | ||
fi | ||
|
||
# the cgo implementation of the c data interface requires the "test" | ||
# tag in order to run its tests so that the testing functions implemented | ||
# in .c files don't get included in non-test builds. | ||
|
||
go test "${test_args[@]}" -tags ${tags} ./... | ||
|
||
# run it again but with the noasm tag | ||
go test "${test_args[@]}" -tags ${tags},noasm ./... | ||
|
||
popd | ||
|
||
export PARQUET_TEST_DATA=${1}/parquet-testing/data | ||
export ARROW_TEST_DATA=${1}/arrow-testing/data | ||
pushd "${source_dir}/parquet" | ||
|
||
go test "${test_args[@]}" -tags assert ./... | ||
|
||
# run the tests again but with the noasm tag | ||
go test "${test_args[@]}" -tags assert,noasm ./... | ||
|
||
popd |
Submodule parquet-testing
added at
50af3d