From e4a12d10e39886b4c56ec62217a44f431855734f Mon Sep 17 00:00:00 2001 From: nefarius2001 Date: Tue, 9 Feb 2021 09:38:35 +0100 Subject: [PATCH 1/2] unified autobuild github-action --- .../actions_scripts/analyse_git_reference.py | 21 +- .github/workflows/autobuild.yml | 222 ++++++++--- .github/workflows/codeql-analysis.yml | 87 ----- .../Dockerfile | 0 .../__example__jamulusbuild.sh | 0 .../action.yml | 0 .../build_qt_project.sh | 0 .../install-qt.sh | 0 android/autobuild/autobuild_apk_1_prepare.sh | 110 ++++++ android/autobuild/autobuild_apk_2_build.sh | 27 ++ .../autobuild/autobuild_apk_3_copy_files.sh | 37 ++ android/autobuild/install-qt.sh | 355 ++++++++++++++++++ distributions/io.jamulus.Jamulus.prepare.py | 15 + .../artifacts/autobuild_deb_1_prepare.sh} | 24 +- .../artifacts/autobuild_deb_2_build.sh | 12 + .../artifacts/autobuild_deb_3_copy_files.sh | 67 ++++ linux/autobuild/codeQL/auto_1_prepare.sh | 16 + .../codeQL/auto_2_build_qt_project.sh | 24 ++ .../artifacts/autobuild_mac_1_prepare.sh} | 17 +- .../artifacts/autobuild_mac_2_build.sh | 15 + .../artifacts/autobuild_mac_3_copy_files.sh | 39 ++ .../codeQL/autobuild_mac_1_prepare.sh | 41 ++ mac/autobuild/codeQL/autobuild_mac_2_build.sh | 24 ++ .../codeQL/autobuild_mac_3_copy_files.sh | 8 + .../autobuild_windowsinstaller_1_prepare.ps1} | 26 +- .../autobuild_windowsinstaller_2_build.ps1 | 21 ++ ...utobuild_windowsinstaller_3_copy_files.ps1 | 48 +++ 27 files changed, 1073 insertions(+), 183 deletions(-) delete mode 100644 .github/workflows/codeql-analysis.yml rename android/{automated_build => autobuild/archive___android_build_docker}/Dockerfile (100%) rename android/{automated_build => autobuild/archive___android_build_docker}/__example__jamulusbuild.sh (100%) rename android/{automated_build => autobuild/archive___android_build_docker}/action.yml (100%) rename android/{automated_build => autobuild/archive___android_build_docker}/build_qt_project.sh (100%) rename android/{automated_build => autobuild/archive___android_build_docker}/install-qt.sh (100%) create mode 100644 android/autobuild/autobuild_apk_1_prepare.sh create mode 100644 android/autobuild/autobuild_apk_2_build.sh create mode 100644 android/autobuild/autobuild_apk_3_copy_files.sh create mode 100644 android/autobuild/install-qt.sh rename linux/{autorelease_linux.sh => autobuild/artifacts/autobuild_deb_1_prepare.sh} (50%) mode change 100755 => 100644 create mode 100644 linux/autobuild/artifacts/autobuild_deb_2_build.sh create mode 100644 linux/autobuild/artifacts/autobuild_deb_3_copy_files.sh create mode 100644 linux/autobuild/codeQL/auto_1_prepare.sh create mode 100644 linux/autobuild/codeQL/auto_2_build_qt_project.sh rename mac/{autorelease_mac.sh => autobuild/artifacts/autobuild_mac_1_prepare.sh} (66%) mode change 100755 => 100644 create mode 100644 mac/autobuild/artifacts/autobuild_mac_2_build.sh create mode 100644 mac/autobuild/artifacts/autobuild_mac_3_copy_files.sh create mode 100644 mac/autobuild/codeQL/autobuild_mac_1_prepare.sh create mode 100644 mac/autobuild/codeQL/autobuild_mac_2_build.sh create mode 100644 mac/autobuild/codeQL/autobuild_mac_3_copy_files.sh rename windows/{autorelease_windows.ps1 => autobuild/autobuild_windowsinstaller_1_prepare.ps1} (65%) create mode 100644 windows/autobuild/autobuild_windowsinstaller_2_build.ps1 create mode 100644 windows/autobuild/autobuild_windowsinstaller_3_copy_files.ps1 diff --git a/.github/actions_scripts/analyse_git_reference.py b/.github/actions_scripts/analyse_git_reference.py index ab9ad4a3bf..85fda5e9cd 100755 --- a/.github/actions_scripts/analyse_git_reference.py +++ b/.github/actions_scripts/analyse_git_reference.py @@ -12,6 +12,7 @@ import sys import os +import subprocess # get the jamulus version from the .pro file def get_jamulus_version(repo_path_on_disk): @@ -28,6 +29,10 @@ def get_jamulus_version(repo_path_on_disk): return jamulus_version return "UNKNOWN_VERSION" +def get_git_hash(): + return subprocess.check_output(['git', 'describe', '--match=xxxxxxxxxxxxxxxxxxxx', '--always', '--abbrev', '--dirty']).decode('ascii').strip() + #return subprocess.check_output(['git', 'rev-parse', 'HEAD']) + #return subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']) if len(sys.argv) == 1: pass @@ -41,7 +46,15 @@ def get_jamulus_version(repo_path_on_disk): repo_path_on_disk = os.environ['GITHUB_WORKSPACE'] # derive git related variables -release_version_name = get_jamulus_version(repo_path_on_disk) +version_from_changelog = get_jamulus_version(repo_path_on_disk) +if "dev" in version_from_changelog: + release_version_name = "{}-{}".format(version_from_changelog, get_git_hash()) + print("building an intermediate version: ", release_version_name) +else: + release_version_name = version_from_changelog + print("building a release version: ", release_version_name) + + fullref=os.environ['GITHUB_REF'] reflist = fullref.split("/", 2) pushed_name = reflist[2] @@ -51,7 +64,7 @@ def get_jamulus_version(repo_path_on_disk): os.system('perl "{}"/.github/actions_scripts/getChangelog.pl "{}"/ChangeLog "{}" > "{}"/autoLatestChangelog.md'.format( os.environ['GITHUB_WORKSPACE'], os.environ['GITHUB_WORKSPACE'], - release_version_name, + version_from_changelog, os.environ['GITHUB_WORKSPACE'] )) @@ -74,7 +87,7 @@ def get_jamulus_version(repo_path_on_disk): print('this reference is a Non-Release-Tag') publish_to_release = False is_prerelease = True # just in case - + if pushed_name == "latest": print('this reference is a Latest-Tag') publish_to_release = True @@ -107,3 +120,5 @@ def set_github_variable(varname, varval): set_github_variable("PUSHED_NAME", pushed_name) set_github_variable("JAMULUS_VERSION", release_version_name) set_github_variable("RELEASE_VERSION_NAME", release_version_name) +set_github_variable("X_GITHUB_WORKSPACE", os.environ['GITHUB_WORKSPACE']) +set_github_variable("BUILD_FLATPACK", str(True).lower()) diff --git a/.github/workflows/autobuild.yml b/.github/workflows/autobuild.yml index f8938e7d11..8593abe409 100644 --- a/.github/workflows/autobuild.yml +++ b/.github/workflows/autobuild.yml @@ -6,20 +6,28 @@ on: tags: - "r*" - "latest" - #branches: + branches: + - "autobuild*" + - "autobuild/*" + # - master # - "*" - # - master - # - *autobuild* -name: Publish Release + #pull_request: # The branches below must be a subset of the branches in "push" + # branches: + # - master + +name: Auto-Build jobs: create_release: name: Create release - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 outputs: publish_to_release: ${{ steps.jamulus-build-vars.outputs.PUBLISH_TO_RELEASE }} upload_url: ${{ steps.create_release_step.outputs.upload_url }} version: ${{ steps.jamulus-build-vars.outputs.JAMULUS_VERSION }} version_name: ${{ steps.jamulus-build-vars.outputs.RELEASE_VERSION_NAME }} + x_github_workspace: ${{ steps.jamulus-build-vars.outputs.X_GITHUB_WORKSPACE }} #needed, because matrix can not directly access ${{ github.workspace }} aparrently + build_flatpack: ${{ steps.jamulus-build-vars.outputs.BUILD_FLATPACK }} + steps: # Checkout code @@ -65,92 +73,188 @@ jobs: release_assets: name: Build assets for ${{ matrix.config.config_name }} needs: create_release - runs-on: ${{ matrix.config.building_on_os }} strategy: fail-fast: false matrix: # Think of this like a foreach loop. Basically runs the steps with every combination of the contents of this. More info: https://docs.github.com/en/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix - config: - - config_name: Linux (normal) + config: + - config_name: AndroidAPK (artifact+codeql) + target_os: android + building_on_os: ubuntu-20.04 + cmd1_prebuild: "sh android/autobuild/autobuild_apk_1_prepare.sh " + cmd2_build: "sh android/autobuild/autobuild_apk_2_build.sh " + cmd3_postbuild: "sh android/autobuild/autobuild_apk_3_copy_files.sh " + uses_codeql: true + + - config_name: Linux (codeQL) target_os: linux - building_on_os: ubuntu-18.04 - asset_path: deploy/Jamulus_amd64.deb - asset_name: jamulus_${{ needs.create_release.outputs.version_name }}_ubuntu_amd64.deb - - config_name: Linux (headless) + building_on_os: ubuntu-20.04 + cmd1_prebuild: "sh linux/autobuild/codeQL/auto_1_prepare.sh ${{ needs.create_release.outputs.x_github_workspace }}" + cmd2_build: "sh linux/autobuild/codeQL/auto_2_build_qt_project.sh " + cmd3_postbuild: false + uses_codeql: true + + - config_name: Linux (artifacts) target_os: linux - building_on_os: ubuntu-18.04 - asset_path: deploy/Jamulus_headless_amd64.deb - asset_name: jamulus_headless_${{ needs.create_release.outputs.version_name }}_ubuntu_amd64.deb - - config_name: MacOS + building_on_os: ubuntu-20.04 + cmd1_prebuild: "sh linux/autobuild/artifacts/autobuild_deb_1_prepare.sh " + cmd2_build: "sh linux/autobuild/artifacts/autobuild_deb_2_build.sh " + cmd3_postbuild: "sh linux/autobuild/artifacts/autobuild_deb_3_copy_files.sh " + uses_codeql: false + + - config_name: MacOS (codeQL) + target_os: macos + building_on_os: macos-10.15 + cmd1_prebuild: "sh mac/autobuild/codeQL/autobuild_mac_1_prepare.sh " + cmd2_build: "sh mac/autobuild/codeQL/autobuild_mac_2_build.sh " + cmd3_postbuild: "sh mac/autobuild/codeQL/autobuild_mac_3_copy_files.sh " + uses_codeql: true + + - config_name: MacOS (artifacts) target_os: macos building_on_os: macos-10.15 - asset_path: deploy/Jamulus-installer-mac.dmg - asset_name: jamulus_${{ needs.create_release.outputs.version_name }}_mac.dmg - - config_name: Windows + cmd1_prebuild: "sh mac/autobuild/artifacts/autobuild_mac_1_prepare.sh " + cmd2_build: "sh mac/autobuild/artifacts/autobuild_mac_2_build.sh " + cmd3_postbuild: "sh mac/autobuild/artifacts/autobuild_mac_3_copy_files.sh " + uses_codeql: false + + - config_name: Windows (artifact+codeql) target_os: windows building_on_os: windows-latest - asset_path: deploy\Jamulus-installer-win.exe - asset_name: jamulus_${{ needs.create_release.outputs.version_name }}_win.exe - - config_name: AndroidAPK - target_os: android - building_on_os: ubuntu-18.04 - asset_path: android-build/build/outputs/apk/debug/android-build-debug.apk - asset_name: jamulus_${{ needs.create_release.outputs.version_name }}_android.apk + cmd1_prebuild: powershell ./windows/autobuild/autobuild_windowsinstaller_1_prepare.ps1 -sourcepath + cmd2_build: powershell ./windows/autobuild/autobuild_windowsinstaller_2_build.ps1 -sourcepath + cmd3_postbuild: powershell ./windows/autobuild/autobuild_windowsinstaller_3_copy_files.ps1 -sourcepath + uses_codeql: true + + runs-on: ${{ matrix.config.building_on_os }} steps: - # Checkout code - name: Checkout code uses: actions/checkout@v2 with: submodules: true + + # Prepare (install QT & dependencies) + - name: "Prepare for ${{ matrix.config.config_name }}" + if: ${{ matrix.config.cmd1_prebuild }} + run: ${{ matrix.config.cmd1_prebuild }} ${{ github.workspace }} + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' # allow setting environment variables + jamulus_project_path: ${{ github.workspace }} + jamulus_buildversionstring: ${{ needs.create_release.outputs.version_name }} + + # Initialize CodeQL tools for code-scanning for security + - name: Initialize CodeQL + if: matrix.config.uses_codeql + uses: github/codeql-action/init@v1 + with: + languages: 'cpp' + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] + # Learn more: + # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed # Build - - name: "Build deb (Linux)" - run: sh linux/autorelease_linux.sh ${{ github.workspace }} - if: matrix.config.target_os == 'linux' - - name: "Build (Windows)" - run: powershell .\windows\autorelease_windows.ps1 -sourcepath "${{ github.workspace }}" - if: matrix.config.target_os == 'windows' - - name: "Build (macOS)" - run: sh mac/autorelease_mac.sh ${{ github.workspace }} - if: matrix.config.target_os == 'macos' - - name: "Build (Android)" - uses: ./android/automated_build/ # Uses an action in the directory - if: matrix.config.target_os == 'android' + - name: "Build for ${{ matrix.config.config_name }}" + if: ${{ matrix.config.cmd2_build }} + run: ${{ matrix.config.cmd2_build }} ${{ github.workspace }} + env: + jamulus_project_path: ${{ github.workspace }} + jamulus_buildversionstring: ${{ needs.create_release.outputs.version_name }} + + - name: "Post-Build for ${{ matrix.config.config_name }}" + id: step_cmd3_postbuild + if: ${{ matrix.config.cmd3_postbuild }} + run: ${{ matrix.config.cmd3_postbuild }} ${{ github.workspace }} + env: + jamulus_project_path: ${{ github.workspace }} + jamulus_buildversionstring: ${{ needs.create_release.outputs.version_name }} + + # Upload Artifact to Job + - name: Upload Artifact 1 to Job + if: ${{ steps.step_cmd3_postbuild.outputs.artifact_1 }} + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.step_cmd3_postbuild.outputs.artifact_1 }} + path: deploy/${{ steps.step_cmd3_postbuild.outputs.artifact_1 }} + retention-days: 31 + + # Upload Artifact to Job + - name: Upload Artifact 2 to Job + if: ${{ steps.step_cmd3_postbuild.outputs.artifact_2 }} + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.step_cmd3_postbuild.outputs.artifact_2 }} + path: deploy/${{ steps.step_cmd3_postbuild.outputs.artifact_2 }} + retention-days: 31 - # Upload release - - name: Upload Release Asset - Tag - if: ${{ contains(needs.create_release.outputs.publish_to_release, 'true') }} - id: upload-release-asset + # Upload Artifact to Release + - name: Upload Artifact 1 to Release + if: ${{ (steps.step_cmd3_postbuild.outputs.artifact_1 != '') && contains(needs.create_release.outputs.publish_to_release, 'true') }} + id: upload-release-asset1 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create_release.outputs.upload_url }} # See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps + asset_path: deploy/${{ steps.step_cmd3_postbuild.outputs.artifact_1 }} + asset_name: ${{ steps.step_cmd3_postbuild.outputs.artifact_1 }} + asset_content_type: application/octet-stream + # Upload Artifact to Release + - name: Upload Artifact 2 to Release + if: ${{ (steps.step_cmd3_postbuild.outputs.artifact_2 != '') && contains(needs.create_release.outputs.publish_to_release, 'true') }} + id: upload-release-asset2 uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ needs.create_release.outputs.upload_url }} # See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps - asset_path: ${{ matrix.config.asset_path }} - asset_name: ${{ matrix.config.asset_name }} + asset_path: deploy/${{ steps.step_cmd3_postbuild.outputs.artifact_2 }} + asset_name: ${{ steps.step_cmd3_postbuild.outputs.artifact_2 }} asset_content_type: application/octet-stream + # Run CodeQL tools for code-scanning for security + - name: Perform CodeQL Analysis + if: matrix.config.uses_codeql + uses: github/codeql-action/analyze@v1 + + ## Builds a Linux flatpack ## flatpak-builder: - name: "Flatpak Builder" - runs-on: ubuntu-latest + name: "Build Flatpak (artifact)" + if: ${{ contains(needs.create_release.outputs.build_flatpack, 'true') }} + runs-on: ubuntu-20.04 needs: [create_release] container: image: docker.io/bilelmoussaoui/flatpak-github-actions options: --privileged steps: - uses: actions/checkout@v2 - - name: Change branch name in manifest - run: python3 io.jamulus.Jamulus.prepare.py $GITHUB_SHA - working-directory: ./distributions/ - - uses: bilelmoussaoui/flatpak-github-actions@v2 - with: - bundle: "io.jamulus.Jamulus.flatpak" - manifest-path: "distributions/io.jamulus.Jamulus.json" - - uses: actions/download-artifact@v2 + - id: flatpak-prepare + name: Change branch name in manifest + run: python3 io.jamulus.Jamulus.prepare.py $GITHUB_SHA + working-directory: ./distributions/ + env: + jamulus_project_path: ${{ github.workspace }} + jamulus_buildversionstring: ${{ needs.create_release.outputs.version_name }} + - uses: bilelmoussaoui/flatpak-github-actions@v2 + with: + bundle: "${{ steps.flatpak-prepare.outputs.flatpak_bundle }}" + manifest-path: "distributions/io.jamulus.Jamulus.json" + + # download artifact + - id: flatpak-download + uses: actions/download-artifact@v2 with: - name: io.jamulus.Jamulus - path: ~/io.jamulus.Jamulus + name: ${{ steps.flatpak-prepare.outputs.flatpak_name }} + path: ~/${{ steps.flatpak-prepare.outputs.flatpak_name }} + + - name: echo download-path + run: "echo ${{steps.flatpak-download.outputs.download-path}}" + - name: ls download-path + run: "ls ${{steps.flatpak-download.outputs.download-path}}" + - name: ls githome ~ + run: "ls ~/" + + # Upload Artifact to Release - name: Upload Flatpack if: ${{ contains(needs.create_release.outputs.publish_to_release, 'true') }} id: upload-release-asset @@ -159,6 +263,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ needs.create_release.outputs.upload_url }} # See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps - asset_path: /github/home/io.jamulus.Jamulus/io.jamulus.Jamulus.flatpak - asset_name: io.jamulus.Jamulus.flatpak + asset_path: ${{steps.flatpak-download.outputs.download-path}}/${{ steps.flatpak-prepare.outputs.flatpak_bundle }} + asset_name: ${{ steps.flatpak-prepare.outputs.flatpak_name }} asset_content_type: application/octet-stream diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index c48e877c71..0000000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,87 +0,0 @@ -name: "CodeQL" - -on: - push: - branches: [ master ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ master ] - schedule: - - cron: '23 11 * * 6' - -jobs: - analyze: - name: Analyze - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - language: [ 'cpp' ] - #language: [ 'cpp', 'javascript', 'python' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] - # Learn more: - # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed - os: [ 'macos-latest', 'ubuntu-latest', 'windows-latest' ] - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Install Qt on Linux - run: | - sudo apt-get update - sudo apt install build-essential qt5-qmake qtdeclarative5-dev qt5-default qttools5-dev-tools libjack-jackd2-dev - if: matrix.os == 'ubuntu-latest' - - - name: Install Qt on MacOS - uses: jurplel/install-qt-action@v2 - with: - version: '5.15.2' - dir: '${{ github.workspace }}' - if: matrix.os == 'macos-latest' - - - name: Install Qt on Windows - uses: jurplel/install-qt-action@v2 - with: - version: '5.15.2' - dir: '${{ github.workspace }}' - arch: 'win64_msvc2019_64' - tools: 'tools_qtcreator,4.14.0-0,qt.tools.qtcreator' - if: matrix.os == 'windows-latest' - - - name: Install ASIOSDK - shell: pwsh - run: | - Invoke-WebRequest -Uri "http://www.steinberg.net/asiosdk" -OutFile "asiosdk.zip" - Expand-Archive -Path "asiosdk.zip" -DestinationPath "ASIOSDK" - Get-ChildItem -Path "ASIOSDK/asiosdk_2*/*" -Recurse | Move-Item -Destination "windows/ASIOSDK2" - if: matrix.os == 'windows-latest' - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - - - name: Build elsewhere - run: | - [ -x /Users/runner/work/jamulus/jamulus/Qt/5.15.2/clang_64/bin/qmake ] && \ - /Users/runner/work/jamulus/jamulus/Qt/5.15.2/clang_64/bin/qmake || qmake - make - if: matrix.os != 'windows-latest' - - - name: Visual Studio shell - uses: egor-tensin/vs-shell@v2 - if: matrix.os == 'windows-latest' - - - name: Build on Windows - shell: cmd - run: | - D:\a\jamulus\jamulus\Qt\5.15.2\msvc2019_64\bin\qmake.exe Jamulus.pro -spec win32-msvc - D:\a\jamulus\jamulus\Qt\Tools\QtCreator\bin\jom.exe qmake_all - D:\a\jamulus\jamulus\Qt\Tools\QtCreator\bin\jom.exe - if: matrix.os == 'windows-latest' - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 diff --git a/android/automated_build/Dockerfile b/android/autobuild/archive___android_build_docker/Dockerfile similarity index 100% rename from android/automated_build/Dockerfile rename to android/autobuild/archive___android_build_docker/Dockerfile diff --git a/android/automated_build/__example__jamulusbuild.sh b/android/autobuild/archive___android_build_docker/__example__jamulusbuild.sh similarity index 100% rename from android/automated_build/__example__jamulusbuild.sh rename to android/autobuild/archive___android_build_docker/__example__jamulusbuild.sh diff --git a/android/automated_build/action.yml b/android/autobuild/archive___android_build_docker/action.yml similarity index 100% rename from android/automated_build/action.yml rename to android/autobuild/archive___android_build_docker/action.yml diff --git a/android/automated_build/build_qt_project.sh b/android/autobuild/archive___android_build_docker/build_qt_project.sh similarity index 100% rename from android/automated_build/build_qt_project.sh rename to android/autobuild/archive___android_build_docker/build_qt_project.sh diff --git a/android/automated_build/install-qt.sh b/android/autobuild/archive___android_build_docker/install-qt.sh similarity index 100% rename from android/automated_build/install-qt.sh rename to android/autobuild/archive___android_build_docker/install-qt.sh diff --git a/android/autobuild/autobuild_apk_1_prepare.sh b/android/autobuild/autobuild_apk_1_prepare.sh new file mode 100644 index 0000000000..dd4b9622e9 --- /dev/null +++ b/android/autobuild/autobuild_apk_1_prepare.sh @@ -0,0 +1,110 @@ +#!/bin/sh -e + +# Please run this script with the first parameter being the root of the repo +if [ -z "${1}" ]; then + echo "Please give the path to the repository root as second parameter to this script!" + exit 1 +fi +#if [ ! -z "${1}" ]; then +# THIS_WORKSPACE="${1}" +#elif [ ! -z "${1}" ]; then +# THIS_WORKSPACE="${GITHUB_WORKSPACE}" +#else +# echo "Please give the path to the repository root as second parameter to this script!" +# exit 1 +#fi + +# Sets up the environment for autobuild on Linux + + +#FROM ubuntu:18.04 + +#based on https://gitlab.com/vikingsoftware/qt5.12.4androiddocker +#LABEL "Maintainer"="Guenter Schwann" +#LABEL "version"="0.3" + +export DEBIAN_FRONTEND="noninteractive" +echo "::set-env name=DEBIAN_FRONTEND::${DEBIAN_FRONTEND}" + +sudo apt-get update +sudo apt-get -qq -y install build-essential git zip unzip bzip2 p7zip-full wget curl chrpath libxkbcommon-x11-0 +# Dependencies to create Android pkg +sudo apt-get -qq -y install openjdk-8-jre openjdk-8-jdk openjdk-8-jdk-headless gradle +# Clean apt cache +sudo apt-get clean +rm -rf /var/lib/apt/lists/* + +# Add Android tools and platform tools to PATH +export ANDROID_HOME="/opt/android/android-sdk" +export ANDROID_SDK_ROOT="/opt/android/android-sdk" +export ANDROID_NDK_ROOT="/opt/android/android-ndk" + +export PATH="$PATH:$ANDROID_HOME/tools" +export PATH="$PATH:$ANDROID_HOME/platform-tools" +export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/" + +# other variables +export MY_QT_VERSION="5.15.2" +export ANDROID_NDK_HOST="linux-x86_64" +export ANDROID_SDKMANAGER="$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" + +# paths for Android SDK +mkdir -p ${ANDROID_SDK_ROOT}/cmdline-tools/latest/ +mkdir -p ${ANDROID_SDK_ROOT}/build-tools/latest/ + +# Install Android sdk +#https://dl.google.com/android/repository/commandlinetools-linux-6858069_latest.zip +#https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip +downloadfile="downloadfile" +wget -q -O downloadfile https://dl.google.com/android/repository/commandlinetools-linux-6858069_latest.zip +unzip -q downloadfile +rm downloadfile +mv cmdline-tools/* /opt/android/android-sdk/cmdline-tools/latest/ +rm -r cmdline-tools + +# Install Android ndk +#https://dl.google.com/android/repository/android-ndk-r19c-linux-x86_64.zip +#https://dl.google.com/android/repository/android-ndk-r21d-linux-x86_64.zip +downloadfile="downloadfile" +wget -q -O downloadfile https://dl.google.com/android/repository/android-ndk-r21d-linux-x86_64.zip +unzip -q downloadfile +rm downloadfile +mv android-ndk-r21d /opt/android/android-ndk + + +# Install Android SDK +yes | $ANDROID_SDKMANAGER --licenses +#echo yes | $ANDROID_SDKMANAGER --licenses +$ANDROID_SDKMANAGER --update +#$ANDROID_SDKMANAGER "platforms;android-17" +#$ANDROID_SDKMANAGER "platforms;android-28" +$ANDROID_SDKMANAGER "platforms;android-30" +#$ANDROID_SDKMANAGER "build-tools;28.0.3" +$ANDROID_SDKMANAGER "build-tools;30.0.2" + + + +# Download / install Qt +####ADD https://code.qt.io/cgit/qbs/qbs.git/plain/scripts/install-qt.sh ./ +#COPY install-qt.sh /install-qt.sh +THIS_SCRIPT=$(readlink -f "$0") +# Absolute path this script is in, thus /home/user/bin +THIS_SCRIPT_PATH=$(dirname "$THIS_SCRIPT") +bash $THIS_SCRIPT_PATH/install-qt.sh --version $MY_QT_VERSION --target android --toolchain android qtbase qt3d qtdeclarative qtandroidextras qtconnectivity qtgamepad qtlocation qtmultimedia qtquickcontrols2 qtremoteobjects qtscxml qtsensors qtserialport qtsvg qtimageformats qttools qtspeech qtwebchannel qtwebsockets qtwebview qtxmlpatterns qttranslations + +# Set the QTDIR environment variable +export QTDIR="/opt/Qt/$MY_QT_VERSION/android" + + +#necessary +echo "::set-env name=QTDIR::${QTDIR}" +echo "::set-env name=ANDROID_NDK_ROOT::${ANDROID_NDK_ROOT}" +echo "::set-env name=ANDROID_NDK_HOST::${ANDROID_NDK_HOST}" +echo "::set-env name=JAVA_HOME::${JAVA_HOME}" + +#nce to have +echo "::set-env name=ANDROID_HOME::${ANDROID_HOME}" +echo "::set-env name=ANDROID_SDK_ROOT::${ANDROID_SDK_ROOT}" +echo "::set-env name=PATH::${PATH}" +echo "::set-env name=MY_QT_VERSION::${MY_QT_VERSION}" +echo "::set-env name=ANDROID_SDKMANAGER::${ANDROID_SDKMANAGER}" diff --git a/android/autobuild/autobuild_apk_2_build.sh b/android/autobuild/autobuild_apk_2_build.sh new file mode 100644 index 0000000000..158200655f --- /dev/null +++ b/android/autobuild/autobuild_apk_2_build.sh @@ -0,0 +1,27 @@ +#!/bin/bash -e + +# Please run this script with the first parameter being the root of the repo +if [ -z "${1}" ]; then + echo "Please give the path to the repository root as second parameter to this script!" + exit 1 +fi + +cd ${1} + +#$QTDIR/bin/qmake -spec android-clang CONFIG+=$CONFIG +$QTDIR/bin/qmake -spec android-clang CONFIG+=release +echo . +echo . +echo . +echo . +/opt/android/android-ndk/prebuilt/linux-x86_64/bin/make +echo . +echo . +echo . +echo . +$ANDROID_NDK_ROOT/prebuilt/$ANDROID_NDK_HOST/bin/make INSTALL_ROOT=android-build -f Makefile install +echo . +echo . +echo . +echo . +$QTDIR/bin/androiddeployqt --input $(ls *.json) --output android-build --android-platform android-30 --jdk $JAVA_HOME --gradle diff --git a/android/autobuild/autobuild_apk_3_copy_files.sh b/android/autobuild/autobuild_apk_3_copy_files.sh new file mode 100644 index 0000000000..1ed37afab7 --- /dev/null +++ b/android/autobuild/autobuild_apk_3_copy_files.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# Please run this script with the first parameter being the root of the repo +if [ -z "${1}" ]; then + echo "Please give the path to the repository root as second parameter to this script!" + exit 1 +fi + + +mkdir ${1}/deploy + +echo "" +echo "" +echo "ls GITROOT/android-build/build/outputs/apk/debug/" +ls ${1}/android-build/build/outputs/apk/debug/ +echo "" + + +artifact_deploy_filename=jamulus_${jamulus_buildversionstring}_android.apk +echo "" +echo "" +echo "move to ${artifact_deploy_filename}" +mv ${1}/android-build/build/outputs/apk/debug/android-build-debug.apk ${1}/deploy/${artifact_deploy_filename} + +echo "" +echo "" +echo "ls GITROOT/deploy/" +ls ${1}/deploy/ +echo "" + +github_output_value() +{ + echo "github_output_value() ${1} = ${2}" + echo "::set-output name=${1}::${2}" +} + +github_output_value artifact_1 ${artifact_deploy_filename} diff --git a/android/autobuild/install-qt.sh b/android/autobuild/install-qt.sh new file mode 100644 index 0000000000..2bae78a963 --- /dev/null +++ b/android/autobuild/install-qt.sh @@ -0,0 +1,355 @@ +#!/usr/bin/env bash +############################################################################# +## +## Copyright (C) 2019 Richard Weickelt. +## Contact: https://www.qt.io/licensing/ +## +## This file is part of Qbs. +## +## $QT_BEGIN_LICENSE:LGPL$ +## Commercial License Usage +## Licensees holding valid commercial Qt licenses may use this file in +## accordance with the commercial license agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and The Qt Company. For licensing terms +## and conditions see https://www.qt.io/terms-conditions. For further +## information use the contact form at https://www.qt.io/contact-us. +## +## GNU Lesser General Public License Usage +## Alternatively, this file may be used under the terms of the GNU Lesser +## General Public License version 3 as published by the Free Software +## Foundation and appearing in the file LICENSE.LGPL3 included in the +## packaging of this file. Please review the following information to +## ensure the GNU Lesser General Public License version 3 requirements +## will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +## +## GNU General Public License Usage +## Alternatively, this file may be used under the terms of the GNU +## General Public License version 2.0 or (at your option) the GNU General +## Public license version 3 or any later version approved by the KDE Free +## Qt Foundation. The licenses are as published by the Free Software +## Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +## included in the packaging of this file. Please review the following +## information to ensure the GNU General Public License requirements will +## be met: https://www.gnu.org/licenses/gpl-2.0.html and +## https://www.gnu.org/licenses/gpl-3.0.html. +## +## $QT_END_LICENSE$ +## +############################################################################# + +## https://code.qt.io/cgit/qbs/qbs.git/tree/scripts/install-qt.sh + +set -eu + +function help() { + cat < + Root directory where to install the components. + Maps to C:/Qt on Windows, /opt/Qt on Linux, /usr/local/Qt on Mac + by default. + + -f, --force + Force download and do not attempt to re-use an existing installation. + + --host + The host operating system. Can be one of linux_x64, mac_x64, + windows_x86. Auto-detected by default. + + --target + The desired target platform. Can be one of desktop, android, ios. + The default value is desktop. + + --toolchain + The toolchain that has been used to build the binaries. + Possible values depend on --host and --target, respectively: + + linux_x64 + android + any, android_armv7, android_arm64_v8a + desktop + gcc_64 (default) + + mac_x64 + android + any, android_armv7, android_arm64_v8a + desktop + clang_64 (default), + ios + ios + + windows_x86 + android + any, android_armv7, android_arm64_v8a + desktop + win64_mingw73, win64_msvc2017_64 (default) + + --version + The desired Qt version. Currently supported are all versions + above 5.9.0. + +EOF +} + +TARGET_PLATFORM=desktop +COMPONENTS= +VERSION= +FORCE_DOWNLOAD=false +MD5_TOOL=md5sum + +case "$OSTYPE" in + *linux*) + HOST_OS=linux_x64 + INSTALL_DIR=/opt/Qt + TOOLCHAIN=gcc_64 + ;; + *darwin*) + HOST_OS=mac_x64 + INSTALL_DIR=/usr/local/Qt + TOOLCHAIN=clang_64 + MD5_TOOL="md5 -r" + ;; + msys) + HOST_OS=windows_x86 + INSTALL_DIR=/c/Qt + TOOLCHAIN=win64_msvc2015_64 + ;; + *) + HOST_OS= + INSTALL_DIR= + ;; +esac + +while [ $# -gt 0 ]; do + case "$1" in + --directory|-d) + INSTALL_DIR="$2" + shift + ;; + --force|-f) + FORCE_DOWNLOAD=true + ;; + --host) + HOST_OS="$2" + shift + ;; + --target) + TARGET_PLATFORM="$2" + shift + ;; + --toolchain) + TOOLCHAIN=$(echo $2 | tr '[A-Z]' '[a-z]') + shift + ;; + --version) + VERSION="$2" + shift + ;; + --help|-h) + help + exit 0 + ;; + *) + COMPONENTS="${COMPONENTS} $1" + ;; + esac + shift +done + +if [ -z "${HOST_OS}" ]; then + echo "No --host specified or auto-detection failed." >&2 + exit 1 +fi + +if [ -z "${INSTALL_DIR}" ]; then + echo "No --directory specified or auto-detection failed." >&2 + exit 1 +fi + +if [ -z "${VERSION}" ]; then + echo "No --version specified." >&2 + exit 1 +fi + +if [ -z "${COMPONENTS}" ]; then + echo "No components specified." >&2 + exit 1 +fi + +case "$TARGET_PLATFORM" in + android) + ;; + ios) + ;; + desktop) + ;; + *) + echo "Error: TARGET_PLATFORM=${TARGET_PLATFORM} is not valid." >&2 + exit 1 + ;; +esac + +HASH=$(echo "${OSTYPE} ${TARGET_PLATFORM} ${TOOLCHAIN} ${VERSION} ${INSTALL_DIR}" | ${MD5_TOOL} | head -c 16) +HASH_FILEPATH="${INSTALL_DIR}/${HASH}.manifest" +INSTALLATION_IS_VALID=false +if ! ${FORCE_DOWNLOAD} && [ -f "${HASH_FILEPATH}" ]; then + INSTALLATION_IS_VALID=true + while read filepath; do + if [ ! -e "${filepath}" ]; then + INSTALLATION_IS_VALID=false + break + fi + done <"${HASH_FILEPATH}" +fi + +if ${INSTALLATION_IS_VALID}; then + echo "Already installed. Skipping download." >&2 + exit 0 +fi + +MIRRORS="\ + http://download.qt.io \ + http://ftp.acc.umu.se/mirror/qt.io/qtproject \ + http://qt.mirrors.tds.net/qt \ + http://ftp.fau.de/qtproject \ +" + +for MIRROR in ${MIRRORS}; do + if curl "${MIRROR}/online" -s -f -o /dev/null; then + break; + else + echo "Server ${MIRROR} not availabe. Trying next alternative..." >&2 + MIRROR="" + fi +done + +DOWNLOAD_DIR=`mktemp -d 2>/dev/null || mktemp -d -t 'install-qt'` + +# +# The repository structure is a mess. Try different URL variants +# +function compute_url(){ + local COMPONENT=$1 + local CURL="curl -s -L" + local BASE_URL="${MIRROR}/online/qtsdkrepository/${HOST_OS}/${TARGET_PLATFORM}" + local ANDROID_ARCH=$(echo ${TOOLCHAIN##android_}) + + if [[ "${COMPONENT}" =~ "qtcreator" ]]; then + + SHORT_VERSION=${VERSION%??} + BASE_URL="${MIRROR}/official_releases/qtcreator" + REMOTE_PATH="${SHORT_VERSION}/${VERSION}/installer_source/${HOST_OS}/qtcreator.7z" + echo "${BASE_URL}/${REMOTE_PATH}" + return 0 + + else + REMOTE_BASES=( + # New repository format (>=6.0.0) + "qt6_${VERSION//./}/qt.qt6.${VERSION//./}.${TOOLCHAIN}" + "qt6_${VERSION//./}_${ANDROID_ARCH}/qt.qt6.${VERSION//./}.${TOOLCHAIN}" + "qt6_${VERSION//./}_${ANDROID_ARCH}/qt.qt6.${VERSION//./}.${COMPONENT}.${TOOLCHAIN}" + # New repository format (>=5.9.6) + "qt5_${VERSION//./}/qt.qt5.${VERSION//./}.${TOOLCHAIN}" + "qt5_${VERSION//./}/qt.qt5.${VERSION//./}.${COMPONENT}.${TOOLCHAIN}" + # Multi-abi Android since 5.14 + "qt5_${VERSION//./}/qt.qt5.${VERSION//./}.${TARGET_PLATFORM}" + "qt5_${VERSION//./}/qt.qt5.${VERSION//./}.${COMPONENT}.${TARGET_PLATFORM}" + # Older repository format (<5.9.0) + "qt5_${VERSION//./}/qt.${VERSION//./}.${TOOLCHAIN}" + "qt5_${VERSION//./}/qt.${VERSION//./}.${COMPONENT}.${TOOLCHAIN}" + ) + + for REMOTE_BASE in ${REMOTE_BASES[*]}; do + REMOTE_PATH="$(${CURL} ${BASE_URL}/${REMOTE_BASE}/ | grep -o -E "[[:alnum:]_.\-]*7z" | grep "${COMPONENT}" | tail -1)" + if [ ! -z "${REMOTE_PATH}" ]; then + echo "${BASE_URL}/${REMOTE_BASE}/${REMOTE_PATH}" + return 0 + fi + done + fi + + echo "Could not determine a remote URL for ${COMPONENT} with version ${VERSION}">&2 + exit 1 +} + +mkdir -p ${INSTALL_DIR} +rm -f "${HASH_FILEPATH}" + +for COMPONENT in ${COMPONENTS}; do + + URL="$(compute_url ${COMPONENT})" + echo "Downloading ${COMPONENT} ${URL}..." >&2 + curl --progress-bar -L -o ${DOWNLOAD_DIR}/package.7z ${URL} >&2 + 7z x -y -o${INSTALL_DIR} ${DOWNLOAD_DIR}/package.7z >/dev/null 2>&1 + 7z l -ba -slt -y ${DOWNLOAD_DIR}/package.7z | tr '\\' '/' | sed -n -e "s|^Path\ =\ |${INSTALL_DIR}/|p" >> "${HASH_FILEPATH}" 2>/dev/null + rm -f ${DOWNLOAD_DIR}/package.7z + + # + # conf file is needed for qmake + # + if [ "${COMPONENT}" == "qtbase" ]; then + if [[ "${TOOLCHAIN}" =~ "win64_mingw" ]]; then + SUBDIR="${TOOLCHAIN/win64_/}_64" + elif [[ "${TOOLCHAIN}" =~ "win32_mingw" ]]; then + SUBDIR="${TOOLCHAIN/win32_/}_32" + elif [[ "${TOOLCHAIN}" =~ "win64_msvc" ]]; then + SUBDIR="${TOOLCHAIN/win64_/}" + elif [[ "${TOOLCHAIN}" =~ "win32_msvc" ]]; then + SUBDIR="${TOOLCHAIN/win32_/}" + elif [[ "${TOOLCHAIN}" =~ "any" ]] && [[ "${TARGET_PLATFORM}" == "android" ]]; then + SUBDIR="android" + else + SUBDIR="${TOOLCHAIN}" + fi + + if [ "${TARGET_PLATFORM}" == "android" ] && [ ! "${VERSION}" \< "6.0.0" ]; then + CONF_FILE="${INSTALL_DIR}/${VERSION}/${SUBDIR}/bin/target_qt.conf" + sed -i "s|target|../$TOOLCHAIN|g" "${CONF_FILE}" + sed -i "/HostPrefix/ s|$|gcc_64|g" "${CONF_FILE}" + ANDROID_QMAKE_FILE="${INSTALL_DIR}/${VERSION}/${SUBDIR}/bin/qmake" + QMAKE_FILE="${INSTALL_DIR}/${VERSION}/gcc_64/bin/qmake" + sed -i "s|\/home\/qt\/work\/install\/bin\/qmake|$QMAKE_FILE|g" "${ANDROID_QMAKE_FILE}" + else + CONF_FILE="${INSTALL_DIR}/${VERSION}/${SUBDIR}/bin/qt.conf" + echo "[Paths]" > ${CONF_FILE} + echo "Prefix = .." >> ${CONF_FILE} + fi + + # Adjust the license to be able to run qmake + # sed with -i requires intermediate file on Mac OS + PRI_FILE="${INSTALL_DIR}/${VERSION}/${SUBDIR}/mkspecs/qconfig.pri" + sed -i.bak 's/Enterprise/OpenSource/g' "${PRI_FILE}" + sed -i.bak 's/licheck.*//g' "${PRI_FILE}" + rm "${PRI_FILE}.bak" + + # Print the directory so that the caller can + # adjust the PATH variable. + echo $(dirname "${CONF_FILE}") + elif [[ "${COMPONENT}" =~ "qtcreator" ]]; then + if [ "${HOST_OS}" == "mac_x64" ]; then + echo "${INSTALL_DIR}/Qt Creator.app/Contents/MacOS" + else + echo "${INSTALL_DIR}/bin" + fi + fi + +done + diff --git a/distributions/io.jamulus.Jamulus.prepare.py b/distributions/io.jamulus.Jamulus.prepare.py index 09baaf8285..959f3889d6 100644 --- a/distributions/io.jamulus.Jamulus.prepare.py +++ b/distributions/io.jamulus.Jamulus.prepare.py @@ -1,5 +1,6 @@ #!/usr/bin/python3 +import os import sys import json @@ -24,3 +25,17 @@ print("write {}".format(jsonfilename)) with open(jsonfilename,'w') as file: json.dump(data, file, indent=2) + + + +#helper function: set github variable and print it to console +def set_github_variable(varname, varval): + print("{}='{}'".format(varname, varval)) #console output + print("::set-output name={}::{}".format(varname, varval)) + +#set github-available variables +jamulus_buildversionstring = os.environ['jamulus_buildversionstring'] +flatpak_name = "jamulus_{:}_flatpak".format(jamulus_buildversionstring) +set_github_variable("flatpak_name", flatpak_name) +flatpak_bundle = "{:}.flatpak".format(flatpak_name) +set_github_variable("flatpak_bundle", flatpak_bundle) \ No newline at end of file diff --git a/linux/autorelease_linux.sh b/linux/autobuild/artifacts/autobuild_deb_1_prepare.sh old mode 100755 new mode 100644 similarity index 50% rename from linux/autorelease_linux.sh rename to linux/autobuild/artifacts/autobuild_deb_1_prepare.sh index 15c32b31d6..9e81aae961 --- a/linux/autorelease_linux.sh +++ b/linux/autobuild/artifacts/autobuild_deb_1_prepare.sh @@ -1,34 +1,16 @@ #!/bin/sh -e -# Sets up the environment for autobuild on Linux - # Please run this script with the first parameter being the root of the repo if [ -z "${1}" ]; then echo "Please give the path to the repository root as second parameter to this script!" exit 1 fi +# Sets up the environment for autobuild on Linux + echo "Update system..." sudo apt-get -qq update # We don't upgrade the packages. If this is needed, just uncomment this line # sudo apt-get -qq -y upgrade echo "Install dependencies..." - -sudo apt-get -qq -y install devscripts build-essential \ - debhelper libjack-jackd2-dev qtbase5-dev qttools5-dev-tools - - -cd ${1}/distributions - -sudo ./build-debian-package-auto.sh - -mkdir ${1}/deploy - -#debuild -b -us -uc -aarmhf -# copy for auto release -cp ${1}/../*.deb ${1}/deploy/ - -# rename them - -mv ${1}/deploy/jamulus-headless*_amd64.deb ${1}/deploy/Jamulus_headless_amd64.deb -mv ${1}/deploy/jamulus*_amd64.deb ${1}/deploy/Jamulus_amd64.deb +sudo apt-get -qq -y install devscripts build-essential debhelper libjack-jackd2-dev qtbase5-dev qttools5-dev-tools \ No newline at end of file diff --git a/linux/autobuild/artifacts/autobuild_deb_2_build.sh b/linux/autobuild/artifacts/autobuild_deb_2_build.sh new file mode 100644 index 0000000000..6674b5c819 --- /dev/null +++ b/linux/autobuild/artifacts/autobuild_deb_2_build.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Please run this script with the first parameter being the root of the repo +if [ -z "${1}" ]; then + echo "Please give the path to the repository root as second parameter to this script!" + exit 1 +fi + + +cd ${1}/distributions + +sudo ./build-debian-package-auto.sh diff --git a/linux/autobuild/artifacts/autobuild_deb_3_copy_files.sh b/linux/autobuild/artifacts/autobuild_deb_3_copy_files.sh new file mode 100644 index 0000000000..38923028ab --- /dev/null +++ b/linux/autobuild/artifacts/autobuild_deb_3_copy_files.sh @@ -0,0 +1,67 @@ +#!/bin/bash + +# Please run this script with the first parameter being the root of the repo +if [ -z "${1}" ]; then + echo "Please give the path to the repository root as second parameter to this script!" + exit 1 +fi + + + +mkdir ${1}/deploy + + +echo "" +echo "" +echo "ls GITROOT/deploy/" +ls ${1}/deploy/ +echo "" + +echo "" +echo "" +echo "ls GITROOT/../" +ls ${1}/../ +echo "" + +#debuild -b -us -uc -aarmhf +# copy for auto release +#cp ${1}/../*.deb ${1}/deploy/ + +echo "" +echo "" +echo "ls GITROOT/deploy/" +ls ${1}/deploy/ +echo "" + + + +#move/rename headless first, so wildcard pattern matches only one file each +echo "" +echo "" +artifact_deploy_filename_1=jamulus_headless_${jamulus_buildversionstring}_ubuntu_amd64.deb +echo "Move/Rename the built file to deploy/${artifact_deploy_filename_1}" +mv ${1}/../jamulus-headless*_amd64.deb ${1}/deploy/${artifact_deploy_filename_1} + +#move/rename normal second +echo "" +echo "" +artifact_deploy_filename_2=jamulus_${jamulus_buildversionstring}_ubuntu_amd64.deb +echo "Move/Rename the built file to deploy/${artifact_deploy_filename_2}" +mv ${1}/../jamulus*_amd64.deb ${1}/deploy/${artifact_deploy_filename_2} + + +echo "" +echo "" +echo "ls GITROOT/deploy/" +ls ${1}/deploy/ +echo "" + + +github_output_value() +{ + echo "github_output_value() ${1} = ${2}" + echo "::set-output name=${1}::${2}" +} + +github_output_value artifact_1 ${artifact_deploy_filename_1} +github_output_value artifact_2 ${artifact_deploy_filename_2} diff --git a/linux/autobuild/codeQL/auto_1_prepare.sh b/linux/autobuild/codeQL/auto_1_prepare.sh new file mode 100644 index 0000000000..f7f0af7c94 --- /dev/null +++ b/linux/autobuild/codeQL/auto_1_prepare.sh @@ -0,0 +1,16 @@ +#!/bin/sh -e + +# Please run this script with the first parameter being the root of the repo +if [ -z "${1}" ]; then + echo "Please give the path to the repository root as second parameter to this script!" + exit 1 +fi + +# Sets up the environment for autobuild on Linux + +echo "Update system..." +sudo apt-get -qq update +# We don't upgrade the packages. If this is needed, just uncomment this line +# sudo apt-get -qq -y upgrade +echo "Install dependencies..." +sudo apt install build-essential qt5-qmake qtdeclarative5-dev qt5-default qttools5-dev-tools libjack-jackd2-dev diff --git a/linux/autobuild/codeQL/auto_2_build_qt_project.sh b/linux/autobuild/codeQL/auto_2_build_qt_project.sh new file mode 100644 index 0000000000..5471f46cfb --- /dev/null +++ b/linux/autobuild/codeQL/auto_2_build_qt_project.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# Please run this script with the first parameter being the root of the repo +if [ -z "${1}" ]; then + echo "Please give the path to the repository root as second parameter to this script!" + exit 1 +fi + +cd ${1} + + +echo "Building... qmake" +if [-x /Users/runner/work/jamulus/jamulus/Qt/5.15.2/clang_64/bin/qmake] +then + /Users/runner/work/jamulus/jamulus/Qt/5.15.2/clang_64/bin/qmake +else + qmake +fi + +echo "Building... make" +make + + +echo "Done" \ No newline at end of file diff --git a/mac/autorelease_mac.sh b/mac/autobuild/artifacts/autobuild_mac_1_prepare.sh old mode 100755 new mode 100644 similarity index 66% rename from mac/autorelease_mac.sh rename to mac/autobuild/artifacts/autobuild_mac_1_prepare.sh index 74bbb70603..a81da2ddf2 --- a/mac/autorelease_mac.sh +++ b/mac/autobuild/artifacts/autobuild_mac_1_prepare.sh @@ -14,8 +14,17 @@ echo "Install dependencies..." brew install qt5 brew link qt5 --force -echo "Run deploy script..." -sh ${1}/mac/deploy_mac.sh -# Move the created installer to deploy -cp ${1}/deploy/Jamulus-*installer-mac.dmg ${1}/deploy/Jamulus-installer-mac.dmg + + + + + +echo "find script..." +echo "$0" +echo "find script..." +echo realpath "$0" +echo "find deploy script..." +ls ${1} +echo "find deploy script..." +ls ${1}/mac/* diff --git a/mac/autobuild/artifacts/autobuild_mac_2_build.sh b/mac/autobuild/artifacts/autobuild_mac_2_build.sh new file mode 100644 index 0000000000..d7309a0ad9 --- /dev/null +++ b/mac/autobuild/artifacts/autobuild_mac_2_build.sh @@ -0,0 +1,15 @@ +#!/bin/sh -e + +# Sets up the environment for autobuild on macOS + +# please run this script with the first parameter being the root of the repo +if [ -z "${1}" ]; then + echo "Please give the path to the repository root as second parameter to this script!" + exit 1 +fi + +cd ${1} + +echo "Run deploy script..." +sh ${1}/mac/deploy_mac.sh + diff --git a/mac/autobuild/artifacts/autobuild_mac_3_copy_files.sh b/mac/autobuild/artifacts/autobuild_mac_3_copy_files.sh new file mode 100644 index 0000000000..25a57a0a7c --- /dev/null +++ b/mac/autobuild/artifacts/autobuild_mac_3_copy_files.sh @@ -0,0 +1,39 @@ +#!/bin/sh -e + +# Sets up the environment for autobuild on macOS + +# please run this script with the first parameter being the root of the repo +if [ -z "${1}" ]; then + echo "Please give the path to the repository root as second parameter to this script!" + exit 1 +fi + +cd ${1} + +echo "" +echo "" +echo "ls GITROOT/deploy/" +ls ${1}/deploy/ +echo "" + +echo "" +echo "" +artifact_deploy_filename=jamulus_${jamulus_buildversionstring}_mac.dmg +echo "Move/Rename the built file to deploy/${artifact_deploy_filename}" +mv ${1}/deploy/Jamulus-*installer-mac.dmg ${1}/deploy/${artifact_deploy_filename} + + +echo "" +echo "" +echo "ls GITROOT/deploy/" +ls ${1}/deploy/ +echo "" + + +github_output_value() +{ + echo "github_output_value() ${1} = ${2}" + echo "::set-output name=${1}::${2}" +} + +github_output_value artifact_1 ${artifact_deploy_filename} diff --git a/mac/autobuild/codeQL/autobuild_mac_1_prepare.sh b/mac/autobuild/codeQL/autobuild_mac_1_prepare.sh new file mode 100644 index 0000000000..eb3f5d9b5c --- /dev/null +++ b/mac/autobuild/codeQL/autobuild_mac_1_prepare.sh @@ -0,0 +1,41 @@ +#!/bin/bash + + +# Sets up the environment for autobuild on Linux + +#USING GITHUB ACTION HERE +# +# - name: Install Qt on MacOS +# uses: jurplel/install-qt-action@v2 +# with: +# version: '5.15.2' +# dir: '${{ github.workspace }}' + + + +# please run this script with the first parameter being the root of the repo +if [ -z "${1}" ]; then + echo "Please give the path to the repository root as second parameter to this script!" + exit 1 +fi + +cd ${1} + +echo "Install dependencies..." +brew install qt5 +brew link qt5 --force + + + + + + + +echo "find script..." +echo "$0" +echo "find script..." +echo realpath "$0" +echo "find deploy script..." +ls ${1} +echo "find deploy script..." +ls ${1}/mac/* diff --git a/mac/autobuild/codeQL/autobuild_mac_2_build.sh b/mac/autobuild/codeQL/autobuild_mac_2_build.sh new file mode 100644 index 0000000000..5471f46cfb --- /dev/null +++ b/mac/autobuild/codeQL/autobuild_mac_2_build.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# Please run this script with the first parameter being the root of the repo +if [ -z "${1}" ]; then + echo "Please give the path to the repository root as second parameter to this script!" + exit 1 +fi + +cd ${1} + + +echo "Building... qmake" +if [-x /Users/runner/work/jamulus/jamulus/Qt/5.15.2/clang_64/bin/qmake] +then + /Users/runner/work/jamulus/jamulus/Qt/5.15.2/clang_64/bin/qmake +else + qmake +fi + +echo "Building... make" +make + + +echo "Done" \ No newline at end of file diff --git a/mac/autobuild/codeQL/autobuild_mac_3_copy_files.sh b/mac/autobuild/codeQL/autobuild_mac_3_copy_files.sh new file mode 100644 index 0000000000..0cf18f99e9 --- /dev/null +++ b/mac/autobuild/codeQL/autobuild_mac_3_copy_files.sh @@ -0,0 +1,8 @@ +#!/bin/bash + + +# Sets up the environment for autobuild on Linux + +#USING GITHUB ACTION HERE + +echo "no action here" \ No newline at end of file diff --git a/windows/autorelease_windows.ps1 b/windows/autobuild/autobuild_windowsinstaller_1_prepare.ps1 similarity index 65% rename from windows/autorelease_windows.ps1 rename to windows/autobuild/autobuild_windowsinstaller_1_prepare.ps1 index ca5a463bd0..c36e3dbb78 100644 --- a/windows/autorelease_windows.ps1 +++ b/windows/autobuild/autobuild_windowsinstaller_1_prepare.ps1 @@ -1,7 +1,22 @@ # Sets up the environment for autobuild on Windows -# Get the source path via parameter -param ([string] $sourcepath) + + + + + + + + + + + + + + + + + echo "Install Qt..." # Install Qt @@ -13,10 +28,3 @@ aqt install --outputdir C:\Qt 5.15.2 windows desktop win64_msvc2019_64 echo "Get Qt 32 bit..." # intermediate solution if the main server is down: append e.g. " -b https://mirrors.ocf.berkeley.edu/qt/" to the "aqt"-line below aqt install --outputdir C:\Qt 5.15.2 windows desktop win32_msvc2019 - -echo "Build installer..." -# Build the installer -powershell "$sourcepath\windows\deploy_windows.ps1" "C:\Qt\5.15.2" - -# Rename the installer -cp "$sourcepath\deploy\Jamulus*installer-win.exe" "$sourcepath\deploy\Jamulus-installer-win.exe" diff --git a/windows/autobuild/autobuild_windowsinstaller_2_build.ps1 b/windows/autobuild/autobuild_windowsinstaller_2_build.ps1 new file mode 100644 index 0000000000..f3bafc9b6f --- /dev/null +++ b/windows/autobuild/autobuild_windowsinstaller_2_build.ps1 @@ -0,0 +1,21 @@ +# Sets up the environment for autobuild on Windows + +# Get the source path via parameter +param ( + [string] $jamulus_project_path = $Env:jamulus_project_path +) +# Sanity check of parameters +if(($jamulus_project_path -eq $null) -or ($jamulus_project_path -eq "")){ + throw "expecting ""jamulus_project_path"" as parameter or ENV" +}elseif (!(Test-Path -Path $jamulus_project_path)){ + throw "non.existing jamulus_project_path: $jamulus_project_path" +}else{ + echo "jamulus_project_path is valid: $jamulus_project_path" +} + + + + +echo "Build installer..." +# Build the installer +powershell "$jamulus_project_path\windows\deploy_windows.ps1" "C:\Qt\5.15.2" diff --git a/windows/autobuild/autobuild_windowsinstaller_3_copy_files.ps1 b/windows/autobuild/autobuild_windowsinstaller_3_copy_files.ps1 new file mode 100644 index 0000000000..1f28124fa4 --- /dev/null +++ b/windows/autobuild/autobuild_windowsinstaller_3_copy_files.ps1 @@ -0,0 +1,48 @@ +# Sets up the environment for autobuild on Windows + +# Get the source path via parameter +param ( + [string] $jamulus_project_path = $Env:jamulus_project_path, + [string] $jamulus_buildversionstring = $Env:jamulus_buildversionstring +) +# Sanity check of parameters +if(($jamulus_project_path -eq $null) -or ($jamulus_project_path -eq "")){ + throw "expecting ""jamulus_project_path"" as parameter or ENV" +}elseif (!(Test-Path -Path $jamulus_project_path)){ + throw "non.existing jamulus_project_path: $jamulus_project_path" +}else{ + echo "jamulus_project_path is valid: $jamulus_project_path" +} +if(($jamulus_buildversionstring -eq $null) -or ($jamulus_buildversionstring -eq "")){ + echo "expecting ""jamulus_buildversionstring"" as parameter or ENV" + echo "using ""NoVersion"" as jamulus_buildversionstring for filenames" + $jamulus_buildversionstring = "NoVersion" +} + + + + +# Rename the file +echo "rename" +$artifact_deploy_filename = "jamulus_${Env:jamulus_buildversionstring}_win.exe" +echo "rename deploy file to $artifact_deploy_filename" +cp "$jamulus_project_path\deploy\Jamulus*installer-win.exe" "$jamulus_project_path\deploy\$artifact_deploy_filename" + + + + +Function github_output_value +{ + param( + [Parameter(Mandatory=$true)] + [string] $name, + [Parameter(Mandatory=$true)] + [string] $value + ) + + echo "github_output_value() $name = $value" + echo "::set-output name=$name::$value" +} + + +github_output_value -name "artifact_1" -value "$artifact_deploy_filename" From 3732f0033ce18ab3a5cbf4755145402974a807ef Mon Sep 17 00:00:00 2001 From: nefarius2001 Date: Tue, 9 Feb 2021 09:39:14 +0100 Subject: [PATCH 2/2] stub for windows build docker --- windows/autobuild/Docker_run.bat | 2 ++ windows/autobuild/Dockerfile | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 windows/autobuild/Docker_run.bat create mode 100644 windows/autobuild/Dockerfile diff --git a/windows/autobuild/Docker_run.bat b/windows/autobuild/Docker_run.bat new file mode 100644 index 0000000000..a371c3bee5 --- /dev/null +++ b/windows/autobuild/Docker_run.bat @@ -0,0 +1,2 @@ + +docker build --tag myjambuild_win ./ \ No newline at end of file diff --git a/windows/autobuild/Dockerfile b/windows/autobuild/Dockerfile new file mode 100644 index 0000000000..09570c0893 --- /dev/null +++ b/windows/autobuild/Dockerfile @@ -0,0 +1,19 @@ +#FROM windows-latest ## does not work, github environment +#FROM mcr.microsoft.com/windows:10.0.17763.1217-amd64 ## lacks python +FROM python:3.9.1-windowsservercore-1809 + +RUN echo hallo von kaje + +COPY autobuild_test.ps1 /autobuild_test.ps1 + +RUN echo halloa von kaje + +RUN dir + +RUN powershell Set-ExecutionPolicy RemoteSigned + +RUN dpowershell ./autobuild_test.ps1 -test c + +RUN echo halloa von kaje + +#ENTRYPOINT /bin/bash /build_qt_project.sh \ No newline at end of file