From 8c641402207dcee2f17de6f18c463a40b6434847 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sun, 24 Nov 2019 13:35:09 -0800 Subject: GitHub Actions: add two stage MXE container build Based on ideas from Anton - both the basic building of containers in the first place as well as the workaround for the 6h build limit. Because GitHub Actions are limited to 6 hours we split the creation of the MXE container into two steps and push the intermediary container after stage 1 to docker hub. Right now each of the steps takes about 3.5 hours, so hopefully even with changes in the future this will continue to work. This commit also introduces use of docker hub instead of GitHub's own registry (since strangely right now GitHub actions cannot run containers from GitHub's private registry). In order for this to work, we need to have the docker credentials in secrets in GitHub. As a result, only people who can create branches in our repository can easily test changes to the container images. Others can modify the code to use a different docker hub account and provide those secrets in their own GitHub account. Not ideal, but of course we cannot allow every pull request to potentially overwrite docker images in our "official" docker hub account. Suggested-by: Anton Lundin Signed-off-by: Dirk Hohndel --- scripts/docker/mxe-build-container/Dockerfile | 60 ---------------------- .../docker/mxe-build-container/Dockerfile-stage1 | 58 +++++++++++++++++++++ .../docker/mxe-build-container/Dockerfile-stage2 | 21 ++++++++ .../docker/mxe-build-container/settings-stage1.mk | 15 ++++++ .../docker/mxe-build-container/settings-stage2.mk | 15 ++++++ scripts/docker/mxe-build-container/settings.mk | 15 ------ 6 files changed, 109 insertions(+), 75 deletions(-) delete mode 100644 scripts/docker/mxe-build-container/Dockerfile create mode 100644 scripts/docker/mxe-build-container/Dockerfile-stage1 create mode 100644 scripts/docker/mxe-build-container/Dockerfile-stage2 create mode 100644 scripts/docker/mxe-build-container/settings-stage1.mk create mode 100644 scripts/docker/mxe-build-container/settings-stage2.mk delete mode 100644 scripts/docker/mxe-build-container/settings.mk (limited to 'scripts/docker') diff --git a/scripts/docker/mxe-build-container/Dockerfile b/scripts/docker/mxe-build-container/Dockerfile deleted file mode 100644 index b9def62bc..000000000 --- a/scripts/docker/mxe-build-container/Dockerfile +++ /dev/null @@ -1,60 +0,0 @@ -# Build the image using the --build-arg option, e.g.: -# docker build -t boret/myimage:0.1 --build-arg=mxe_sha=123ABC456 . -# - -From ubuntu:18.04 -ARG mxe_sha=master -ENV _ver=${mxe_sha} -RUN mkdir -p /win -ADD settings.mk /win -RUN apt-get update && apt-get upgrade -y -RUN apt-get install -y \ - autoconf \ - automake \ - autopoint \ - bash \ - binutils \ - bison \ - bzip2 \ - flex \ - g++ \ - g++-multilib \ - gettext \ - git \ - gperf \ - intltool \ - libc6-dev-i386 \ - libgdk-pixbuf2.0-dev \ - libltdl-dev \ - libssl-dev \ - libtool-bin \ - libxml-parser-perl \ - make \ - openssl \ - p7zip-full \ - patch \ - perl \ - pkg-config \ - python \ - ruby \ - sed \ - unzip \ - wget \ - xz-utils \ - lzip \ - scons -RUN cd /win ; git clone git://github.com/mxe/mxe ; \ - cd mxe ; \ - git checkout ${_ver} ; -RUN mv /win/settings.mk /win/mxe -RUN cd /win/mxe ; \ - make -j 6 2>&1 | tee build.log ; -RUN cd /win/mxe ; \ - make MXE_TARGETS=i686-w64-mingw32.static glib -j 6 2>&1 | tee -a build.log ; -RUN cd /win/mxe ; \ - mkdir -p neolit ; cd neolit ; git clone -b wip/win git://github.com/qt/qtconnectivity -RUN cd /win/mxe/neolit/qtconnectivity ; \ - PATH=/win/mxe/usr/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin /win/mxe/usr/i686-w64-mingw32.shared/qt5/bin/qmake qtconnectivity.pro ; \ - PATH=/win/mxe/usr/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin make -j 6 ; \ - PATH=/win/mxe/usr/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin make install ; -RUN rm -rf /win/mxe/pkg diff --git a/scripts/docker/mxe-build-container/Dockerfile-stage1 b/scripts/docker/mxe-build-container/Dockerfile-stage1 new file mode 100644 index 000000000..501bfe6ce --- /dev/null +++ b/scripts/docker/mxe-build-container/Dockerfile-stage1 @@ -0,0 +1,58 @@ +# Build the image using the --build-arg option, e.g.: +# docker build -t boret/myimage:0.1 --build-arg=mxe_sha=123ABC456 . +# + +# Start from Ubuntu +From ubuntu:18.04 +ARG mxe_sha=master +ENV _ver=${mxe_sha} + +# update and set up the packages we need for this cross build +RUN apt-get update && apt-get upgrade -y +RUN apt-get install -y \ + autoconf \ + automake \ + autopoint \ + bash \ + binutils \ + bison \ + bzip2 \ + flex \ + g++ \ + g++-multilib \ + gettext \ + git \ + gperf \ + intltool \ + libc6-dev-i386 \ + libgdk-pixbuf2.0-dev \ + libltdl-dev \ + libssl-dev \ + libtool-bin \ + libxml-parser-perl \ + make \ + openssl \ + p7zip-full \ + patch \ + perl \ + pkg-config \ + python \ + ruby \ + sed \ + unzip \ + wget \ + xz-utils \ + lzip \ + scons + +# copy over the partial MXE settings (simply missing QtWebKit so we don't exceed the 6h limit) +RUN mkdir -p /win +ADD settings-stage1.mk /win/settings.mk +RUN cd /win ; git clone git://github.com/mxe/mxe ; \ + cd mxe ; \ + git checkout ${_ver} ; +RUN mv /win/settings.mk /win/mxe +RUN cd /win/mxe ; \ + make -j 6 2>&1 | tee build.log ; +RUN cd /win/mxe ; \ + make MXE_TARGETS=i686-w64-mingw32.static glib -j 6 2>&1 | tee -a build.log ; diff --git a/scripts/docker/mxe-build-container/Dockerfile-stage2 b/scripts/docker/mxe-build-container/Dockerfile-stage2 new file mode 100644 index 000000000..a9ae812a5 --- /dev/null +++ b/scripts/docker/mxe-build-container/Dockerfile-stage2 @@ -0,0 +1,21 @@ +ARG VERSION + +# Start from the container that we created in stage 1 +From subsurface/mxe-build-container:$VERSION + +# this time the settings include QtWebKit - since everything else was built +# during the first stage, QtWebKit will be the only thing that gets built +ADD settings-stage2.mk /win/mxe/settings.mk +RUN cd /win/mxe ; \ + make -j 2 2>&1 | tee build.log ; +RUN cd /win/mxe ; \ + make MXE_TARGETS=i686-w64-mingw32.static glib -j 6 2>&1 | tee -a build.log ; + +# manually build the Win BLE version of QtConnectivity (we can drop this with Qt 5.14) +RUN cd /win/mxe ; \ + mkdir -p neolit ; cd neolit ; git clone -b wip/win git://github.com/qt/qtconnectivity +RUN cd /win/mxe/neolit/qtconnectivity ; \ + PATH=/win/mxe/usr/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin /win/mxe/usr/i686-w64-mingw32.shared/qt5/bin/qmake qtconnectivity.pro ; \ + PATH=/win/mxe/usr/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin make -j 6 ; \ + PATH=/win/mxe/usr/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin make install ; +RUN rm -rf /win/mxe/pkg diff --git a/scripts/docker/mxe-build-container/settings-stage1.mk b/scripts/docker/mxe-build-container/settings-stage1.mk new file mode 100644 index 000000000..5563f259a --- /dev/null +++ b/scripts/docker/mxe-build-container/settings-stage1.mk @@ -0,0 +1,15 @@ +# This is a template of configuration file for MXE. See +# index.html for more extensive documentations. + +# This variable controls the number of compilation processes +# within one package ("intra-package parallelism"). +JOBS := 2 + +# This variable controls the targets that will build. +MXE_TARGETS := i686-w64-mingw32.shared + +# The three lines below makes `make` build these "local packages" instead of all packages. +LOCAL_PKG_LIST := qtbase qtconnectivity qtdeclarative qtimageformats qtlocation qtmultimedia qtquickcontrols qtquickcontrols2 qtscript qtsvg qttools qttranslations qtwebview libxml2 libxslt libusb1 libgit2 nsis curl libzip libftdi1 +.DEFAULT local-pkg-list: +local-pkg-list: $(LOCAL_PKG_LIST) + diff --git a/scripts/docker/mxe-build-container/settings-stage2.mk b/scripts/docker/mxe-build-container/settings-stage2.mk new file mode 100644 index 000000000..452961338 --- /dev/null +++ b/scripts/docker/mxe-build-container/settings-stage2.mk @@ -0,0 +1,15 @@ +# This is a template of configuration file for MXE. See +# index.html for more extensive documentations. + +# This variable controls the number of compilation processes +# within one package ("intra-package parallelism"). +JOBS := 2 + +# This variable controls the targets that will build. +MXE_TARGETS := i686-w64-mingw32.shared + +# The three lines below makes `make` build these "local packages" instead of all packages. +LOCAL_PKG_LIST := qtbase qtconnectivity qtdeclarative qtimageformats qtlocation qtmultimedia qtquickcontrols qtquickcontrols2 qtscript qtsvg qttools qttranslations qtwebview qtwebkit libxml2 libxslt libusb1 libgit2 nsis curl libzip libftdi1 +.DEFAULT local-pkg-list: +local-pkg-list: $(LOCAL_PKG_LIST) + diff --git a/scripts/docker/mxe-build-container/settings.mk b/scripts/docker/mxe-build-container/settings.mk deleted file mode 100644 index aadfc4c6f..000000000 --- a/scripts/docker/mxe-build-container/settings.mk +++ /dev/null @@ -1,15 +0,0 @@ -# This is a template of configuration file for MXE. See -# index.html for more extensive documentations. - -# This variable controls the number of compilation processes -# within one package ("intra-package parallelism"). -JOBS := 6 - -# This variable controls the targets that will build. -MXE_TARGETS := i686-w64-mingw32.shared - -# The three lines below makes `make` build these "local packages" instead of all packages. -LOCAL_PKG_LIST := qtbase qtconnectivity qtdeclarative qtimageformats qtlocation qtmultimedia qtquickcontrols qtquickcontrols2 qtscript qtsvg qttools qttranslations qtwebview qtwebkit libxml2 libxslt libusb1 libgit2 nsis curl libzip libftdi1 -.DEFAULT local-pkg-list: -local-pkg-list: $(LOCAL_PKG_LIST) - -- cgit v1.2.3-70-g09d2