Skip to content

Build qmlls

Build qmlls #197

Workflow file for this run

name: Build qmlls
on:
# release nightly on weekly schedule
schedule:
- cron: '0 2 * * 1'
# also release nightly on manual trigger
workflow_dispatch:
inputs:
ref_to_build:
description: qtdeclarative ref to build in the form of refs/changes/15/654815/1
required: true
push:
defaults:
run:
shell: bash
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- name: linux-x64
os: ubuntu-22.04
deps: libgl-dev libglu-dev 'libxcb*-dev' libx11-xcb-dev libxkbcommon-x11-dev libb2-dev libdouble-conversion-dev libpq5=14.19-0ubuntu0.22.04.1
tools: ccache
install_cmd: sudo apt-get --allow-downgrades -y install
configure_flags: -xcb
debugging_symbols_extension: .dbg
- name: macos-universal
os: macos-latest
deps:
tools: ccache
install_cmd: HOMEBREW_NO_INSTALL_CLEANUP=1 brew install
configure_flags: "-- '-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64'"
qmlls_configure_flags: "'-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64'"
debugging_symbols_extension: .dSYM
unsigned_suffix: -unsigned
- name: windows-x64
os: windows-latest
install_cmd: choco install
install_cmd_postfix: --yes --no-progress
tools: ccache
configure_flags: -no-feature-sql-psql -no-feature-sql-mysql -no-feature-sql-odbc
debugging_symbols_extension: .pdb
executable_extension: .exe
script_extension: .bat
unsigned_suffix: -unsigned
- name: linux-arm64
os: ubuntu-22.04-arm
deps: libgl-dev libglu-dev 'libxcb*-dev' libx11-xcb-dev libxkbcommon-x11-dev libb2-dev libdouble-conversion-dev
tools: ccache
install_cmd: sudo apt-get -y install
configure_flags: -xcb
debugging_symbols_extension: .dbg
- name: windows-arm64
os: windows-11-arm
install_cmd: choco install
install_cmd_postfix: --yes --no-progress
tools: ccache
configure_flags: -no-feature-sql-psql -no-feature-sql-mysql -no-feature-sql-odbc
debugging_symbols_extension: .pdb
executable_extension: .exe
script_extension: .bat
unsigned_suffix: -unsigned
runs-on: ${{ matrix.os }}
steps:
- name: get artifacts cache key
id: artifacts_cache_key
# we build qmlls once per week, so use week number + year as cache key
run: |
key=$(date "+%Y.%W")
echo "key=${key}" >> $GITHUB_OUTPUT
echo artifact_basename=qmlls-${{ matrix.name }}-nightly-${key} >> $GITHUB_OUTPUT
- name: cache artifacts
if: ${{ !github.event.inputs.ref_to_build }}
id: cache_artifacts
uses: actions/cache@v4
with:
path: artifacts
key: ${{ matrix.name }}-${{ steps.artifacts_cache_key.outputs.key }}-artifacts
- uses: lukka/get-cmake@latest
if: steps.cache_artifacts.outputs.cache-hit != 'true'
with:
cmakeVersion: "~3.30.0"
ninjaVersion: latest
- name: prepare Linux
if: runner.os == 'Linux' && steps.cache_artifacts.outputs.cache-hit != 'true'
run: |
sudo apt-get update
# try to make more disk space by removing unused things
sudo apt-get purge firefox chromium-browser microsoft-edge-stable google-chrome-stable apache2 mysql-server mysql-common "php*" "ruby*" || true
sudo apt-get autoremove || true
sudo rm -rf /usr/local/lib/android/sdk || true
sudo apt-get clean || true
- name: prepare macOS
if: runner.os == 'macOS' && steps.cache_artifacts.outputs.cache-hit != 'true'
run: echo noop
- name: prepare Windows
if: runner.os == 'Windows' && steps.cache_artifacts.outputs.cache-hit != 'true'
shell: cmd
run: |
call "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
set >> "%GITHUB_ENV%"
- name: restore ccache
if: steps.cache_artifacts.outputs.cache-hit != 'true'
uses: actions/cache@v4
with:
path: ${{ runner.temp }}/ccache
key: ccache-${{ matrix.os }}
- name: install build dependencies
run: ${{ matrix.install_cmd }} ${{ matrix.deps }} ${{ matrix.install_cmd_postfix }}
if: matrix.deps != '' && steps.cache_artifacts.outputs.cache-hit != 'true'
- name: install compiler tools
if: steps.cache_artifacts.outputs.cache-hit != 'true'
run: ${{ matrix.install_cmd }} ${{ matrix.tools }} ${{ matrix.install_cmd_postfix }}
- name: configure ccache
if: steps.cache_artifacts.outputs.cache-hit != 'true'
run: |
ccache --set-config sloppiness=file_macro,time_macros
ccache --set-config cache_dir='${{ runner.temp }}'/ccache
ccache --set-config compression=true
ccache --set-config max_size=1G
- name: cache repository
id: cache-repo
uses: actions/cache/restore@v4
if: steps.cache_artifacts.outputs.cache-hit != 'true'
with:
path: source
key: ${{ matrix.name }}-qt5repo
- name: cloning qt5 and initialize subrepositories
if: steps.cache-repo.outputs.cache-hit != 'true' && steps.cache_artifacts.outputs.cache-hit != 'true'
run: |
git clone https://code.qt.io/qt/qt5.git source
cd source
./init-repository --module-subset=qtdeclarative,qttools
- name: update cached repository
if: steps.cache-repo.outputs.cache-hit == 'true' && steps.cache_artifacts.outputs.cache-hit != 'true'
working-directory: source
run: |
git fetch
git submodule foreach --recursive git gc --auto # try to save some disk space
(cd qtdeclarative; git reset --hard origin/dev;)
(cd qttools; git checkout dev; git reset --hard origin/dev; git submodule update)
- name: set qtdeclarative to dev and set dependencies via dependencies.yaml
if: steps.cache_artifacts.outputs.cache-hit != 'true'
working-directory: source
run: |
cmake -DSYNC_TO_MODULE="qtdeclarative" -DSYNC_TO_BRANCH="dev" -P cmake/QtSynchronizeRepo.cmake
(cd qttools; git checkout dev; git reset --hard origin/dev; git submodule update)
echo "Using following SHAs: "
for i in . qtdeclarative qtbase qtimageformats qtlanguageserver qtshadertools qtsvg qttools; do (cd $i; echo "$i: $(git show HEAD -s --format=oneline)";); done;
- name: save cached repository
if: always() && steps.cache_artifacts.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: source
key: ${{ matrix.name }}-qt5repo
- name: set qtdeclarative to custom SHA
if: github.event.inputs.ref_to_build
working-directory: source/qtdeclarative
run: git fetch https://codereview.qt-project.org/qt/qtdeclarative ${{github.event.inputs.ref_to_build}} && git checkout FETCH_HEAD
- name: configure and build Qt
if: steps.cache_artifacts.outputs.cache-hit != 'true' && steps.cache_qt_build.outputs.cache-hit != 'true'
run: |
rm -rf qt-build; mkdir qt-build
cd qt-build
../source/configure -force-debug-info -ccache -no-pch -release -static -no-icu \
-force-bundled-libs -submodules qtdeclarative,qttools -nomake tests -nomake examples \
-no-prefix -no-sbom -no-gui ${{ matrix.configure_flags }}
ninja qtdeclarative qtbase Tools QHelpEnginePlugin_init QHelpEnginePlugin
- uses: actions/checkout@v4
if: steps.cache_artifacts.outputs.cache-hit != 'true'
with:
path: qmlls-workflow-source
- name: configure and build Qmlls
if: steps.cache_artifacts.outputs.cache-hit != 'true'
run: |
rm -rf qmlls-build; mkdir qmlls-build
cd qmlls-build
../qt-build/qtbase/bin/qt-cmake${{ matrix.script_extension }} -S ../qmlls-workflow-source -B . -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo ${{ matrix.qmlls_configure_flags }}
ninja
- name: Remove Qt Build to save disk space
if: steps.cache_artifacts.outputs.cache-hit != 'true'
run: rm -rf qt-build
- name: Create info file
if: steps.cache_artifacts.outputs.cache-hit != 'true'
run: |
echo -e "commit: $(cd source/qtdeclarative && git rev-parse --short HEAD)\nbuild: $(date +"%Y-%m-%dT%H:%M:%SZ")" \
> info.txt
- name: Stripping qmlls binary on linux
if: runner.os == 'Linux' && steps.cache_artifacts.outputs.cache-hit != 'true'
run: |
objcopy --only-keep-debug ./qmlls-build/qmlls ./qmlls-build/qmlls.dbg
strip ./qmlls-build/qmlls
objcopy --add-gnu-debuglink=./qmlls-build/qmlls.dbg ./qmlls-build/qmlls
- name: Stripping qmlls binary on mac
if: runner.os == 'macOS' && steps.cache_artifacts.outputs.cache-hit != 'true'
run: |
dsymutil ./qmlls-build/qmlls -o ./qmlls-build/qmlls.dSYM
strip ./qmlls-build/qmlls
- name: Zipping debug symbols and executable
if: steps.cache_artifacts.outputs.cache-hit != 'true'
run: |
mkdir artifacts
7z a artifacts/${{ steps.artifacts_cache_key.outputs.artifact_basename }}-debugsymbols.zip ./qmlls-build/qmlls${{ matrix.debugging_symbols_extension }} info.txt
7z a artifacts/${{ steps.artifacts_cache_key.outputs.artifact_basename }}${{ matrix.unsigned_suffix }}.zip ./qmlls-build/qmlls${{ matrix.executable_extension }} info.txt
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
path: artifacts/${{ steps.artifacts_cache_key.outputs.artifact_basename }}${{ matrix.unsigned_suffix }}.zip
name: ${{ steps.artifacts_cache_key.outputs.artifact_basename }}${{ matrix.unsigned_suffix }}.zip
- name: Upload artifact with debug symbols
uses: actions/upload-artifact@v4
with:
path: artifacts/${{ steps.artifacts_cache_key.outputs.artifact_basename }}-debugsymbols.zip
name: ${{ steps.artifacts_cache_key.outputs.artifact_basename }}-debugsymbols.zip
release:
permissions:
contents: write
runs-on: signing-runner
if: ${{ !github.event.inputs.ref_to_build }}
environment: Signing credentials
needs: build
steps:
- name: Remove old artifacts
run: rm -rf weekly_release; mkdir weekly_release
- name: Download artifacts
id: downloaded_artifacts
uses: actions/download-artifact@v4
with:
path: weekly_release
- name: Get current revision and filenames
id: vars
run: |
cache_key=$(date "+%Y.%W")
echo cache_key=${cache_key} >> $GITHUB_OUTPUT
echo revision=nightly-${cache_key} >> $GITHUB_OUTPUT
unsigned_macos_archive="$(ls weekly_release/qmlls-macos-*-unsigned.zip/qmlls-macos-*-unsigned.zip | head -n 1)"
unsigned_windows_archive="$(ls weekly_release/qmlls-windows-x64-*-unsigned.zip/qmlls-windows-x64-*-unsigned.zip | head -n 1)"
unsigned_windows_arm_archive="$(ls weekly_release/qmlls-windows-arm64-*-unsigned.zip/qmlls-windows-arm64-*-unsigned.zip | head -n 1)"
echo unsigned_macos_archive=${unsigned_macos_archive} >> $GITHUB_OUTPUT
echo unsigned_windows_archive=${unsigned_windows_archive} >> $GITHUB_OUTPUT
echo unsigned_windows_arm_archive=${unsigned_windows_arm_archive} >> $GITHUB_OUTPUT
echo qmlls=qmllanguageserver >> $GITHUB_OUTPUT
echo Files to be signed: ${unsigned_macos_archive} and ${unsigned_windows_archive} and ${unsigned_windows_arm_archive}
ls -lh ${unsigned_windows_archive} ${unsigned_macos_archive} ${unsigned_windows_arm_archive}
- name: Sign archives
id: sign-archives
uses: TheQtCompanyRnD/SignArchives@v1
with:
macos: ${{ steps.vars.outputs.unsigned_macos_archive }}
win-x64: ${{ steps.vars.outputs.unsigned_windows_archive }}
win-arm64: ${{ steps.vars.outputs.unsigned_windows_arm_archive }}
jenkins-url: '${{ secrets.JENKINS_URL }}'
jenkins-user: '${{ secrets.JENKINS_USERNAME }}'
jenkins-token: '${{ secrets.JENKINS_TOKEN }}'
- name: Move and rename files and repack from .7z to .zip
run: |
ls -R # debug output
mkdir weekly_release/to_be_uploaded
# the signing job returns .7z files, but we want .zip for our clients.
function repack {
rm -rf tmp; mkdir tmp
cd tmp
7z x "../$1"
7z a "../$2" *
cd ..
rm -rf tmp
}
repack ${{ steps.sign-archives.outputs.macos }} \
weekly_release/to_be_uploaded/${{ steps.vars.outputs.qmlls }}-macos-universal-${{ steps.vars.outputs.revision }}.zip
repack ${{ steps.sign-archives.outputs.win-x64 }} \
weekly_release/to_be_uploaded/${{ steps.vars.outputs.qmlls }}-windows-x64-${{ steps.vars.outputs.revision }}.zip
repack ${{ steps.sign-archives.outputs.win-arm64 }} \
weekly_release/to_be_uploaded/${{ steps.vars.outputs.qmlls }}-windows-arm64-${{ steps.vars.outputs.revision }}.zip
mv weekly_release/*/qmlls-linux-x64-${{ steps.vars.outputs.revision }}.zip \
weekly_release/to_be_uploaded/${{ steps.vars.outputs.qmlls }}-linux-x64-${{ steps.vars.outputs.revision }}.zip
mv weekly_release/*/qmlls-linux-arm64-${{ steps.vars.outputs.revision }}.zip \
weekly_release/to_be_uploaded/${{ steps.vars.outputs.qmlls }}-linux-arm64-${{ steps.vars.outputs.revision }}.zip
# copy binaries for downloaders expecting the "old" archive names
cd weekly_release/to_be_uploaded
cp ${{ steps.vars.outputs.qmlls }}-windows-x64-${{ steps.vars.outputs.revision }}.zip qmlls-windows-${{ steps.vars.outputs.revision }}.zip
cp ${{ steps.vars.outputs.qmlls }}-macos-universal-${{ steps.vars.outputs.revision }}.zip qmlls-macos-${{ steps.vars.outputs.revision }}.zip
cp ${{ steps.vars.outputs.qmlls }}-linux-x64-${{ steps.vars.outputs.revision }}.zip qmlls-ubuntu-${{ steps.vars.outputs.revision }}.zip
ls -R # debug output
- name: Upload signed artifact
uses: actions/upload-artifact@v4
with:
path: |
weekly_release/to_be_uploaded/${{ steps.vars.outputs.qmlls }}-macos-universal-${{ steps.vars.outputs.revision }}.zip
weekly_release/to_be_uploaded/${{ steps.vars.outputs.qmlls }}-windows-x64-${{ steps.vars.outputs.revision }}.zip
weekly_release/to_be_uploaded/${{ steps.vars.outputs.qmlls }}-windows-arm64-${{ steps.vars.outputs.revision }}.zip
name: signed-artifacts.zip
- name: Upload debug symbols
uses: actions/upload-artifact@v4
with:
path: |
weekly_release/*/*-debugsymbols.zip
name: debugsymbols.zip
- name: Create nightly release
if: ${{ github.ref == 'refs/heads/main' }}
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: nightly-${{ steps.vars.outputs.cache_key }}
draft: false
prerelease: true
files: weekly_release/to_be_uploaded/*