diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml deleted file mode 100644 index edb9fe9..0000000 --- a/.github/workflows/appimage.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Linux AppImage - -on: [push, pull_request] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - uses: docker-practice/actions-setup-docker@master - - name: Build docker - run: | - docker build --file deploy/docker/Dockerfile-build-linux -t qgc-linux-docker . - - name: Run docker - run: | - mkdir build - docker run --rm -v $PWD:/project/source -v $PWD/build:/project/build qgc-linux-docker - - name: Create AppImage - run: | - sudo chown $(whoami) -R build - ./deploy/create_linux_appimage.sh $PWD $PWD/build/staging $PWD - - uses: actions/upload-artifact@master - with: - name: QGroundControl.AppImage - path: QGroundControl.AppImage \ No newline at end of file diff --git a/.github/workflows/compile_test_release.yml b/.github/workflows/compile_test_release.yml new file mode 100644 index 0000000..4014915 --- /dev/null +++ b/.github/workflows/compile_test_release.yml @@ -0,0 +1,154 @@ +name: Compile, Test and Release + +on: [pull_request] + +defaults: + run: + shell: bash + +env: + SOURCE_DIR: ${{ github.workspace }} + +jobs: + build: + name: ${{ matrix.config.name }} + runs-on: ${{ matrix.config.os }} + env: + gst_version: "1.18.1" + + strategy: + fail-fast: false + matrix: + config: + - { + name: "Linux Debug and Test", + os: ubuntu-latest, + qt-host: 'linux', + qt-target: 'desktop', + config: debug, + run-unit-tests: true, + save-artifact: false, + jobs: 2 + } + - { + name: "Linux AppImage", + os: ubuntu-latest, + qt-host: 'linux', + qt-target: 'desktop', + config: installer, + run-unit-tests: false, + artifact: 'QGroundControl.AppImage', + save-artifact: true, + jobs: 2 + } + - { + name: "OSX DMG", + os: macos-latest, + qt-host: 'mac', + qt-target: 'desktop', + config: installer, + run-unit-tests: false, + artifact: 'QGroundControl.dmg', + save-artifact: true, + jobs: 3 + } + + steps: + - name: Checkout repo + uses: actions/checkout@v2 + with: + submodules: recursive + + - name: Install Qt + uses: jurplel/install-qt-action@v2 + with: + version: '5.12.6' + host: ${{ matrix.config.qt-host }} + target: ${{ matrix.config.qt-target }} + dir: '${{ runner.temp }}' + modules: 'qtcharts' + setup-python: 'false' + + - name: Install QGC source dependencies for Linux + if: ${{ matrix.config.os == 'ubuntu-latest' }} + run: sudo apt-get install -y libsdl2-dev + + - name: Install Gstreamer for Linux + if: ${{ matrix.config.os == 'ubuntu-latest' }} + run: sudo apt-get install -y libgstreamer-plugins-base1.0-dev libgstreamer1.0-0:amd64 libgstreamer1.0-dev + + - name: Install Gstreamer for OSX + if: ${{ matrix.config.os == 'macos-latest' }} + run: | + wget --quiet https://qgroundcontrol.s3-us-west-2.amazonaws.com/dependencies/gstreamer-osx-1.18.1.tar.bz2 && + sudo tar zxf gstreamer-osx-1.18.1.tar.bz2 -C /Library/Frameworks + + - name: Install ccache OSX + if: ${{ matrix.config.os == 'macos-latest' }} + run: brew install ccache + + - name: Install ccache Linux + if: ${{ matrix.config.os == 'ubuntu-latest' }} + run: sudo apt-get install ccache + + - name: Prepare ccache timestamp + id: ccache_cache_timestamp + shell: cmake -P {0} + run: | + string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC) + message("::set-output name=timestamp::${current_date}") + + - name: ccache cache files + uses: actions/cache@v2 + with: + path: ~/.ccache + key: ${{ matrix.config.os }}-${{ matrix.config.config }}-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}} + restore-keys: ${{ matrix.config.os }}-${{ matrix.config.config }}-ccache- + + - name: Setup ccache + run: | + mkdir -p ~/.ccache + echo "base_dir = ${GITHUB_WORKSPACE}" > ~/.ccache/ccache.conf + echo "compression = true" >> ~/.ccache/ccache.conf + echo "compression_level = 5" >> ~/.ccache/ccache.conf + ccache -s + ccache -z + + - name: Create build directory + run: mkdir ${{ runner.temp }}/shadow_build_dir + + - name: Build + working-directory: ${{ runner.temp }}/shadow_build_dir + run: | + qmake -r ${SOURCE_DIR}/qgroundcontrol.pro CONFIG+=${{ matrix.config.config }} CONFIG+=DailyBuild + make -j${{ matrix.config.jobs }} + + - name: ccache post-run + run: ccache -s + + - name: Setup for unit tests + if: ${{ matrix.config.run-unit-tests }} + working-directory: ${{ runner.temp }}/shadow_build_dir + run: | + mkdir -p ~/.config/QtProject/ + cp ${SOURCE_DIR}/test/qtlogging.ini ~/.config/QtProject/ + export QT_FATAL_WARNINGS=1 + + - name: Run unit tests + if: ${{ matrix.config.run-unit-tests }} + uses: GabrielBB/xvfb-action@v1 + with: + working-directory: ${{ runner.temp }}/shadow_build_dir + run: ./staging/qgroundcontrol-start.sh --unittest + + - name: Create AppImage + if: ${{ matrix.config.os == 'ubuntu-latest' && matrix.config.config == 'installer' }} + working-directory: ${{ runner.temp }}/shadow_build_dir + run: ${SOURCE_DIR}/deploy/create_linux_appimage.sh ${SOURCE_DIR} ./staging ./package; + + - name: Save artifact + if: ${{ matrix.config.save-artifact }} + uses: actions/upload-artifact@master + with: + name: ${{ matrix.config.artifact }} + path: ${{ runner.temp }}/shadow_build_dir/package/${{ matrix.config.artifact }} diff --git a/.github/workflows/dmg.yml b/.github/workflows/dmg.yml deleted file mode 100644 index 98e9703..0000000 --- a/.github/workflows/dmg.yml +++ /dev/null @@ -1,87 +0,0 @@ -name: Build QGC and upload to release - -on: [push, pull_request] - -defaults: - run: - shell: bash - -env: - JOBS: 4 - CONFIG: installer - ACTIONS_BUILD_DIR: ${{ github.workspace }}/../qgroundcontrol - -jobs: - build-job: - runs-on: macos-latest - env: - gst_version: "1.18.1" - - steps: - - name: Checkout repo - uses: actions/checkout@v2 - with: - submodules: recursive - - - name: Cache - uses: actions/cache@v2 - id: cache - with: - path: ~/.ccache - key: ${{ runner.os }}-mac-ccache-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-mac-ccache-${{ github.sha }} - ${{ runner.os }}-mac-ccache- - - - name: Install ccache - run: | - brew install ccache - - - name: install Qt via action - uses: jurplel/install-qt-action@v2 - with: - version: '5.12.6' - host: 'mac' - target: 'desktop' - dir: '${{ runner.temp }}' - modules: 'qtcharts' - setup-python: 'false' - - - name: Install Gstreamer - run: | - GST_URL_BASE_PATH="https://gstreamer.freedesktop.org/data/pkg/osx/${{ env.gst_version }}" - wget "${GST_URL_BASE_PATH}/gstreamer-1.0-devel-${{ env.gst_version }}-x86_64.pkg" - wget "${GST_URL_BASE_PATH}/gstreamer-1.0-${{ env.gst_version }}-x86_64.pkg" - for package in *.pkg ; - do sudo installer -verbose -pkg "$package" -target / - done - - - name: mkdir directory shadow_build - run: mkdir ${{ runner.temp }}/shadow_build_dir - - - name: run qmake and build - working-directory: ${{ runner.temp }}/shadow_build_dir - run: | - export JOBS=$((`sysctl -n hw.ncpu`+1)) - export LIBRARY_PATH=/Library/Frameworks/GStreamer.framework/Versions/1.0/lib/ - export CCACHE_DIR=~/.ccache - ccache -s - ccache -z - qmake -r ${ACTIONS_BUILD_DIR}/qgroundcontrol.pro CONFIG+=${CONFIG} CONFIG+=ccache - make -j$JOBS - ccache -s - - - uses: actions/upload-artifact@master - with: - name: QGroundControl.dmg - path: ${{ runner.temp }}/shadow_build_dir/package/QGroundControl.dmg - - - name: Upload build artifacts to release - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ${{ runner.temp }}/shadow_build_dir/package/QGroundControl.dmg - asset_name: QGroundControl.dmg - tag: ${{ github.ref }} - overwrite: true - body: "QGroundControl ${{ steps.get_version.outputs.VERSION }} test" \ No newline at end of file