name: Compile, Test and Release on: [ push, 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 }} - name: Upload artifact to S3 Bucket if: ${{ matrix.config.save-artifact && github.event_name == 'push' }} uses: jakejarvis/s3-sync-action@master with: args: --acl public-read env: AWS_S3_BUCKET: qgroundcontrol AWS_REGION: 'us-west-1' AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} SOURCE_DIR: ${{ runner.temp }}/shadow_build_dir/package/${{ matrix.config.artifact }} LOCAL_DIR: 'master'