From 6ef7d5af3484f7173a1f7991be3604efb63f9774 Mon Sep 17 00:00:00 2001 From: Adam Celarek <5292991+adam-ce@users.noreply.github.com> Date: Tue, 16 Jan 2024 19:40:52 +0100 Subject: [PATCH] also replace webassembly workflow with newer renderer deploy workflow --- .github/workflows/deploy.yml | 219 ++++++++++++++++++++++++++++++ .github/workflows/webassembly.yml | 103 -------------- 2 files changed, 219 insertions(+), 103 deletions(-) create mode 100644 .github/workflows/deploy.yml delete mode 100644 .github/workflows/webassembly.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..bbffa38 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,219 @@ +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, wasm_multithread, android_arm64_v8a, android_armv7] + qtversion: ['6.6.1'] + include: + - qtarch: wasm_singlethread + qttarget: 'desktop' + qtmodules: 'qtcharts' + additional_build_flags: '--target install' + - qtarch: wasm_multithread + qttarget: 'desktop' + qtmodules: 'qtcharts' + additional_cmake_flags: '-DALP_ENABLE_THREADING=ON' + additional_build_flags: '--target install' + - qtarch: android_arm64_v8a + qttarget: 'android' + qtmodules: 'qtcharts qtpositioning' + - qtarch: android_armv7 + qttarget: 'android' + qtmodules: 'qtcharts qtpositioning' + + steps: + - name: Install dependencies + run: 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 == 'desktop' + with: + version: 3.1.37 + + - name: Install Qt native version (required by android version) + uses: jurplel/install-qt-action@v3 + with: + aqtversion: '==3.1.*' + version: ${{ matrix.qtversion }} + host: linux + target: 'desktop' + arch: gcc_64 + dir: '${{github.workspace}}/qt' + install-deps: 'true' + + - name: Set QT_HOST_PATH + run: echo "QT_HOST_PATH=${Qt6_DIR}" >> "$GITHUB_ENV" + + - name: Install Qt crosscompile target version + uses: jurplel/install-qt-action@v3 + with: + aqtversion: '==3.1.*' + version: ${{ matrix.qtversion }} + host: linux + 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 ${Qt6_DIR}/bin/* + + - name: Verify emcc + if: matrix.qttarget == 'desktop' + run: emcc -v + + - name: Set reusable strings + # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. + id: strings + shell: bash + run: | + echo "build-output-dir=${{ github.workspace }}/build_${{ matrix.qtarch }}" >> $GITHUB_OUTPUT + echo "install-dir=${{ github.workspace }}/install/${{ matrix.qtarch }}" >> $GITHUB_OUTPUT + + - name: Configure CMake + env: + CMAKE_PREFIX_PATH: ${{env.Qt6_DIR}}/lib/cmake + run: > + ${Qt6_DIR}/bin/qt-cmake + -G Ninja + -B ${{ steps.strings.outputs.build-output-dir }} + -DCMAKE_BUILD_TYPE=Release + -DALP_WWW_INSTALL_DIR=${{ steps.strings.outputs.install-dir }} + -DALP_ENABLE_ASSERTS=ON + -DFMT_INSTALL=OFF + ${{ matrix.additional_cmake_flags }} + -S ${{ github.workspace }} + + - name: Build + run: cmake --build ${{ steps.strings.outputs.build-output-dir }} ${{ matrix.additional_build_flags }} + + - name: Signing Android package + 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 ${{ steps.strings.outputs.build-output-dir }}/app/android-alpineapp-deployment-settings.json --output ${{ steps.strings.outputs.build-output-dir }}/app/android-build --android-platform android-33 --gradle --release --sign release.keystore alpinemaps --storepass ${{ secrets.KEYSTOREPASSWORD }} + + - name: Readme why Android package was not signed + env: + secret_test: ${{ secrets.KEYSTOREPASSWORD }} + if: matrix.qttarget == 'android' && env.secret_test == '' + run: | + echo "Well, the apk wasn't signed because there is no key to sign it with in your repository (the one this was created in)." >> ${{ steps.strings.outputs.build-output-dir }}/app/android-build/build/outputs/apk/release/read_me_in_case_you_wonder_why_the_apk_is_not_signed.txt + echo "" >> ${{ steps.strings.outputs.build-output-dir }}/app/android-build/build/outputs/apk/release/read_me_in_case_you_wonder_why_the_apk_is_not_signed.txt + echo "These are the steps to generate such a key:" >> ${{ steps.strings.outputs.build-output-dir }}/app/android-build/build/outputs/apk/release/read_me_in_case_you_wonder_why_the_apk_is_not_signed.txt + echo "- https://stackoverflow.com/questions/3997748/how-can-i-create-a-keystore. Use 'alpinemaps' as the alias!" >> ${{ steps.strings.outputs.build-output-dir }}/app/android-build/build/outputs/apk/release/read_me_in_case_you_wonder_why_the_apk_is_not_signed.txt + 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!" >> ${{ steps.strings.outputs.build-output-dir }}/app/android-build/build/outputs/apk/release/read_me_in_case_you_wonder_why_the_apk_is_not_signed.txt + echo "- Then you have to encode the keystore in base64, e.g., on linux via 'base64 keystorefile > keystorefile.base64'" >> ${{ steps.strings.outputs.build-output-dir }}/app/android-build/build/outputs/apk/release/read_me_in_case_you_wonder_why_the_apk_is_not_signed.txt + echo "- Finally, create the following secrets in github -> your repo -> Settings -> Secrets and variables -> Actions -> Repository secrets" >> ${{ steps.strings.outputs.build-output-dir }}/app/android-build/build/outputs/apk/release/read_me_in_case_you_wonder_why_the_apk_is_not_signed.txt + echo " SIGNINGKEYBASE64 = the base64 encoded key" >> ${{ steps.strings.outputs.build-output-dir }}/app/android-build/build/outputs/apk/release/read_me_in_case_you_wonder_why_the_apk_is_not_signed.txt + echo " KEYSTOREPASSWORD = the password used to create the keystore" >> ${{ steps.strings.outputs.build-output-dir }}/app/android-build/build/outputs/apk/release/read_me_in_case_you_wonder_why_the_apk_is_not_signed.txt + echo "" >> ${{ steps.strings.outputs.build-output-dir }}/app/android-build/build/outputs/apk/release/read_me_in_case_you_wonder_why_the_apk_is_not_signed.txt + echo "Oh, and I hope this saved your day ;)" >> ${{ steps.strings.outputs.build-output-dir }}/app/android-build/build/outputs/apk/release/read_me_in_case_you_wonder_why_the_apk_is_not_signed.txt + + - name: Copy android packages + if: matrix.qttarget == 'android' + run: | + mkdir -p ${{ steps.strings.outputs.install-dir }} + cp -r ${{ steps.strings.outputs.build-output-dir }}/app/android-build/build/outputs/apk/release/* ${{ steps.strings.outputs.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: Fix headers for wasm_multithread + run: | + cd $GITHUB_WORKSPACE/github_page/wasm_multithread + wget https://raw.githubusercontent.com/gzuidhof/coi-serviceworker/master/coi-serviceworker.min.js + sed -i -e 's###g' alpineapp.html + + - name: Generate Directory Listings + uses: jayanta525/github-pages-directory-listing@v4.0.0 + 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 + diff --git a/.github/workflows/webassembly.yml b/.github/workflows/webassembly.yml deleted file mode 100644 index daa48b6..0000000 --- a/.github/workflows/webassembly.yml +++ /dev/null @@ -1,103 +0,0 @@ -name: "webassembly" -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 - -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. -concurrency: - group: "pages" - cancel-in-progress: false - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: mymindstorm/setup-emsdk@v13 - with: - version: 3.1.37 - - uses: actions/checkout@v3 - - name: Install Qt native version (required by webassembly version) - uses: jurplel/install-qt-action@v3 - with: - aqtversion: '==3.1.*' - version: '6.6.1' - host: linux - target: 'desktop' - arch: gcc_64 - dir: '${{github.workspace}}/qt' - install-deps: 'true' - - - name: Set QT_HOST_PATH - run: echo "QT_HOST_PATH=${Qt6_DIR}" >> "$GITHUB_ENV" - - - name: Install Linux Dependencies - run: sudo apt-get install -y build-essential ninja-build - - - name: Install Qt Webassembly version - uses: jurplel/install-qt-action@v3 - with: - aqtversion: '==3.1.*' - version: '6.6.1' - host: linux - target: 'desktop' - arch: wasm_singlethread - dir: '${{github.workspace}}/qt' - install-deps: 'true' - - - name: Make qt webassembly binaries executable - run: | - chmod u+x ${Qt6_DIR}/bin/* - - - name: Verify emcc - run: emcc -v - - - name: Configure - env: - CMAKE_PREFIX_PATH: ${{env.Qt6_DIR}}/lib/cmake - run: > - ${Qt6_DIR}/bin/qt-cmake - -G Ninja - -B build - -DCMAKE_BUILD_TYPE=Release - -DAA_WWW_INSTALL_DIR=github_page - -DFMT_INSTALL=OFF - -S ${{ github.workspace }} - - - name: Build - run: cmake --build build --target install - - - name: Generate Directory Listings - uses: jayanta525/github-pages-directory-listing@v4.0.0 - with: - FOLDER: github_page - - - name: Create Pages artifact - uses: actions/upload-pages-artifact@v3 - with: - path: github_page - - deploy: - needs: build - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-latest - steps: - - name: Setup Pages - uses: actions/configure-pages@v4 - - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 - - - name: Debug output - run: echo ${{ steps.deployment.outputs.page_url }}