Skip to content

Apache DataFusion SQL Query Engine

ARROW-6730: [CI] Use GitHub Actions for "C++ with clang 7" docker image

François Saint-Jacques5223598725d1
diff --git a/.github/workflows/linux-docker-compose.yml b/.github/workflows/linux-docker-compose.yml
new file mode 100644
index 0000000000..d1198572b5
--- /dev/null
+++ b/.github/workflows/linux-docker-compose.yml
@@ -0,0 +1,47 @@
+# 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: Linux docker-compose
+on:
+ - push
+ - pull_request
+jobs:
+ build:
+ name: Test
+ strategy:
+ matrix:
+ label:
+ - C++ w/ clang-7 & system packages
+ include:
+ - label: C++ w/ clang-7 & system packages
+ image: cpp-system-deps
+ skip_expression: |
+ ${ARROW_CI_CPP_AFFECTED} != "1"
+ runs-on: ubuntu-18.04
+ steps:
+ - uses: actions/checkout@master
+ with:
+ submodules: true
+ - name: docker-compose
+ run: |
+ eval "$(python ci/detect-changes.py)"
+ if [[ ${{ matrix.skip_expression }} ]]; then
+ exit
+ fi
+
+ docker-compose build --pull ${{ matrix.image }}
+ docker-compose run ${{ matrix.image }}
diff --git a/ci/detect-changes.py b/ci/detect-changes.py
index d35d9b570b..424cd99d86 100644
--- a/ci/detect-changes.py
+++ b/ci/detect-changes.py
@@ -129,6 +129,16 @@ def list_appveyor_affected_files():
return list_affected_files("{0}..HEAD".format(merge_base))
+def list_github_actions_affected_files():
+ """
+ Return a list of files affected in the current GitHub Actions build.
+ """
+ # GitHub Actions checkout `refs/remotes/pull/$PR/merge` where `HEAD` points
+ # to the merge commit while `HEAD^` points to the commit before. Hence,
+ # `..HEAD^` points to all commit between master and the PR.
+ return list_affected_files("HEAD^..")
+
+
LANGUAGE_TOPICS = ['c_glib', 'cpp', 'docs', 'go', 'java', 'js', 'python',
'r', 'ruby', 'rust', 'csharp']
@@ -143,6 +153,9 @@ AFFECTED_DEPENDENCIES = {
'format': LANGUAGE_TOPICS,
'go': ['integration'],
'.travis.yml': ALL_TOPICS,
+ # In theory, it should ignore CONTRIBUTING.md and ISSUE_TEMPLATE.md, but in
+ # practice it's going to be CI
+ '.github': ALL_TOPICS,
'c_glib': ['ruby']
}
@@ -255,6 +268,23 @@ def run_from_appveyor():
return get_windows_shell_eval(make_env_for_topics(affected))
+def run_from_github():
+ perr("Environment variables (excerpt):")
+ dump_env_vars('GITHUB_', '(REPOSITORY|ACTOR|SHA|REF|HEAD_REF|BASE_REF|EVENT_NAME)')
+ if os.environ['GITHUB_EVENT_NAME'] != 'pull_request':
+ # Not a PR build, test everything
+ affected = dict.fromkeys(ALL_TOPICS, True)
+ else:
+ affected_files = list_github_actions_affected_files()
+ perr("Affected files:", affected_files)
+ affected = get_affected_topics(affected_files)
+ assert set(affected) <= set(ALL_TOPICS), affected
+
+ perr("Affected topics:")
+ perr(pprint.pformat(affected))
+ return get_unix_shell_eval(make_env_for_topics(affected))
+
+
def test_get_affected_topics():
affected_topics = get_affected_topics(['cpp/CMakeLists.txt'])
assert affected_topics == {
@@ -290,6 +320,23 @@ def test_get_affected_topics():
'dev': False
}
+ affected_topics = get_affected_topics(['.github/workflows'])
+ assert affected_topics == {
+ 'c_glib': True,
+ 'cpp': True,
+ 'docs': True,
+ 'go': True,
+ 'java': True,
+ 'js': True,
+ 'python': True,
+ 'r': True,
+ 'ruby': True,
+ 'rust': True,
+ 'csharp': True,
+ 'integration': True,
+ 'dev': True,
+ }
+
if __name__ == "__main__":
# This script should have its output evaluated by a shell,
@@ -307,5 +354,11 @@ if __name__ == "__main__":
except Exception:
print("exit 1")
raise
+ elif os.environ.get('GITHUB_WORKFLOW'):
+ try:
+ print(run_from_github())
+ except Exception:
+ print("exit 1")
+ raise
else:
- sys.exit("Script must be run under Travis-CI or AppVeyor")
+ sys.exit("Script must be run under Travis-CI, AppVeyor or GitHub Actions")
diff --git a/docker-compose.yml b/docker-compose.yml
index a5cb6061f6..0d0f6f9fc6 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -131,7 +131,6 @@ services:
args:
LLVM_VERSION: 7
environment:
- ARROW_FLIGHT: "ON"
ARROW_USE_ASAN: "ON"
ARROW_USE_UBSAN: "ON"
volumes: