Skip to content

Commit

Permalink
Build x86_64 on CentOS
Browse files Browse the repository at this point in the history
  • Loading branch information
Kale-Ko committed Jun 11, 2024
1 parent 4dc79b1 commit f3971fa
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 46 deletions.
46 changes: 24 additions & 22 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,31 @@ jobs:
matrix:
architecture:
- name: x86_64
ubuntu_version: 18.04
gcc_package_name: "gcc g++"
gcc_exec_name: "x86_64-linux-gnu"
centos_version: "6-gcc7"
gcc_package_name: "gcc gcc-c++"
gcc_exec_name: "x86_64-redhat-linux-gnu"
- name: x86
ubuntu_version: 18.04
ubuntu_version: "18.04"
gcc_package_name: "gcc-i686-linux-gnu g++-i686-linux-gnu"
gcc_exec_name: "i686-linux-gnu"
- name: aarch64
ubuntu_version: 18.04
ubuntu_version: "18.04"
gcc_package_name: "gcc-aarch64-linux-gnu g++-aarch64-linux-gnu"
gcc_exec_name: "aarch64-linux-gnu"
- name: armv7
ubuntu_version: 18.04
ubuntu_version: "18.04"
gcc_package_name: "gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf"
gcc_exec_name: "arm-linux-gnueabihf"
- name: ppc64le
ubuntu_version: 18.04
ubuntu_version: "18.04"
gcc_package_name: "gcc-powerpc64le-linux-gnu g++-powerpc64le-linux-gnu"
gcc_exec_name: "powerpc64le-linux-gnu"
- name: riscv64
ubuntu_version: 18.04
ubuntu_version: "18.04"
gcc_package_name: "gcc-riscv64-linux-gnu g++-riscv64-linux-gnu"
gcc_exec_name: "riscv64-linux-gnu"
- name: s390x
ubuntu_version: 18.04
ubuntu_version: "18.04"
gcc_package_name: "gcc-s390x-linux-gnu g++-s390x-linux-gnu"
gcc_exec_name: "s390x-linux-gnu"
java_version: [ 8, 11, 17, 21 ]
Expand All @@ -69,32 +69,40 @@ jobs:
- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
distribution: 'corretto'
java-version: ${{ matrix.java_version }}
architecture: 'x64'
check-latest: true

- name: Setup Build
- name: Setup Ubuntu Build
if: ${{ matrix.architecture.ubuntu_version }}
run: |
docker build \
--platform linux/amd64 \
--build-arg "DOCKER_IMAGE=amd64/ubuntu:${{ matrix.architecture.ubuntu_version }}" \
--build-arg "JAVA_VERSION=${{ matrix.java_version }}" \
--build-arg "TARGET_GCC_PACKAGE=${{ matrix.architecture.gcc_package_name }}" \
--build-arg "TARGET_GCC_EXEC=${{ matrix.architecture.gcc_exec_name }}" \
--tag linux-buildimage:${{ matrix.architecture.name }} \
docker/build/
- name: Build
- name: Setup CentOS Build
if: ${{ matrix.architecture.centos_version }}
run: |
export MAVEN_HOME=$(dirname $(dirname $(which mvn)))
docker build \
--platform linux/amd64 \
--build-arg "DOCKER_IMAGE=gatlingcorp/centos:${{ matrix.architecture.centos_version }}" \
--build-arg "TARGET_GCC_PACKAGE=${{ matrix.architecture.gcc_package_name }}" \
--build-arg "TARGET_GCC_EXEC=${{ matrix.architecture.gcc_exec_name }}" \
--tag linux-buildimage:${{ matrix.architecture.name }} \
docker/centosbuild/
- name: Build
run: |
chmod +x ./mvnw ./mvnw.cmd
docker run \
--platform linux/amd64 \
--volume "$PWD:/data" \
--volume "$JAVA_HOME:/opt/java" \
--volume "$MAVEN_HOME:/opt/maven" \
linux-buildimage:${{ matrix.architecture.name }} \
./mvnw -B -V -ntp -P "linux-${{ matrix.architecture.name }}" "-Dmaven.test.skip=true" clean package
Expand Down Expand Up @@ -245,14 +253,11 @@ jobs:
- name: Build
run: |
export MAVEN_HOME=$(dirname $(dirname $(which mvn)))
chmod +x ./mvnw ./mvnw.cmd
docker run \
--platform linux/amd64 \
--volume "$PWD:/data" \
--volume "$JAVA_HOME:/opt/java" \
--volume "$MAVEN_HOME:/opt/maven" \
linux-buildimage:complete \
./mvnw -B -V -ntp -P "release" "-Dmaven.test.skip=true" package
Expand Down Expand Up @@ -285,7 +290,7 @@ jobs:
java_distro: 'temurin'
java_name: aarch64
docker_name: linux/aarch64
ubuntu_version: [ 16.04, 18.04, 20.04, 22.04, 24.04 ]
ubuntu_version: [ "16.04", "18.04", "20.04", "22.04", "24.04" ]
java_version: [ 8, 11, 17, 21 ]

