Skip to content

Commit

Permalink
Add github actions to build qmlls binaries
Browse files Browse the repository at this point in the history
Add a github action to build a static release build of qmlls.
There should be nightly releases that are build at night on monday,
wednesday and friday (frequency to be adjusted in the future), and
"real" releases that are built when a tag is pushed.

There is also the option to trigger the workflow "by hand" to get
nightly builds.

Nightly qmlls is versioned via qtdeclarative's short SHA,
qmlls-nightly-<short sha>, and "real releases" just follow the tag name
(as long as they have 'qmlls' and not 'nightly' in their tag name).

Add some workaround for the file stripping to have debug information in
a file separate to the qmlls binary.

You can see the github action in action at
https://github.com/samishalayel/qt5/actions/workflows/build_qmlls.yaml

Task-number: QTBUG-126405
Change-Id: I5379215062d7424544663c1519c4e296baf11fba
Reviewed-by: Alexandru Croitor <[email protected]>
  • Loading branch information
samishalayel committed Sep 3, 2024
1 parent 262a798 commit 1f42626
Showing 1 changed file with 180 additions and 0 deletions.
180 changes: 180 additions & 0 deletions .github/workflows/build_qmlls.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
name: Build qmlls

on:
# release nightly on schedule
schedule:
- cron: '0 2 * * 1,3,5'
# also release nightly on manual trigger
workflow_dispatch:
# release "real" release when a qmlls tag is pushed to dev
push:
branches:
- 'dev'
tags:
- 'qmlls-*'

defaults:
run:
shell: bash

jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- name: ubuntu
os: ubuntu-latest
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
- name: macos
os: macos-latest
deps:
tools: ccache
install_cmd: HOMEBREW_NO_INSTALL_CLEANUP=1 brew install
- name: windows
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
runs-on: ${{ matrix.os }}

steps:
- uses: lukka/get-cmake@latest

- name: prepare Linux
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 100
- name: prepare macOS
if: runner.os == 'macOS'
run: echo noop
- name: prepare Windows
if: runner.os == 'Windows'
shell: cmd
run: |
call "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
set >> "%GITHUB_ENV%"
- uses: actions/checkout@v4
with:
path: source

- name: restore ccache
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 != ''
- name: install compiler tools
run: ${{ matrix.install_cmd }} ${{ matrix.tools }} ${{ matrix.install_cmd_postfix }}
- name: configure ccache
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: initialize subrepositories
working-directory: source
run: ./init-repository --module-subset=qtdeclarative --mirror="https://code.qt.io/qt/"

- name: set qtdeclarative to dev and set dependencies via dependencies.yaml
working-directory: source
run: cmake -DSYNC_TO_MODULE="qtdeclarative" -DSYNC_TO_BRANCH="dev" -P cmake/QtSynchronizeRepo.cmake

- name: configure and build
run: |
mkdir build
cd build
../source/configure -force-debug-info -ccache -no-pch -release -static \
-force-bundled-libs -submodules qtdeclarative -nomake tests -nomake examples \
-prefix '${{ runner.temp }}'/install_dir ${{ matrix.configure_flags }}
ninja qmlls
- name: Get current SHA
id: vars
working-directory: source/qtdeclarative
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

- name: Create info file
run: |
echo -e "commit: ${{ steps.vars.outputs.sha_short }}\nbuild: $(date +"%Y-%m-%dT%H:%M:%SZ")" \
> info.txt
# workaround because -separate-debug-info is not supported in static builds
# note: msvc on windows separates the debug info, no need to strip by hand
- name: Stripping qmlls binary on linux
if: matrix.name == 'ubuntu'
run: |
objcopy --only-keep-debug ./build/qtbase/bin/qmlls ./build/qtbase/bin/qmlls.dbg
strip ./build/qtbase/bin/qmlls
objcopy --add-gnu-debuglink=./build/qtbase/bin/qmlls.dbg ./build/qtbase/bin/qmlls
- name: Stripping qmlls binary on mac
if: matrix.name == 'macos'
run: |
dsymutil ./build/qtbase/bin/qmlls -o ./build/qtbase/bin/qmlls.dSYM
strip ./build/qtbase/bin/qmlls
- name: Zip build files in archive
run: 7z a qmlls-${{ matrix.name }}-${{ steps.vars.outputs.sha_short }}.7z ./build/qtbase/bin/qmlls* info.txt

- name: Upload archive
uses: actions/upload-artifact@v4
with:
path: qmlls-${{ matrix.name }}-${{ steps.vars.outputs.sha_short }}.7z
name: qmlls-${{ matrix.name }}-${{ steps.vars.outputs.sha_short }}.7z

release:
permissions:
contents: write
runs-on: ubuntu-latest
needs: build

steps:
- uses: actions/checkout@v4
with:
repository: qt/qtdeclarative
path: source

- name: Get current SHA
id: vars
working-directory: source
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

- name: Download artifacts
id: downloaded_artifacts
uses: actions/download-artifact@v4
with:
path: release

- name: Create nightly release
if: ${{ ! contains(github.ref, 'tags/qmlls-') }}
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: qmlls-nightly-${{ steps.vars.outputs.sha_short }}
draft: false
prerelease: true
files: release/*/*.7z

- name: Create release
if: ${{ contains(github.ref, 'tags/qmlls-') && !contains(github.ref, 'nightly') }}
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# note: use default tag_name
draft: true
prerelease: false
files: release/*/*.7z

0 comments on commit 1f42626

Please sign in to comment.