diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index 3e86645..0f296f8 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -33,6 +33,8 @@ jobs: with: fetch-depth: 0 lfs: true + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Login to DockerHub @@ -52,4 +54,5 @@ jobs: cache-from: type=gha cache-to: type=gha,mode=max target: root-user + platforms: linux/amd64,linux/arm64 push: true diff --git a/.github/workflows/build-packages.yml b/.github/workflows/build-packages.yml index e1d93b3..90d25db 100644 --- a/.github/workflows/build-packages.yml +++ b/.github/workflows/build-packages.yml @@ -27,12 +27,20 @@ jobs: build-package-cpp: name: Build C++ Package runs-on: ubuntu-latest + strategy: + matrix: + architecture: [amd64, arm64] steps: - name: Checkout Repository uses: actions/checkout@v3 with: fetch-depth: 0 lfs: true + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + if: matrix.architecture == 'arm64' + with: + platforms: arm64 - name: Login to DockerHub uses: docker/login-action@v2 with: @@ -41,7 +49,7 @@ jobs: - name: Pull Development Image run: docker pull ${{ env.DOCKER_REGISTRY_PATH }}/${{ inputs.project_name }}-development:${{ inputs.project_version }} - name: Build C++ Package - run: make build-packages-cpp-standalone + run: make build-packages-cpp-standalone PLATFORM=${{ matrix.architecture }} - name: Upload C++ Package uses: actions/upload-artifact@v3 with: @@ -51,12 +59,20 @@ jobs: build-package-python: name: Build Python Package runs-on: ubuntu-latest + strategy: + matrix: + architecture: [amd64, arm64] steps: - name: Checkout Repository uses: actions/checkout@v3 with: fetch-depth: 0 lfs: true + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + if: matrix.architecture == 'arm64' + with: + platforms: arm64 - name: Login to DockerHub uses: docker/login-action@v2 with: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..b40c4d2 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,52 @@ +# Apache License 2.0 + +name: Build + +on: + push: + branches: + - main + pull_request: + + +concurrency: + group: main-${{ github.ref }} + cancel-in-progress: true + +env: + PROJECT_NAME: open-space-toolkit-base + +jobs: + prepare-environment: + name: Prepare Environment Variables + runs-on: ubuntu-latest + outputs: + project_name: ${{ steps.project-name.outputs.value }} + project_version: ${{ steps.project-version.outputs.value }} + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + lfs: true + - id: project-name + name: Get Project Name + run: | + echo "Project name: ${{ env.PROJECT_NAME }}" + echo "value=${{ env.PROJECT_NAME }}" >> $GITHUB_OUTPUT + - id: project-version + name: Get Project Version + run: | + project_version=$(git describe --tags --always) + echo "Project version: ${project_version}" + echo "value=${project_version}" >> $GITHUB_OUTPUT + + build-development-image: + name: Build Development Image + needs: + - prepare-environment + uses: ./.github/workflows/build-image.yml + with: + project_name: ${{ needs.prepare-environment.outputs.project_name }} + project_version: ${{ needs.prepare-environment.outputs.project_version }} + secrets: inherit \ No newline at end of file diff --git a/docker/development/Dockerfile b/docker/development/Dockerfile index c94eceb..0eb19ed 100644 --- a/docker/development/Dockerfile +++ b/docker/development/Dockerfile @@ -1,6 +1,6 @@ # Apache License 2.0 -FROM ubuntu:20.04 +FROM ubuntu:20.04 as root-user LABEL maintainer="lucas.bremond@gmail.com" @@ -169,51 +169,51 @@ RUN cd /tmp \ # Dependencies -## Pybind11 - -ARG PYBIND_11_VERSION="2.10.3-1" - -RUN mkdir /tmp/pybind11 \ - && cd /tmp/pybind11 \ - && wget http://ftp.us.debian.org/debian/pool/main/p/pybind11/pybind11-dev_${PYBIND_11_VERSION}_all.deb \ - && apt-get install -y ./pybind11-dev_${PYBIND_11_VERSION}_all.deb \ - && rm -rf /tmp/pybind11 - -## Boost - -ARG BOOST_MAJOR_VERSION="1" -ARG BOOST_MINOR_VERSION="82" -ARG BOOST_VERSION="${BOOST_MAJOR_VERSION}.${BOOST_MINOR_VERSION}.0" - -RUN mkdir -p /tmp/boost \ - && cd /tmp/boost \ - && wget -O boost_${BOOST_VERSION}.tar.gz https://sourceforge.net/projects/boost/files/boost/${BOOST_VERSION}/boost_${BOOST_MAJOR_VERSION}_${BOOST_MINOR_VERSION}_0.tar.gz/download \ - && tar -xf boost_${BOOST_VERSION}.tar.gz \ - && cd boost_${BOOST_MAJOR_VERSION}_${BOOST_MINOR_VERSION}_0 \ - && ./bootstrap.sh --with-python=/usr/local/bin/python3.10 \ - && echo "using python : 3.10 : /usr : /usr/include/python3.10m ;" >> project-config.jam \ - && ./b2 -j $(nproc) link=static cxxflags=-fPIC install \ - && ./b2 -j $(nproc) python=3.10 link=shared cxxflags=-fPIC install \ - && rm -rf /tmp/boost - -## OpenSSL - -ARG OPENSSL_VERSION="3.0.2" - -RUN mkdir /tmp/openssl \ - && cd /tmp/openssl \ - && wget https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz \ - && tar -xvf openssl-${OPENSSL_VERSION}.tar.gz \ - && cd openssl-${OPENSSL_VERSION} \ - && ./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl shared zlib \ - && make \ - && make install \ - && touch /etc/ld.so.conf.d/openssl-${OPENSSL_VERSION}.conf \ - && echo "/usr/local/ssl/lib64" >> /etc/ld.so.conf.d/openssl-${OPENSSL_VERSION}.conf \ - && ldconfig \ - && mv /usr/local/ssl/bin/c_rehash /usr/bin/c_rehash \ - && mv /usr/local/ssl/bin/openssl /usr/bin/openssl \ - && rm -rf /tmp/openssl +# ## Pybind11 + +# ARG PYBIND_11_VERSION="2.10.3-1" + +# RUN mkdir /tmp/pybind11 \ +# && cd /tmp/pybind11 \ +# && wget http://ftp.us.debian.org/debian/pool/main/p/pybind11/pybind11-dev_${PYBIND_11_VERSION}_all.deb \ +# && apt-get install -y ./pybind11-dev_${PYBIND_11_VERSION}_all.deb \ +# && rm -rf /tmp/pybind11 + +# ## Boost + +# ARG BOOST_MAJOR_VERSION="1" +# ARG BOOST_MINOR_VERSION="82" +# ARG BOOST_VERSION="${BOOST_MAJOR_VERSION}.${BOOST_MINOR_VERSION}.0" + +# RUN mkdir -p /tmp/boost \ +# && cd /tmp/boost \ +# && wget -O boost_${BOOST_VERSION}.tar.gz https://sourceforge.net/projects/boost/files/boost/${BOOST_VERSION}/boost_${BOOST_MAJOR_VERSION}_${BOOST_MINOR_VERSION}_0.tar.gz/download \ +# && tar -xf boost_${BOOST_VERSION}.tar.gz \ +# && cd boost_${BOOST_MAJOR_VERSION}_${BOOST_MINOR_VERSION}_0 \ +# && ./bootstrap.sh --with-python=/usr/local/bin/python3.10 \ +# && echo "using python : 3.10 : /usr : /usr/include/python3.10m ;" >> project-config.jam \ +# && ./b2 -j $(nproc) link=static cxxflags=-fPIC install \ +# && ./b2 -j $(nproc) python=3.10 link=shared cxxflags=-fPIC install \ +# && rm -rf /tmp/boost + +# ## OpenSSL + +# ARG OPENSSL_VERSION="3.0.2" + +# RUN mkdir /tmp/openssl \ +# && cd /tmp/openssl \ +# && wget https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz \ +# && tar -xvf openssl-${OPENSSL_VERSION}.tar.gz \ +# && cd openssl-${OPENSSL_VERSION} \ +# && ./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl shared zlib \ +# && make \ +# && make install \ +# && touch /etc/ld.so.conf.d/openssl-${OPENSSL_VERSION}.conf \ +# && echo "/usr/local/ssl/lib64" >> /etc/ld.so.conf.d/openssl-${OPENSSL_VERSION}.conf \ +# && ldconfig \ +# && mv /usr/local/ssl/bin/c_rehash /usr/bin/c_rehash \ +# && mv /usr/local/ssl/bin/openssl /usr/bin/openssl \ +# && rm -rf /tmp/openssl ## Black