Merge pull request #522 from kiwix/fix_ci

This commit is contained in:
Matthieu Gautier 2022-03-11 16:57:11 +01:00 committed by GitHub
commit 077be3b035
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 179 additions and 70 deletions

View File

@ -30,7 +30,7 @@ RUN apt update -q \
# vim less grep \ # vim less grep \
&& apt-get clean -y \ && apt-get clean -y \
&& rm -rf /var/lib/apt/lists/* /usr/share/doc/* /var/cache/debconf/* \ && rm -rf /var/lib/apt/lists/* /usr/share/doc/* /var/cache/debconf/* \
&& pip3 install meson==0.52.1 pytest gcovr requests distro && pip3 install meson pytest gcovr requests distro
# Create user # Create user
RUN useradd --create-home runner RUN useradd --create-home runner

View File

@ -1,7 +1,7 @@
FROM fedora:31 FROM fedora:35
ENV LANG C.UTF-8 ENV LANG C.UTF-8
ENV OS_NAME f31 ENV OS_NAME f35
RUN dnf install -y --nodocs \ RUN dnf install -y --nodocs \
# Base build tools # Base build tools
@ -19,7 +19,7 @@ RUN dnf install -y --nodocs \
&& dnf remove -y "*-doc" \ && dnf remove -y "*-doc" \
&& dnf autoremove -y \ && dnf autoremove -y \
&& dnf clean all \ && dnf clean all \
&& pip3 install meson==0.52.1 pytest requests distro && pip3 install meson pytest requests distro
# Create user # Create user
RUN useradd --create-home runner RUN useradd --create-home runner

View File

@ -25,7 +25,7 @@ RUN apt update -q \
# vim less grep \ # vim less grep \
&& apt-get clean -y \ && apt-get clean -y \
&& rm -rf /var/lib/apt/lists/* /usr/share/doc/* /var/cache/debconf/* \ && rm -rf /var/lib/apt/lists/* /usr/share/doc/* /var/cache/debconf/* \
&& pip3 install meson==0.52.1 pytest gcovr requests distro && pip3 install meson pytest gcovr requests distro
# Create user # Create user
RUN useradd --create-home runner RUN useradd --create-home runner

View File

@ -1,30 +0,0 @@
FROM ubuntu:xenial
ENV LANG C.UTF-8
ENV OS_NAME xenial
RUN apt update -q \
&& dpkg --add-architecture i386 \
&& apt install -q -y --no-install-recommends \
# Base build tools
build-essential automake libtool cmake ccache pkg-config autopoint patch \
python3-pip python3-setuptools python3-wheel git subversion wget unzip \
ninja-build openssh-client curl \
# Python (2) is needed to install android-ndk
python \
# Packaged dependencies
libbz2-dev libmagic-dev uuid-dev zlib1g-dev default-jdk \
libmicrohttpd-dev libgtest-dev \
# Cross compile i586
libc6-dev-i386 lib32stdc++6 gcc-multilib g++-multilib \
# Other tools (to remove)
# vim less grep \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/* /usr/share/doc/* /var/cache/debconf/* \
&& pip3 install meson==0.52.1 pytest 'markupsafe<2.0.0' 'jinja2<3.0.0' 'gcovr<5.0' requests distro
# Create user
RUN useradd --create-home runner
USER runner
WORKDIR /home/runner
ENV PATH /home/runner/.local/bin:$PATH

47
.github/scripts/build_projects.py vendored Executable file
View File

@ -0,0 +1,47 @@
#!/usr/bin/env python3
from common import (
run_kiwix_build,
make_archive,
create_desktop_image,
fix_macos_rpath,
OS_NAME,
PLATFORM_TARGET,
DESKTOP,
notarize_macos_build,
)
if PLATFORM_TARGET.startswith("android_"):
TARGETS = ("libkiwix",)
elif PLATFORM_TARGET.startswith("iOS") or PLATFORM_TARGET.startswith("macOS"):
TARGETS = ("libzim", "libkiwix")
elif PLATFORM_TARGET.startswith("native_"):
if OS_NAME == "osx":
if PLATFORM_TARGET == "native_mixed":
TARGETS = ("libzim", )
else:
TARGETS = ("libzim", "zim-tools", "libkiwix")
else:
if DESKTOP:
TARGETS = ("kiwix-desktop",)
elif PLATFORM_TARGET == "native_mixed":
TARGETS = ("libzim",)
else:
TARGETS = ("zim-tools", "libkiwix", "kiwix-tools")
elif PLATFORM_TARGET in ("win32_static", "armhf_static", "armhf_dyn", "i586_static"):
TARGETS = ("kiwix-tools",)
elif PLATFORM_TARGET == "flatpak":
TARGETS = ("kiwix-desktop",)
else:
TARGETS = ("libzim", "zim-tools", "libkiwix", "kiwix-tools")
for target in TARGETS:
run_kiwix_build(target, platform=PLATFORM_TARGET)
if target == "kiwix-desktop":
create_desktop_image(make_release=False)
else:
if PLATFORM_TARGET == "native_mixed" and OS_NAME == "osx":
fix_macos_rpath(target)
notarize_macos_build(target)
make_archive(target, make_release=False)

View File

@ -33,7 +33,7 @@ def download_base_archive(base_name):
ARCHIVE_NAME_TEMPLATE = "base_deps2_{os}_{platform}_{version}.tar.xz" ARCHIVE_NAME_TEMPLATE = "base_deps2_{os}_{platform}_{version}.tar.xz"
if PLATFORM_TARGET == 'flatpak': if PLATFORM_TARGET == 'flatpak':
base_dep_archive_name = "base_deps2_{}_flatpak.tar.xz".format(OS_NAME) base_dep_archive_name = "base_deps2_flatpak.tar.xz"
else: else:
base_dep_archive_name = ARCHIVE_NAME_TEMPLATE.format( base_dep_archive_name = ARCHIVE_NAME_TEMPLATE.format(
os=OS_NAME, os=OS_NAME,

View File

@ -6,14 +6,14 @@ on:
- cron: '0 1 * * *' - cron: '0 1 * * *'
env: env:
DOCKER_VERSION: 31 DOCKER_VERSION: 32
jobs: jobs:
Docker: Docker:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
variant: [xenial, bionic, f31, focal] variant: [bionic, f35, focal]
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -46,27 +46,23 @@ jobs:
- android_arm64 - android_arm64
- android_x86 - android_x86
- android_x86_64 - android_x86_64
image_variant: ['xenial', 'bionic'] image_variant: ['bionic']
lib_postfix: ['/x86_64-linux-gnu'] lib_postfix: ['/x86_64-linux-gnu']
include: include:
- target: win32_static - target: win32_static
image_variant: f31 image_variant: f35
lib_postfix: '64' lib_postfix: '64'
- target: win32_dyn - target: win32_dyn
image_variant: f31 image_variant: f35
lib_postfix: '64' lib_postfix: '64'
exclude:
- target: native_desktop
image_variant: xenial
- target: native_static
image_variant: bionic
env: env:
HOME: /home/runner HOME: /home/runner
SSH_KEY: /tmp/id_rsa SSH_KEY: /tmp/id_rsa
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: Docker needs: Docker
container: container:
image: "kiwix/kiwix-build_ci:${{matrix.image_variant}}-31" image: "kiwix/kiwix-build_ci:${{matrix.image_variant}}-32"
options: "--device /dev/fuse --privileged"
steps: steps:
- name: Checkout code - name: Checkout code
shell: bash shell: bash
@ -97,12 +93,61 @@ jobs:
kiwix-build/.github/scripts/compile_all_deps.py kiwix-build/.github/scripts/compile_all_deps.py
env: env:
PLATFORM_TARGET: ${{matrix.target}} PLATFORM_TARGET: ${{matrix.target}}
- name: Build projects
shell: bash
run: |
cd $HOME
kiwix-build/.github/scripts/build_projects.py
env:
PLATFORM_TARGET: ${{matrix.target}}
- name: Upload failure logs - name: Upload failure logs
if: failure() if: failure()
run: $HOME/kiwix-build/.github/scripts/upload_failure_logs.sh run: $HOME/kiwix-build/.github/scripts/upload_failure_logs.sh
env: env:
PLATFORM_TARGET: ${{matrix.target}} PLATFORM_TARGET: ${{matrix.target}}
Flatpak:
strategy:
fail-fast: false
env:
HOME: /home/runner
SSH_KEY: /tmp/id_rsa
PLATFORM_TARGET: flatpak
OS_NAME: focal
runs-on: ubuntu-latest
steps:
- name: Checkout code
shell: bash
run: |
cd $HOME
git clone https://github.com/${REP}
cd ./${REP##*/}
git checkout --force ${GITHUB_SHA}
pip3 install --user --no-deps .
env:
REP: ${{github.repository}}
- name: Install flatpak tools
run: |
sudo apt-get update
sudo apt-get install flatpak-builder ninja-build meson
- name: secret
shell: bash
run: |
echo "${{secrets.ssh_key}}" > $SSH_KEY
chmod 600 $SSH_KEY
- name: Ensure base deps
shell: bash
run: |
cd $HOME
kiwix-build/.github/scripts/ensure_base_deps.py
- name: Build projects
shell: bash
run: |
cd $HOME
kiwix-build/.github/scripts/build_projects.py
- name: Upload failure logs
if: failure()
run: $HOME/kiwix-build/.github/scripts/upload_failure_logs.sh
Macos: Macos:
strategy: strategy:
@ -132,7 +177,7 @@ jobs:
brew install pkg-config ninja automake autoconf brew install pkg-config ninja automake autoconf
- name: Install python modules - name: Install python modules
run: | run: |
pip3 install meson==0.52.1 pytest requests distro pip3 install meson pytest requests distro
pip3 install --no-deps $GITHUB_WORKSPACE pip3 install --no-deps $GITHUB_WORKSPACE
- name: secret - name: secret
shell: bash shell: bash
@ -153,6 +198,13 @@ jobs:
$GITHUB_WORKSPACE/.github/scripts/compile_all_deps.py $GITHUB_WORKSPACE/.github/scripts/compile_all_deps.py
env: env:
PLATFORM_TARGET: ${{matrix.target}} PLATFORM_TARGET: ${{matrix.target}}
- name: Build projects
shell: bash
run: |
cd $HOME
$GITHUB_WORKSPACE/.github/scripts/build_projects.py
env:
PLATFORM_TARGET: ${{matrix.target}}
- name: Upload failure logs - name: Upload failure logs
if: failure() if: failure()
run: $GITHUB_WORKSPACE/.github/scripts/upload_failure_logs.sh run: $GITHUB_WORKSPACE/.github/scripts/upload_failure_logs.sh

