diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index e3cf9b9c..ddfadc4c 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -202,45 +202,24 @@ jobs: # NOTE: This job uses a fixed Qt version (set in the 'qt-version' key below)! # So, remember to keep it updated whenever a new Qt version is available on aqtinstall. appimage-aqtinstall: - name: AppImage (${{ matrix.build-type }}, Qt ${{ matrix.qt-version }}, ${{ matrix.container != '' && matrix.container || matrix.os }}) + name: AppImage (${{ matrix.build-type }}, Qt ${{ matrix.qt-version }}, ${{ matrix.image }}) runs-on: ${{ matrix.os }} - container: ${{ matrix.container }} + container: + image: zjeffer/notes:${{ matrix.image }} strategy: fail-fast: false matrix: include: - - os: ubuntu-20.04 - container: ubuntu:20.04 + - os: ubuntu-22.04 build-type: release qt-version: 5.15.2 - - - os: ubuntu-20.04 - container: ubuntu:20.04 + image: ubuntu-aqtinstall-5 + + - os: ubuntu-22.04 build-type: release qt-version: 6.4.3 + image: ubuntu-aqtinstall-6 steps: - - name: Install other dependencies in docker container - # - appstream: Used to validate the AppStream metadata file. - # - cmake: Used to help build the application. - # - curl: Used to download the linuxdeploy AppImage tool. - # - desktop-file-utils: Used to validate the desktop file. - # - git: To clone this repository. - # - libfontconfig1: Used as dependency of the resulting AppImage. - # - libxcb-cursor0: Used as dependency of the resulting AppImage. - # - libxkbcommon-x11-0: Used as dependency of the resulting AppImage. - # - python3/python3-pip: Used by aqtinstall. - # - sudo: Used by most GitHub actions to install things. - if: matrix.container != '' - run: | - # Configure the timezone, otherwise 'install-qt-action' gets stuck at 'configuring tzdata'. - ln -sf /usr/share/zoneinfo/UTC /etc/localtime - echo UTC > /etc/timezone - # install packages - apt update - apt install -y appstream cmake curl desktop-file-utils git libfontconfig1 libxcb-cursor0 libxkbcommon-x11-0 python3 python3-pip sudo - # Upgrade to the latest setuptools, as Ubuntu's python3-setuptools package has compatibility issues with aqtinstall. - python3 -m pip install --upgrade setuptools - - name: Checkout code uses: actions/checkout@v3 with: @@ -272,21 +251,6 @@ jobs: echo "artifact_name=${artifact_name}" >> "${GITHUB_OUTPUT}" echo "file_name=${file_name}" >> "${GITHUB_OUTPUT}" - - name: Install Qt ${{ matrix.qt-version }} (aqtinstall) - uses: jurplel/install-qt-action@v3 - with: - version: ${{ matrix.qt-version }} - # Prevents the installation of a custom Python build, potentially linked against an unsupported version of glibc. - setup-python: false - cache: true - - - name: Install Qt 6 system dependencies - # 'libmysqlclient21' is actually only needed by linuxdeploy for Qt 6 builds. I'm including it here just for convenience. - if: startsWith(matrix.qt-version, '6.') - run: | - sudo apt update - sudo apt install -y libxkbcommon-dev libmysqlclient21 - # TODO: Figure out why this error only occurs on the Linux container when building with -DGIT_REVISION=ON # The error: fatal: detected dubious ownership in repository - name: Prevent git's dubious ownership message @@ -327,12 +291,6 @@ jobs: curl -fLO --retry 10 https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage chmod +x linuxdeploy-plugin-qt-x86_64.AppImage - - name: Install useless dependencies to make linuxdeploy happy - # We won't use any of these sql drivers, but install them anyway so linuxdeploy doesn't fail. - run: | - sudo apt update - sudo apt install -y libpq5 libodbc1 - - name: Deploy (${{ matrix.build-type }}) env: APPIMAGE_EXTRACT_AND_RUN: 1 @@ -363,7 +321,7 @@ jobs: fi - name: Validate AppStream metadata - if: matrix.container != 'ubuntu:20.04' + if: matrix.image != 'ubuntu:20.04' run: | cd build/Notes appstreamcli validate --verbose 'usr/share/metainfo/${{ env.APP_ID }}.metainfo.xml' diff --git a/Dockerfiles/README.md b/Dockerfiles/README.md new file mode 100644 index 00000000..8f7f88c7 --- /dev/null +++ b/Dockerfiles/README.md @@ -0,0 +1,17 @@ +# Docker images for CI/CD + +The Dockerfiles in this folder are used to build images for CI/CD pipelines. + +### Building images locally + +```bash +docker build -f -t . +# for example: +docker build -f ./ubuntu-aqtinstall-6 -t zjeffer:notes/ubuntu-aqtinstall-6.4.3 . +``` + +### Pushing images to Docker Hub + +```bash +docker push +``` diff --git a/Dockerfiles/ubuntu-aqtinstall-5 b/Dockerfiles/ubuntu-aqtinstall-5 new file mode 100644 index 00000000..cd4ef3e0 --- /dev/null +++ b/Dockerfiles/ubuntu-aqtinstall-5 @@ -0,0 +1,37 @@ +FROM ubuntu:22.04 + +ENV QT_VERSION=5.15.2 +ENV QT_ARCHITECTURE=gcc_64 + +# this image can also be used for appimage builds +# Configure the timezone, otherwise 'install-qt-action' gets stuck at 'configuring tzdata'. +RUN ln -sf /usr/share/zoneinfo/UTC /etc/localtime \ + && echo UTC > /etc/timezone + +# install packages +# - appstream: Used to validate the AppStream metadata file. +# - cmake: Used to help build the application. +# - curl: Used to download the linuxdeploy AppImage tool. +# - desktop-file-utils: Used to validate the desktop file. +# - git: To clone this repository. +# - libfontconfig1: Used as dependency of the resulting AppImage. +# - libxcb-cursor0: Used as dependency of the resulting AppImage. +# - libxkbcommon-x11-0: Used as dependency of the resulting AppImage. +# - python3/python3-pip: Used by aqtinstall. +# - sudo: Used by most GitHub actions to install things. +# - libpq5: Useless, but needed to keep linuxdeploy happy +# - libodbc1: Useless, but needed to keep linuxdeploy happy +# - file: Necessary for building the AppImage +RUN apt update && \ + apt install -y appstream cmake curl desktop-file-utils git libfontconfig1 libxcb-cursor0 libxkbcommon-x11-0 python3 python3-pip sudo \ + libpq5 libodbc1 file \ + # qt dependencies + build-essential libgl1-mesa-dev libgstreamer-gl1.0-0 libpulse-dev libxcb-glx0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 \ + libxcb-render-util0 libxcb-render0 libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcb-util1 libxcb-xfixes0 libxcb-xinerama0 libxcb1 libxkbcommon-dev libxkbcommon-x11-0 libxcb-xkb-dev \ + libqt5network5 libqt5sql5 libqt5widgets5 qml-module-qtquick2 qml-module-qtquick-controls2 qml-module-qtquick-window2 + +RUN python3 -m pip install --upgrade pip setuptools aqtinstall + +# use aqtinstall to install qt +RUN python3 -m aqt install-qt --outputdir /Qt linux desktop $QT_VERSION $QT_ARCHITECTURE +ENV PATH="/Qt/$QT_VERSION/$QT_ARCHITECTURE/bin:$PATH" diff --git a/Dockerfiles/ubuntu-aqtinstall-6 b/Dockerfiles/ubuntu-aqtinstall-6 new file mode 100644 index 00000000..09ac4b15 --- /dev/null +++ b/Dockerfiles/ubuntu-aqtinstall-6 @@ -0,0 +1,40 @@ +FROM ubuntu:22.04 + +ENV QT_VERSION=6.4.3 +ENV QT_ARCHITECTURE=gcc_64 + +# this image can also be used for appimage builds +# Configure the timezone, otherwise 'install-qt-action' gets stuck at 'configuring tzdata'. +RUN ln -sf /usr/share/zoneinfo/UTC /etc/localtime \ + && echo UTC > /etc/timezone + +# install packages +# - appstream: Used to validate the AppStream metadata file. +# - cmake: Used to help build the application. +# - curl: Used to download the linuxdeploy AppImage tool. +# - desktop-file-utils: Used to validate the desktop file. +# - git: To clone this repository. +# - libfontconfig1: Used as dependency of the resulting AppImage. +# - libxcb-cursor0: Used as dependency of the resulting AppImage. +# - libxkbcommon-x11-0: Used as dependency of the resulting AppImage. +# - python3/python3-pip: Used by aqtinstall. +# - sudo: Used by most GitHub actions to install things. +# - libpq5: Useless, but needed to keep linuxdeploy happy +# - libodbc1: Useless, but needed to keep linuxdeploy happy +# - file: Necessary for building the AppImage +RUN apt update && \ + apt install -y appstream cmake curl desktop-file-utils git libfontconfig1 libxcb-cursor0 libxkbcommon-x11-0 python3 python3-pip sudo \ + libpq5 libodbc1 file \ + # qt dependencies + build-essential libgl1-mesa-dev libgstreamer-gl1.0-0 libpulse-dev libxcb-glx0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 \ + libxcb-render-util0 libxcb-render0 libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcb-util1 libxcb-xfixes0 libxcb-xinerama0 libxcb1 libxkbcommon-dev libxkbcommon-x11-0 libxcb-xkb-dev \ + libqt6network6 libqt6sql6 libqt6widgets6 qml6-module-qtqml-workerscript qml6-module-qtquick-controls qml6-module-qtquick-layouts qml6-module-qtquick-particles qml6-module-qtquick-templates qml6-module-qtquick-window qt6-qpa-plugins + +RUN python3 -m pip install --upgrade pip setuptools aqtinstall + +# qt6 dependencies +RUN apt install -y libxkbcommon-dev libmysqlclient21 + +# use aqtinstall to install qt +RUN python3 -m aqt install-qt --outputdir /Qt linux desktop $QT_VERSION $QT_ARCHITECTURE +ENV PATH="/Qt/$QT_VERSION/$QT_ARCHITECTURE/bin:$PATH"