Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CI pipeline #5

Merged
merged 36 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
10f5154
ci first go
adam-ce Oct 18, 2024
c5d11d0
go2
adam-ce Oct 18, 2024
742d308
aqt for webassembly doesn't work for qt 6.7+
adam-ce Oct 18, 2024
112cd1d
remove refresh_assets.py (it broke the ci build)
adam-ce Oct 18, 2024
e85f04e
try fix deploy
adam-ce Oct 18, 2024
d8e4433
fix cmake command
adam-ce Oct 18, 2024
fc47685
try fix apk
adam-ce Oct 18, 2024
6bf70ff
disable unneeded stuff
adam-ce Oct 18, 2024
7c0466c
try fix android config
adam-ce Oct 18, 2024
c8de73b
wth, this shouldn't matter
adam-ce Oct 18, 2024
312553d
ah, righty. didn't delete the config, just the settings.
adam-ce Oct 18, 2024
6fcb826
try fixing paths
adam-ce Oct 19, 2024
8bf6ac6
debug output
adam-ce Oct 19, 2024
6b2e1fe
debug output2
adam-ce Oct 19, 2024
64c95b7
try fix paths again
adam-ce Oct 19, 2024
66a8d1b
trigger
adam-ce Oct 19, 2024
a1c7bad
fix wasm installation
adam-ce Oct 19, 2024
b822842
try qt 6.7
adam-ce Oct 20, 2024
bbb2e0f
try qt 6.7 again
adam-ce Oct 20, 2024
b238bd8
try branch name
adam-ce Oct 20, 2024
4565ce2
try 6.7.0 version
adam-ce Oct 20, 2024
46037a3
host: all_os
adam-ce Oct 20, 2024
2731fb7
arch: linux_gcc_64 for qt 6.7
adam-ce Oct 20, 2024
88c9af7
try again
adam-ce Oct 20, 2024
608d357
update QT_ROOT_DIR and try master branch
adam-ce Oct 20, 2024
4d523b9
needs to be the deploy branch
adam-ce Oct 20, 2024
e34d2d0
is this also a branch / tag name?
adam-ce Oct 20, 2024
6e40253
fix typo
adam-ce Oct 20, 2024
9613376
hah, maybe this way
adam-ce Oct 20, 2024
81f56ba
update emscripten version for qt 6.7
adam-ce Oct 20, 2024
30f6f2a
fix if for wasm
adam-ce Oct 20, 2024
e5288b5
try without aqt version
adam-ce Oct 20, 2024
68b78e8
use miurahr for android and timangus for emscripten
adam-ce Oct 20, 2024
c91eb7a
test qt 6.8
adam-ce Oct 21, 2024
dac8b19
6.8 doesn't work, test 6.7.3
adam-ce Oct 21, 2024
53c1bb4
update android version
adam-ce Oct 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
232 changes: 232 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
name: "Deploy"
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "deploy"
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
qtarch: [wasm_singlethread, android_arm64_v8a]
qtversion: ['6.7.3']
include:
- qtarch: wasm_singlethread
qttarget: 'wasm'
qthost: 'all_os'
qtmodules: ''
additional_build_flags: '--target install'
aqtsource: 'git+https://github.com/timangus/aqtinstall.git'
# - qtarch: wasm_multithread
# qttarget: 'desktop'
# qtmodules: ''
# additional_build_flags: '--target install'
- qtarch: android_arm64_v8a
qttarget: 'android'
qthost: 'linux'
aqtsource: 'git+https://github.com/miurahr/aqtinstall.git'
# - qtarch: android_armv7
# qttarget: 'android'

steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential ninja-build

- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

- uses: mymindstorm/setup-emsdk@v13
if: matrix.qttarget == 'wasm'
with:
version: 3.1.50

- name: Install Qt native version (required by android version)
uses: timangus/install-qt-action@deployed
with:
aqtsource: ${{ matrix.aqtsource }}
version: ${{ matrix.qtversion }}
host: linux
target: 'desktop'
arch: linux_gcc_64
dir: '${{github.workspace}}/qt'
install-deps: 'true'

- name: Set QT_HOST_PATH
run: echo "QT_HOST_PATH=${QT_ROOT_DIR}" >> "$GITHUB_ENV"

- name: Install Qt crosscompile target version
uses: timangus/install-qt-action@deployed
with:
aqtsource: ${{ matrix.aqtsource }}
version: ${{ matrix.qtversion }}
host: ${{ matrix.qthost }}
target: ${{ matrix.qttarget }}
arch: ${{ matrix.qtarch }}
dir: '${{github.workspace}}/qt'
install-deps: 'true'
modules: ${{ matrix.qtmodules }}

