Skip to content

Commit

Permalink
Linux build using ubi8 and gcc12 (#338)
Browse files Browse the repository at this point in the history
* adding docker file

* adding dockerfile

* giving permissions to cmake file

* build ubi8 image

* adding destination in artifact

* using zip instead of tar

* ignoring parent folder while zipping

* replacing ubuntu with ubi8 binaries

* replacing ubuntu with ubi8 binaries

* creating artifacts from ubi8

* fixing lib3mf linux export
  • Loading branch information
gangatp authored Jan 31, 2024
1 parent e77162c commit e5014c5
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 19 deletions.
51 changes: 42 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
on: [push, pull_request]
name: Build
jobs:
build-linux:
build-linux-memtest:
runs-on: ubuntu-20.04
steps:
- run: sudo apt update
Expand All @@ -12,19 +12,53 @@ jobs:
- run: sh cmake/GenerateMake.sh
- run: cmake --build . --target lib3mf_memcheck
working-directory: ./build
- run: ctest -V
working-directory: ./build
- name: Archive Linux binary
uses: actions/upload-artifact@v2

build-linux-ubi8-gcc12:
runs-on: ubuntu-20.04
steps:
- run: sudo apt update
- run: sudo apt install -y uuid-dev
- uses: actions/checkout@v2
with:
name: lib3mf.so
path: build/lib3mf.so.2
submodules: true
- run: mkdir -p build
- run: zip -r build/bindings.zip Autogenerated/Bindings

- name: Archive bindings
uses: actions/upload-artifact@v2
with:
name: bindings.zip
path: build/bindings.zip
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Docker Build
uses: docker/build-push-action@v5
with:
context: .
file: ./CI/Dockerfile
platforms: linux/amd64
tags: lib3mf_ubi8:latest
load: true
-
name: Docker Extract
uses: shrink/[email protected]
id: extract
with:
image: lib3mf_ubi8:latest
path: out.zip
destination: dist

- run: unzip out.zip
working-directory: ./dist
-
name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: lib3mf.so
path: dist/lib3mf.so.2

build-macos:
runs-on: macos-latest
steps:
Expand All @@ -41,7 +75,6 @@ jobs:
with:
name: lib3mf.dylib
path: build/lib3mf.dylib

codecoverage-macos:
runs-on: macos-latest
steps:
Expand Down Expand Up @@ -141,7 +174,7 @@ jobs:
working-directory: ./build
assemble-sdk:
runs-on: ubuntu-20.04
needs: [build-windows-release, build-linux, build-macos]
needs: [build-windows-release, build-macos, build-linux-ubi8-gcc12]
steps:
- run: sudo apt install -y zip unzip
- run: mkdir build
Expand Down
72 changes: 69 additions & 3 deletions CI/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,70 @@
FROM martinweismann/lib3mf_ppcbuilds:latest
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest

LABEL maintainer="[email protected]"

ENV GCCTOOLSET=gcc-toolset-12

RUN \
microdnf update -y && \
microdnf -y install --nodocs \
wget \
which \
libuuid-devel \
glibc-langpack-en \
tar \
gzip \
zip \
${GCCTOOLSET} \
&& microdnf clean all

ENV LD_LIBRARY_PATH=/opt/rh/${GCCTOOLSET}/root/usr/lib64:/opt/rh/${GCCTOOLSET}/root/usr/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
ENV PKG_CONFIG_PATH=/opt/rh/${GCCTOOLSET}/root/usr/lib64/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}}
ENV PATH=/opt/rh/${GCCTOOLSET}/root/usr/bin${PATH:+:${PATH}}

# CMake
ARG CMAKE_VERSION=3.28.1
ADD "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.tar.gz" /usr/tmp/
RUN tar xzf /usr/tmp/cmake-$CMAKE_VERSION-linux-x86_64.tar.gz -C /opt && rm /usr/tmp/cmake-$CMAKE_VERSION-linux-x86_64.tar.gz
ENV PATH /opt/cmake-$CMAKE_VERSION-linux-x86_64/bin:${PATH}


RUN ln -s /opt/cmake-$CMAKE_VERSION-linux-x86_64/bin/cmake /usr/bin/cmake3
RUN ln -s /opt/cmake-$CMAKE_VERSION-linux-x86_64/bin/cpack /usr/bin/cpack3
RUN ln -s /opt/cmake-$CMAKE_VERSION-linux-x86_64/bin/ctest /usr/bin/ctest3


RUN ldd --version
RUN cmake --version
RUN cmake3 --version
RUN gcc --version


ADD . lib3mf-repo
ADD CI/script.sh script.sh
ENTRYPOINT ["sh", "script.sh"]

WORKDIR "/lib3mf-repo"

RUN chmod +x cmake/GenerateMake.sh

RUN cmake/GenerateMake.sh

WORKDIR "/lib3mf-repo/build"

RUN cmake --build .

RUN ctest -V .

WORKDIR "/../../"

RUN mkdir -p out

RUN cp ./lib3mf-repo/build/lib3mf.so.2 ./out/

RUN cd out && zip -r ../out.zip .








18 changes: 18 additions & 0 deletions CI/Dockerfile.ubuntu
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copy this to root folder of lib3mf then build and run this image.
FROM ubuntu:20.04

RUN apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install build-essential uuid-dev wget

RUN wget -qO- "https://cmake.org/files/v3.28/cmake-3.28.1-linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C /usr/local

ADD . lib3mf-repo

WORKDIR "/lib3mf-repo"

RUN cmake/GenerateMake.sh

WORKDIR "/lib3mf-repo/build"

RUN cmake --build .

RUN ctest -V .
7 changes: 0 additions & 7 deletions CI/script.sh

This file was deleted.

0 comments on commit e5014c5

Please sign in to comment.