needs: [ Linux-Build ]
Expand Down Expand Up @@ -328,14 +333,11 @@ jobs:
- name: Test
run: |
export MAVEN_HOME=$(dirname $(dirname $(which mvn)))
chmod +x ./mvnw ./mvnw.cmd
docker run \
--platform ${{ matrix.architecture.docker_name }} \
--volume "$PWD:/data" \
--volume "$JAVA_HOME:/opt/java" \
--volume "$MAVEN_HOME:/opt/maven" \
linux-testimage:${{ matrix.architecture.name }} \
./mvnw -B -V -ntp -P "release" test
Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
SET (CMAKE_BUILD_TYPE Release)
endif()
message(STATUS "Build type is '${CMAKE_BUILD_TYPE}'")
SET (CMAKE_C_FLAGS "-flto")
SET (CMAKE_CXX_FLAGS "-Wall -flto")
SET (CMAKE_C_FLAGS "")
SET (CMAKE_CXX_FLAGS "-Wall")

SET (CMAKE_CXX_STANDARD 11)
SET (CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down Expand Up @@ -73,4 +73,4 @@ add_library (brotli ${LIB_TYPE}
"natives/src/main/cpp/encoder_jni.cc"
)

SET_TARGET_PROPERTIES (brotli PROPERTIES LINKER_LANGUAGE CXX)
SET_TARGET_PROPERTIES (brotli PROPERTIES LINKER_LANGUAGE CXX)
10 changes: 3 additions & 7 deletions docker/build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,9 @@ RUN apt-get update -y && \
RUN update-alternatives --install /usr/bin/cc cc /usr/bin/${TARGET_GCC_EXEC}-gcc 999 && \
update-alternatives --install /usr/bin/c++ c++ /usr/bin/${TARGET_GCC_EXEC}-g++ 999

VOLUME "/opt/java"
ENV JAVA_HOME="/opt/java"
ENV PATH="$JAVA_HOME:$PATH"

VOLUME "/opt/maven"
ENV MAVEN_HOME="/opt/maven"
ENV PATH="$MAVEN_HOME:$PATH"
VOLUME "/opt/java/"
ENV JAVA_HOME "/opt/java/"
ENV PATH "$PATH:$JAVA_HOME/bin/"

VOLUME "/data"
WORKDIR "/data"
Expand Down
36 changes: 36 additions & 0 deletions docker/centosbuild/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
ARG DOCKER_IMAGE
FROM ${DOCKER_IMAGE}
USER root

ARG TARGET_GCC_PACKAGE
ARG TARGET_GCC_EXEC

ARG CMAKE_VERSION="3.20.5"

COPY setup-repo.sh /setup-repo.sh
RUN /setup-repo.sh

RUN yum update -y && \
yum install -y \
"make" ${TARGET_GCC_PACKAGE} \
"glibc" "libstdc++"

RUN update-alternatives --install /usr/bin/cc cc /usr/bin/${TARGET_GCC_EXEC}-gcc 999 && \
update-alternatives --install /usr/bin/c++ c++ /usr/bin/${TARGET_GCC_EXEC}-g++ 999

VOLUME "/opt/java/"
ENV JAVA_HOME "/opt/java/"
ENV PATH "$PATH:$JAVA_HOME/bin/"

RUN curl -L "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.tar.gz" -o cmake.tar.gz && \
mkdir /opt/cmake && \
tar -xzf cmake.tar.gz -C /opt/cmake --strip-components 1 && \
rm cmake.tar.gz

ENV PATH "$PATH:/opt/cmake/bin/"

VOLUME "/data/"
WORKDIR "/data/"

ENTRYPOINT [ ]
CMD [ "/bin/bash" ]
22 changes: 22 additions & 0 deletions docker/centosbuild/setup-repo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

(cat <<EOF
[base]
name=CentOS-\$releasever - Base
baseurl=http://archive.kernel.org/centos-vault/6.10/os/\$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
[updates]
name=CentOS-\$releasever - Updates
baseurl=http://archive.kernel.org/centos-vault/6.10/os/\$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
[extras]
name=CentOS-\$releasever - Extras
baseurl=http://archive.kernel.org/centos-vault/6.10/os/\$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
EOF
) | tee /etc/yum.repos.d/CentOS-Base.repo
10 changes: 3 additions & 7 deletions docker/completebuild/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,9 @@ RUN apt-get update -y && \
"libc6" "libstdc++6" "libatomic1" "zlib1g" && \
apt-get clean

VOLUME "/opt/java"
ENV JAVA_HOME="/opt/java"
ENV PATH="$JAVA_HOME:$PATH"

VOLUME "/opt/maven"
ENV MAVEN_HOME="/opt/maven"
ENV PATH="$MAVEN_HOME:$PATH"
VOLUME "/opt/java/"
ENV JAVA_HOME "/opt/java/"
ENV PATH "$PATH:$JAVA_HOME/bin/"

VOLUME "/data"
WORKDIR "/data"
Expand Down
2 changes: 2 additions & 0 deletions docker/install-qemu.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

sudo dpkg --add-architecture "$1"
sudo rm -f /etc/apt/sources.list /etc/apt/sources.list.d/ubuntu.sources
if [[ $2 != true ]]; then
Expand Down
2 changes: 2 additions & 0 deletions docker/merge-builds.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

OUT="$PWD"
rootPaths=($(find ./builds/*/natives/ -type d -name "target" | grep -oiP '(.*)\/([^-]*-[^-]*)-Build-JDK([0-9]*)(?=\/natives\/\2\/target)'))
paths=($(find ./builds/*/natives/ -type d -name "target" | grep -oiP '(?:(.*)\/([^-]*-[^-]*)-Build-JDK([0-9]*)\/)natives\/\2\/target'))
Expand Down
10 changes: 3 additions & 7 deletions docker/test/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,9 @@ RUN apt-get update -y && \
"libc6" "libstdc++6" "libatomic1" "zlib1g" && \
apt-get clean

VOLUME "/opt/java"
ENV JAVA_HOME="/opt/java"
ENV PATH="$JAVA_HOME:$PATH"

VOLUME "/opt/maven"
ENV MAVEN_HOME="/opt/maven"
ENV PATH="$MAVEN_HOME:$PATH"
VOLUME "/opt/java/"
ENV JAVA_HOME "/opt/java/"
ENV PATH "$PATH:$JAVA_HOME/bin/"

VOLUME "/data"
WORKDIR "/data"
Expand Down

0 comments on commit f3971fa

Please sign in to comment.