- name: Make qt cross binaries executable
run: |
chmod u+x ${QT_ROOT_DIR}/bin/*

- name: Verify emcc
if: matrix.qttarget == 'desktop'
run: emcc -v

- name: Set reusable strings
shell: bash
run: |
BUILD_DIR="${{ github.workspace }}/build"
APK_TARGET="appMaterialTester"
APK_PROJECT_DIR="MaterialTester"
echo "BUILD_DIR=$BUILD_DIR" >> $GITHUB_ENV
echo "APK_TARGET=$APK_TARGET" >> $GITHUB_ENV

echo "INSTALL_DIR=${{ github.workspace }}/install/${{ matrix.qtarch }}" >> $GITHUB_ENV
echo "APK_DIR=$BUILD_DIR/android-build/build/outputs/apk/" >> $GITHUB_ENV
echo "ANDROID_BUILD_DIR=$BUILD_DIR/android-build/" >> $GITHUB_ENV
echo "DEPLOYMENT_SETTINGS=$BUILD_DIR/android-$APK_TARGET-deployment-settings.json" >> $GITHUB_ENV


- name: Configure CMake
env:
CMAKE_PREFIX_PATH: ${{env.QT_ROOT_DIR}}/lib/cmake
run: >
${QT_ROOT_DIR}/bin/qt-cmake
-G Ninja
-B $BUILD_DIR
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR
${{ matrix.additional_cmake_flags }}
-S ${{ github.workspace }}/MaterialTester

- name: Build
run: cmake --build $BUILD_DIR ${{ matrix.additional_build_flags }}

- name: Debug output
run: find ${{ github.workspace }} -type d -print | sed -e 's;[^/]*/;| ;g;s;| $;|-- ;'

- name: Signing Android package with common key
env:
secret_test: ${{ secrets.KEYSTOREPASSWORD }}
if: matrix.qttarget == 'android' && env.secret_test != ''
run: |
echo ${{ secrets.SIGNINGKEYBASE64 }} > release.keystore.base64
base64 -d release.keystore.base64 > release.keystore
$QT_HOST_PATH/bin/androiddeployqt --input $DEPLOYMENT_SETTINGS --output $ANDROID_BUILD_DIR --android-platform android-34 --gradle --release --sign release.keystore alpinemaps --storepass ${{ secrets.KEYSTOREPASSWORD }}

- name: Signing Android packages with generated key
env:
secret_test: ${{ secrets.KEYSTOREPASSWORD }}
if: matrix.qttarget == 'android' && env.secret_test == ''
run: |
keytool -genkey -v -keystore release.keystore -alias alpinemaps -keyalg RSA -sigalg SHA1withRSA -keysize 2048 -validity 10000 -keypass asdfasdf -storepass asdfasdf -dname "CN=Franz, OU=IT, O=Furz, L=Rattenberg, ST=Tirol, C=AT"
$QT_HOST_PATH/bin/androiddeployqt --input $DEPLOYMENT_SETTINGS --output $ANDROID_BUILD_DIR --android-platform android-34 --gradle --release --sign release.keystore alpinemaps --storepass asdfasdf

README_PATH=$APK_DIR/read_me.txt
echo "The apk was signed with a generated key which changes every time the apk is generated. This means, that android might refuse to install it if another apk with the same app was installed previously. You'll have to deinstall it. Doing so will delete all settings and cache." >> $README_PATH
echo "" >> $README_PATH
echo "In order to prevent that, you have to generate your own key or use our public key:" >> $README_PATH
echo "" >> $README_PATH
echo "To generate your own key:" >> $README_PATH
echo "- https://stackoverflow.com/questions/3997748/how-can-i-create-a-keystore. Use 'alpinemaps' as the alias!" >> $README_PATH
echo "- If you have the android dev setup ready in Qt Creator, you can also create the keystore via Projects (on the left side toolboar) -> Android Qt ... -> Build -> Build Steps -> Build Android APK -> Application Signature -> Create. Use 'alpinemaps' as the alias!" >> $README_PATH
echo "- Then you have to encode the keystore in base64, e.g., on linux via 'base64 keystorefile > keystorefile.base64'" >> $README_PATH
echo "- Finally, create the following secrets in github -> your repo -> Settings -> Secrets and variables -> Actions -> Repository secrets" >> $README_PATH
echo " SIGNINGKEYBASE64 = the base64 encoded key" >> $README_PATH
echo " KEYSTOREPASSWORD = the password used to create the keystore" >> $README_PATH
echo "" >> $README_PATH
echo "To use our public key, go to https://github.com/AlpineMapsOrg/renderer/blob/main/creating_apk_keys.md" >> $README_PATH
echo "" >> $README_PATH
echo "Oh, and I hope this saved your day :)" >> $README_PATH

