Skip to content

Commit

Permalink
Merge pull request #11708 from carlopi/docker_builds
Browse files Browse the repository at this point in the history
Test dockerized compilation in Alpine:latest and Ubuntu:20.04
  • Loading branch information
Mytherin committed Apr 18, 2024
2 parents b52ec62 + 5adcf39 commit 1ffcc8b
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 4 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/DockerTests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Docker tests
on:
workflow_call:
inputs:
override_git_describe:
type: string
git_ref:
type: string
skip_tests:
type: string
workflow_dispatch:
inputs:
override_git_describe:
type: string
git_ref:
type: string
skip_tests:
type: string
repository_dispatch:
push:
branches:
- '**'
- '!main'
- '!feature'
paths-ignore:
- '**'
- '!.github/workflows/DockerTests.yml'
- '!scripts/test_docker_images.sh'
pull_request:
types: [opened, reopened, ready_for_review]
paths-ignore:
- '**'
- '!.github/workflows/DockerTests.yml'
- '!scripts/test_docker_images.sh'

concurrency:
group: docker-${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || '' }}-${{ github.base_ref || '' }}-${{ github.ref != 'refs/heads/main' || github.sha }}-${{ inputs.override_git_describe }}
cancel-in-progress: true

env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
OVERRIDE_GIT_DESCRIBE: ${{ inputs.override_git_describe }}

jobs:
linux-x64-docker:
# Builds binaries for linux_amd64_gcc4
name: Docker tests on Linux (x64)
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ inputs.git_ref }}

- name: Build
shell: bash
run: |
./scripts/test_docker_images.sh
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ project(DuckDB)

find_package(Threads REQUIRED)

set(DUCKDB_MODULE_BASE_DIR "${CMAKE_CURRENT_LIST_DIR}")

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set (CMAKE_CXX_STANDARD 11)
Expand Down Expand Up @@ -829,7 +831,7 @@ function(build_loadable_extension_directory NAME OUTPUT_DIRECTORY EXTENSION_VERS
TARGET ${TARGET_NAME}
POST_BUILD
COMMAND
${CMAKE_COMMAND} -DEXTENSION=$<TARGET_FILE:${TARGET_NAME}> -DPLATFORM_FILE=${DuckDB_BINARY_DIR}/duckdb_platform_out -DDUCKDB_VERSION="${DUCKDB_NORMALIZED_VERSION}" -DEXTENSION_VERSION="${EXTENSION_VERSION}" -DNULL_FILE=${CMAKE_CURRENT_FUNCTION_LIST_DIR}/scripts/null.txt -P ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/scripts/append_metadata.cmake
${CMAKE_COMMAND} -DEXTENSION=$<TARGET_FILE:${TARGET_NAME}> -DPLATFORM_FILE=${DuckDB_BINARY_DIR}/duckdb_platform_out -DDUCKDB_VERSION="${DUCKDB_NORMALIZED_VERSION}" -DEXTENSION_VERSION="${EXTENSION_VERSION}" -DNULL_FILE=${DUCKDB_MODULE_BASE_DIR}/scripts/null.txt -P ${DUCKDB_MODULE_BASE_DIR}/scripts/append_metadata.cmake
)
add_dependencies(${TARGET_NAME} duckdb_platform)
if (NOT EXTENSION_CONFIG_BUILD AND NOT ${EXTENSION_TESTS_ONLY} AND NOT CLANG_TIDY)
Expand Down
4 changes: 2 additions & 2 deletions scripts/test_docker_images.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash

make clean
docker run -i --rm -v $(pwd):/duckdb --workdir /duckdb alpine:latest <<< "apk add g++ git make cmake ninja && GEN=ninja make" 2>&1
echo "alpine:latest completed"
docker run -i --rm -v $(pwd):/duckdb --workdir /duckdb alpine:latest <<< "apk add g++ git make cmake ninja python3 && GEN=ninja make && make clean" 2>&1
docker run -i --rm -v $(pwd):/duckdb --workdir /duckdb ubuntu:20.04 <<< "apt-get update && export DEBIAN_FRONTEND=noninteractive && apt-get install g++ git make cmake ninja-build python3 -y && GEN=ninja make && make clean" 2>&1
6 changes: 5 additions & 1 deletion src/common/local_file_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ extern "C" WINBASEAPI BOOL WINAPI GetPhysicallyInstalledSystemMemory(PULONGLONG)
#endif

#if defined(__linux__)
#include <linux/falloc.h>
// See https://man7.org/linux/man-pages/man2/fallocate.2.html
#ifndef _GNU_SOURCE
#define _GNU_SOURCE /* See feature_test_macros(7) */
#endif
#include <fcntl.h>
#include <libgen.h>
// See e.g.:
// https://opensource.apple.com/source/CarbonHeaders/CarbonHeaders-18.1/TargetConditionals.h.auto.html
Expand Down

0 comments on commit 1ffcc8b

Please sign in to comment.