Skip to content

Commit

Permalink
Switch to earthly build process
Browse files Browse the repository at this point in the history
  • Loading branch information
parnham committed May 5, 2021
1 parent fafc405 commit 8d998ed
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 140 deletions.
145 changes: 25 additions & 120 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,166 +2,71 @@ stages:
- build
- deploy


build-check:
image: emergent:xenial
stage: build
rules:
- if: $CI_COMMIT_BRANCH == "master"
before_script:
- dpkg -i /packages/xenial/oss/libemergent-dev.deb
script:
- premake5 gmake
- make -j4

- earthly +build

build-bionic:
image: emergent:bionic
stage: build
rules: [ when: never ]
before_script:
- dpkg -i /packages/bionic/oss/libemergent-dev.deb
script:
- premake5 gmake
- make -j16
- cp lib/libpsinc.so /packages/bionic/oss/
- cp lib/libpsinc.so.dbg /packages/bionic/oss/

package-xenial:
image: emergent:xenial
package-bionic:
stage: build
rules:
- if: $CI_COMMIT_TAG
before_script:
- dpkg -i /packages/xenial/oss/libemergent-dev.deb
script:
- premake5 gmake
- make -j4
- cd packages
- ./build xenial
- mkdir -p /packages/xenial/oss/
- cp libpsinc-dev_*.deb /packages/xenial/oss/libpsinc-dev.deb
- cp libpsinc0_*.deb /packages/xenial/oss/libpsinc0.deb
- earthly +package
artifacts:
paths:
- packages/*.deb
- build/libpsinc*.deb

package-bionic:
image: emergent:bionic
package-focal:
stage: build
rules:
- if: $CI_COMMIT_TAG
before_script:
- dpkg -i /packages/bionic/oss/libemergent-dev.deb
script:
- premake5 gmake
- make -j4
- cd packages
- ./build bionic
- mkdir -p /packages/bionic/oss/
- cp libpsinc-dev_*.deb /packages/bionic/oss/libpsinc-dev.deb
- cp libpsinc0_*.deb /packages/bionic/oss/libpsinc0.deb
- earthly --build-arg DISTRIBUTION=focal +package
artifacts:
paths:
- build/libpsinc*.deb

package-focal:
image: emergent:focal
package-windows:
stage: build
rules:
- if: $CI_COMMIT_TAG
before_script:
- dpkg -i /packages/focal/oss/libemergent-dev.deb
script:
- premake5 gmake
- make -j4
- cd packages
- ./build focal
- mkdir -p /packages/focal/oss/
- cp libpsinc-dev_*.deb /packages/focal/oss/libpsinc-dev.deb
- cp libpsinc0_*.deb /packages/focal/oss/libpsinc0.deb

- earthly +windows
artifacts:
paths:
- build/windows/*.7z

package-windows:
image: emergent:windows
package-appimage:
stage: build
rules:
- if: $CI_COMMIT_TAG
before_script:
- dpkg -i /packages/focal/oss/libemergent-dev.deb
- ln -s /usr/include/emergent /usr/x86_64-w64-mingw32/include/
- if: $CI_PIPELINE_SOURCE == "web"
script:
- premake5 --os=windows gmake
- make CXX=x86_64-w64-mingw32-g++ -j4
- PATH=/opt/qt5-win-x64/bin:$PATH qmake -spec win32-g++ -o iconograph.make iconograph.pro
- make -f iconograph.make -j4
- cd packages
- ./windows
- mkdir -p /packages/windows/oss/
- cp libpsinc-*.7z /packages/windows/oss/libpsinc.7z
# - cp iconograph-*.7z /packages/windows/oss/iconograph.7z
- earthly +appimage
artifacts:
paths:
- packages/*.7z
- build/*.AppImage

deploy-packages:
image: emergent:deploy
stage: deploy
rules:
- if: $CI_COMMIT_TAG
dependencies:
- package-xenial
- package-bionic
- package-focal
- package-windows
before_script:
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
script:
- cd packages
- scp *.deb gitlab@downloads.emergent-design.co.uk:/srv/downloads/libpsinc/ubuntu/
- scp *.7z gitlab@downloads.emergent-design.co.uk:/srv/downloads/libpsinc/windows/
- scp build/*.deb $DEPLOY_DOWNLOADS/libpsinc/ubuntu/
- scp build/windows/*.7z $DEPLOY_DOWNLOADS/libpsinc/windows/

deploy-phi:
image: emergent:deploy
stage: deploy
rules:
- if: $CI_COMMIT_TAG
needs: [ package-bionic, package-focal ]
before_script:
- eval $(ssh-agent -s)
- echo "$SSH_PHI_KEY" | tr -d '\r' | ssh-add - > /dev/null
- echo "$SSH_PHI_KNOWN" > ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
script:
- phi-deploy /packages/bionic/oss/libpsinc0.deb bionic oss
- phi-deploy /packages/focal/oss/libpsinc0.deb focal oss

package-appimage:
image: emergent:xenial
stage: build
rules:
- if: $CI_PIPELINE_SOURCE == "web"
before_script:
- dpkg -i /packages/xenial/oss/libemergent-dev.deb
script:
- premake5 gmake
- make -j4
- qmake -o iconograph.make CONFIG+=release iconograph.pro
- make -f iconograph.make -j4
- mkdir -p packages/appdir/usr/bin
- mkdir -p packages/appdir/usr/lib
- cp bin/iconograph packages/appdir/usr/bin/
- cp lib/libpsinc.so packages/appdir/usr/lib/libpsinc.so.0
- cd packages
# - wget -c -nv "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage"
# - chmod a+x linuxdeployqt-continuous-x86_64.AppImage
# - ./linuxdeployqt-continuous-x86_64.AppImage --appimage-extract
- curl -sOJL "https://github.com/probonopd/linuxdeployqt/releases/download/6/linuxdeployqt-6-x86_64.AppImage"
- chmod a+x linuxdeployqt-6-x86_64.AppImage
- ./linuxdeployqt-6-x86_64.AppImage --appimage-extract
- unset QTDIR; unset QT_PLUGIN_PATH; unset LD_LIBRARY_PATH
- squashfs-root/usr/bin/linuxdeployqt appdir/usr/share/applications/iconograph.desktop -bundle-non-qt-libs
- squashfs-root/usr/bin/linuxdeployqt appdir/usr/share/applications/iconograph.desktop -appimage
- cp *.AppImage /packages/xenial/oss/
artifacts:
paths:
- packages/*.AppImage
- phi-deploy build/libpsinc0*~bionic_amd64.deb bionic oss
- phi-deploy build/libpsinc0*~focal_amd64.deb focal oss
28 changes: 8 additions & 20 deletions Earthfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@

xenial:
FROM ubuntu:16.04
# configure apt to be noninteractive
ENV DEBIAN_FRONTEND noninteractive
ENV DEBCONF_NONINTERACTIVE_SEEN true
WORKDIR /code

bionic:
FROM ubuntu:18.04
# configure apt to be noninteractive
Expand All @@ -30,7 +22,7 @@ image:
deps:
FROM +image
ARG GITHUB_EMERGENT=github.com/emergent-design
COPY $GITHUB_EMERGENT/libemergent+package/libemergent-dev.deb .
COPY $GITHUB_EMERGENT/libemergent:v0.0.31+package/libemergent-dev.deb .
RUN dpkg -i libemergent-dev.deb

build:
Expand All @@ -44,30 +36,26 @@ package:
RUN cd packages && ./build $DISTRIBUTION
SAVE ARTIFACT packages/libpsinc-dev_*.deb libpsinc-dev.deb
SAVE ARTIFACT packages/libpsinc0_*.deb libpsinc0.deb
SAVE ARTIFACT packages/libpsinc*.deb AS LOCAL build/

all:
BUILD --build-arg DISTRIBUTION=bionic +package
BUILD --build-arg DISTRIBUTION=focal +package

#deploy:


appimage:
FROM --build-arg DISTRIBUTION=xenial +build
# Install slightly newer Qt using the kubuntu backports
RUN apt-get install -y software-properties-common \
&& add-apt-repository -y ppa:kubuntu-ppa/backports && apt-get update \
&& apt-get install -y --no-install-recommends qtbase5-dev qt5-default libqt5serialport5-dev
FROM --build-arg DISTRIBUTION=bionic +build
RUN apt-get update && apt-get install -y --no-install-recommends qtbase5-dev qt5-default libqt5serialport5-dev file
COPY --dir resources ui iconograph.pro .
RUN qmake -o iconograph.make CONFIG+=release iconograph.pro \
&& make -f iconograph.make -j$(nproc)
RUN mkdir -p packages/appdir/usr/bin packages/appdir/usr/lib \
&& cp bin/iconograph packages/appdir/usr/bin/ \
&& cp lib/libpsinc.so packages/appdir/usr/lib/libpsinc.so.0
RUN cd packages \
&& curl -sOJL "https://github.com/probonopd/linuxdeployqt/releases/download/7/linuxdeployqt-7-x86_64.AppImage" \
&& chmod a+x linuxdeployqt-7-x86_64.AppImage \
&& ./linuxdeployqt-7-x86_64.AppImage --appimage-extract \
&& curl -sJL "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage" -o linuxdeployqt.AppImage \
&& chmod a+x linuxdeployqt.AppImage \
&& ./linuxdeployqt.AppImage --appimage-extract \
&& unset QTDIR; unset QT_PLUGIN_PATH; unset LD_LIBRARY_PATH \
&& squashfs-root/usr/bin/linuxdeployqt appdir/usr/share/applications/iconograph.desktop -bundle-non-qt-libs \
&& squashfs-root/usr/bin/linuxdeployqt appdir/usr/share/applications/iconograph.desktop -appimage
Expand Down Expand Up @@ -115,7 +103,7 @@ windows:
FROM +mingw
# Dependencies
ARG GITHUB_EMERGENT=github.com/emergent-design
COPY $GITHUB_EMERGENT/libemergent+package/libemergent-dev.deb .
COPY $GITHUB_EMERGENT/libemergent:v0.0.31+package/libemergent-dev.deb .
RUN dpkg -i libemergent-dev.deb && ln -s /usr/include/emergent /usr/x86_64-w64-mingw32/include/
# Build lib
COPY --dir include packages src resources ui iconograph.pro premake5.lua .
Expand Down

0 comments on commit 8d998ed

Please sign in to comment.