- name: Copy android packages
if: matrix.qttarget == 'android'
run: |
mkdir -p $INSTALL_DIR
cp -r $APK_DIR/* $INSTALL_DIR

- name: Create artifact
uses: actions/upload-artifact@v4
with:
name: files_${{ matrix.qtarch }}
path: ${{ github.workspace }}/install/
if-no-files-found: error

deploy:
if: github.event_name == 'push'
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest

steps:
- name: Install dependencies
run: sudo apt-get install -y lftp

- name: Clone repository (only for version number)
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: ${{github.workspace}}/downloaded

- name: Move into place
run: |
mkdir $GITHUB_WORKSPACE/github_page
mv $GITHUB_WORKSPACE/downloaded/*/* $GITHUB_WORKSPACE/github_page/

- name: Upload to an FTP host
env:
FTP_USER: ${{ secrets.FTP_USER }}
FTP_PASS: ${{ secrets.FTP_PASS }}
FTP_HOST: ${{ secrets.FTP_HOST }}
if: env.FTP_HOST != ''
run: |
reponame=$(echo $GITHUB_REPOSITORY | grep -oE "[^/]*$")
lftp -c "
set ftp:ssl-force true;
open -u $FTP_USER,$FTP_PASS $FTP_HOST;
mirror -R -e -v -n $GITHUB_WORKSPACE/github_page/. ./${reponame}_$(git describe --tags --dirty=-d --abbrev=1);
"

- name: Generate Directory Listings
uses: jayanta525/[email protected]
with:
FOLDER: github_page

- name: Create Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: ${{github.workspace}}/github_page

- name: Setup Pages
uses: actions/configure-pages@v4

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

102 changes: 102 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Linux tests

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

concurrency:
group: "linux"
cancel-in-progress: true

jobs:
build:
strategy:
fail-fast: false
matrix:
compiler: [gcc12, clang15, clang17]
build_type: [Release]
include:
- compiler: gcc12
CC: "/usr/bin/gcc-12"
CXX: "/usr/bin/g++-12"
- compiler: clang15
CC: '/usr/bin/clang-15'
CXX: '/usr/bin/clang++-15'
- compiler: clang17
CC: '/usr/bin/clang-17'
CXX: '/usr/bin/clang++-17'

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
submodules: 'true'

- name: Install Clang 17
if: matrix.compiler == 'clang17'
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x ./llvm.sh
sudo ./llvm.sh 17

- name: Install Linux Dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential ninja-build lld clang-15 libgl1-mesa-dev libxcb-cursor-dev xorg-dev libxrandr-dev libxcursor-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev libdrm-dev libgbm-dev xvfb libxcb-cursor0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-render-util0

- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
aqtversion: '==3.1.*'
version: '6.8.0'
host: 'linux'
target: 'desktop'
arch: 'linux_gcc_64'
dir: '${{github.workspace}}/qt'
install-deps: 'true'

- name: Configure
env:
CC: ${{ matrix.CC }}
CXX: ${{ matrix.CXX }}
CMAKE_PREFIX_PATH: ${{env.Qt6_Dir}}/lib/cmake
run: >
cmake -G Ninja
-DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}}
-DCMAKE_BUILD_TYPE=Debug
-B ./build
-S ./MaterialTester

- name: Build
env:
CC: ${{ matrix.CC }}
CXX: ${{ matrix.CXX }}
run: |
cmake --build ./build
#
# - name: Don't close loaded libraries for better sanitizer output
# env:
# CC: ${{ matrix.CC }}
# CXX: ${{ matrix.CXX }}
# run: |
# echo "#include <stdio.h>" >> dlclose.c
# echo "int dlclose(void*) { return 0; }" >> dlclose.c
# $CC --shared dlclose.c -o libdlclose.so
#
# - name: Unittests on Linux
# env:
# QT_QPA_PLATFORM: offscreen
# DISPLAY: :1
# LD_PRELOAD: ./libdlclose.so
# LSAN_OPTIONS: suppressions=./sanitizer_supressions/linux_leak.supp
# ASAN_OPTIONS: verify_asan_link_order=0
# run: |
# ./build/alp_external/radix/unittests/unittests_radix
# ./build/unittests/nucleus/unittests_nucleus
# Xvfb :1 -screen 0 1024x768x16 &
# sleep 5
# ./build/unittests/gl_engine/unittests_gl_engine
# ./build/app/alpineapp
Loading