View File

@ -8,14 +8,14 @@ on:
- cron: '0 1 * * *' - cron: '0 1 * * *'
env: env:
DOCKER_VERSION: 31 DOCKER_VERSION: 32
jobs: jobs:
Docker: Docker:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
variant: [xenial, bionic, f31, focal] variant: [bionic, f35, focal]
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -44,33 +44,29 @@ jobs:
- win32_static - win32_static
- i586_static - i586_static
- android - android
- flatpak
include: include:
- target: native_static - target: native_static
image_variant: xenial image_variant: bionic
lib_postfix: '/x86_64-linux-gnu' lib_postfix: '/x86_64-linux-gnu'
- target: native_dyn - target: native_dyn
image_variant: xenial image_variant: bionic
lib_postfix: '/x86_64-linux-gnu' lib_postfix: '/x86_64-linux-gnu'
- target: native_mixed - target: native_mixed
image_variant: xenial image_variant: bionic
lib_postfix: '/x86_64-linux-gnu' lib_postfix: '/x86_64-linux-gnu'
- target: native_desktop - target: native_desktop
image_variant: bionic image_variant: bionic
lib_postfix: '/x86_64-linux-gnu' lib_postfix: '/x86_64-linux-gnu'
- target: armhf_static - target: armhf_static
image_variant: xenial image_variant: bionic
lib_postfix: '/x86_64-linux-gnu' lib_postfix: '/x86_64-linux-gnu'
- target: win32_static - target: win32_static
image_variant: f31 image_variant: f35
lib_postfix: '64' lib_postfix: '64'
- target: i586_static - target: i586_static
image_variant: xenial image_variant: bionic
lib_postfix: '/x86_64-linux-gnu' lib_postfix: '/x86_64-linux-gnu'
- target: android - target: android
image_variant: xenial
lib_postfix: '/x86_64-linux-gnu'
- target: flatpak
image_variant: bionic image_variant: bionic
lib_postfix: '/x86_64-linux-gnu' lib_postfix: '/x86_64-linux-gnu'
env: env:
@ -79,7 +75,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: Docker needs: Docker
container: container:
image: "kiwix/kiwix-build_ci:${{matrix.image_variant}}-31" image: "kiwix/kiwix-build_ci:${{matrix.image_variant}}-32"
options: "--device /dev/fuse --privileged" options: "--device /dev/fuse --privileged"
steps: steps:
- name: Checkout code - name: Checkout code
@ -113,13 +109,56 @@ jobs:
PLATFORM_TARGET: ${{matrix.target}} PLATFORM_TARGET: ${{matrix.target}}
BINTRAY_USER: kiwix BINTRAY_USER: kiwix
BINTRAY_PASS: ${{secrets.bintray_pass}} BINTRAY_PASS: ${{secrets.bintray_pass}}
GITHUB_PAT: ${{secrets.GHCR_TOKEN}}
- name: Upload failure logs - name: Upload failure logs
if: failure() if: failure()
run: $HOME/kiwix-build/.github/scripts/upload_failure_logs.sh run: $HOME/kiwix-build/.github/scripts/upload_failure_logs.sh
env: env:
PLATFORM_TARGET: ${{matrix.target}} PLATFORM_TARGET: ${{matrix.target}}
Flatpak:
strategy:
fail-fast: false
env:
HOME: /home/runner
SSH_KEY: /tmp/id_rsa
PLATFORM_TARGET: flatpak
OS_NAME: focal
runs-on: ubuntu-latest
steps:
- name: Checkout code
shell: bash
run: |
cd $HOME
git clone https://github.com/${REP}
cd ./${REP##*/}
git checkout --force ${GITHUB_SHA}
pip3 install --user --no-deps .
env:
REP: ${{github.repository}}
- name: Install flatpak tools
run: |
sudo apt-get update
sudo apt-get install flatpak-builder ninja-build meson
- name: secret
shell: bash
run: |
echo "${{secrets.ssh_key}}" > $SSH_KEY
chmod 600 $SSH_KEY
- name: Ensure base deps
shell: bash
run: |
cd $HOME
kiwix-build/.github/scripts/ensure_base_deps.py
- name: Build release
shell: bash
run: |
cd $HOME
kiwix-build/.github/scripts/build_release_nightly.py
env:
GITHUB_PAT: ${{secrets.GHCR_TOKEN}}
- name: Upload failure logs
if: failure()
run: $HOME/kiwix-build/.github/scripts/upload_failure_logs.sh
Macos: Macos:
strategy: strategy:
@ -148,7 +187,7 @@ jobs:
brew install pkg-config ninja automake autoconf brew install pkg-config ninja automake autoconf
- name: Install python modules - name: Install python modules
run: | run: |
pip3 install meson==0.52.1 pytest requests distro pip3 install meson pytest requests distro
pip3 install --no-deps $GITHUB_WORKSPACE pip3 install --no-deps $GITHUB_WORKSPACE
- name: secret - name: secret
shell: bash shell: bash

View File

@ -22,7 +22,7 @@ class org_kde(Dependency):
run_command(command, self.buildEnv.build_dir, context, env=env) run_command(command, self.buildEnv.build_dir, context, env=env)
def _install_sdk(self, context): def _install_sdk(self, context):
command = "flatpak --user install -y {remote_name} {name}.Sdk//{version} {name}.Platform//{version}" command = "flatpak --user install --noninteractive --verbose -y {remote_name} {name}.Sdk//{version} {name}.Platform//{version}"
command = command.format( command = command.format(
remote_name = 'flathub', remote_name = 'flathub',
name = self.target.name, name = self.target.name,

View File

@ -223,7 +223,7 @@ class FlatpakBuilder:
def build(self): def build(self):
log = pj(self.platform.buildEnv.log_dir, 'cmd_build_flatpak.log') log = pj(self.platform.buildEnv.log_dir, 'cmd_build_flatpak.log')
context = Context('build', log, False) context = Context('build', log, False)
command = "flatpak-builder --user --ccache --force-clean --repo=repo builddir {id}.json" command = "flatpak-builder --user --ccache --force-clean --keep-build-dirs --disable-rofiles-fuse --repo=repo builddir {id}.json"
command = command.format(id = MANIFEST['app-id']) command = command.format(id = MANIFEST['app-id'])
try: try:
run_command(command, self.platform.buildEnv.build_dir, context, env=self.platform.get_env()) run_command(command, self.platform.buildEnv.build_dir, context, env=self.platform.get_env())

View File

@ -33,12 +33,13 @@ mkdir -p $APPDIR/usr/bin/ && tar -C $APPDIR/usr/bin/ -xf aria2-1.36.0-linux-gnu-
mkdir -p $APPDIR/etc/ssl/certs/ && tar -C $APPDIR/etc/ssl/certs/ -xf aria2-1.36.0-linux-gnu-64bit-build1.tar.bz2 aria2-1.36.0-linux-gnu-64bit-build1/ca-certificates.crt --strip-components=1 mkdir -p $APPDIR/etc/ssl/certs/ && tar -C $APPDIR/etc/ssl/certs/ -xf aria2-1.36.0-linux-gnu-64bit-build1.tar.bz2 aria2-1.36.0-linux-gnu-64bit-build1/ca-certificates.crt --strip-components=1
# Get linuxdeployqt # Get linuxdeployqt
wget --continue https://github.com/probonopd/linuxdeployqt/releases/download/6/linuxdeployqt-6-x86_64.AppImage # Dispite the 'continuous' in the file name, it IS release 8
chmod a+x linuxdeployqt-6-x86_64.AppImage wget --continue https://github.com/probonopd/linuxdeployqt/releases/download/8/linuxdeployqt-continuous-x86_64.AppImage -O linuxdeployqt
chmod u+x linuxdeployqt
# Fill with all deps libs and so # Fill with all deps libs and so
./linuxdeployqt-6-x86_64.AppImage $APPDIR/usr/bin/kiwix-desktop -unsupported-allow-new-glibc -bundle-non-qt-libs -extra-plugins=imageformats,iconengines ./linuxdeployqt $APPDIR/usr/bin/kiwix-desktop -bundle-non-qt-libs -extra-plugins=imageformats,iconengines
# Fix the RPATH of QtWebEngineProcess [TODO] Fill a issue ? # Fix the RPATH of QtWebEngineProcess [TODO] Fill a issue ?
patchelf --set-rpath '$ORIGIN/../lib' $APPDIR/usr/libexec/QtWebEngineProcess patchelf --set-rpath '$ORIGIN/../lib' $APPDIR/usr/libexec/QtWebEngineProcess
# Build the image. # Build the image.
./linuxdeployqt-6-x86_64.AppImage $APPDIR/usr/share/applications/kiwix-desktop.desktop -unsupported-allow-new-glibc -bundle-non-qt-libs -extra-plugins=imageformats,iconengines -appimage ./linuxdeployqt $APPDIR/usr/share/applications/kiwix-desktop.desktop -bundle-non-qt-libs -extra-plugins=imageformats,iconengines -appimage

View File

@ -35,7 +35,7 @@ setup(
packages=find_packages(), packages=find_packages(),
include_package_data=True, include_package_data=True,
install_requires=[ install_requires=[
'meson==0.52.1', 'meson',
'distro' 'distro'
], ],
entry_points={ entry_points={