diff --git a/.github/workflows/desktop.yml b/.github/workflows/desktop.yml index 89a0f4dba2..6ce5bc07ed 100644 --- a/.github/workflows/desktop.yml +++ b/.github/workflows/desktop.yml @@ -1,8 +1,8 @@ name: Desktop Builds on: - push: pull_request: + types: [opened, reopened, synchronize] env: CCACHE_DIR: ${{ github.workspace }}/ccache_dir @@ -52,6 +52,14 @@ jobs: echo "::set-env name=PIP_REQUIREMENTS_FILE::external/pip_requirements.txt" echo "::set-env name=MATRIX_UNIQUE_NAME::${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.architecture }}-${{ matrix.python_version }}-${{ matrix.generator }}" + # Used to name mangle archive files in debug builds based on the + # build generator type. Required becasue the space in the + # "Unix Makefiles" generator type breaks the archive process. + - name: Set additional env variables for subsequent steps (mac and linux) + if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos') + run: | + echo "::set-env name=BUILD_GENERATOR_NO_SPACES::$(echo -e "${{matrix.generator}}" | tr -d '[:space:]')" + - name: Install Ninja (windows) if: startsWith(matrix.generator, 'Ninja') && startsWith(matrix.os, 'windows') run: | @@ -163,9 +171,87 @@ jobs: find build -name "*.a" find build -name "*.so" - - name: Run tests + - name: Prep crash support (linux) + # Ensures directory structure is in place to capture core files on Linux. + if: startsWith(matrix.build_type, 'Debug') && startsWith(matrix.os, 'ubuntu') + shell: bash + run: | + echo '/tmp/cores/core.%E' | sudo tee /proc/sys/kernel/core_pattern + sudo mkdir -p /tmp/cores/ + sudo rm -rf /tmp/cores/* + + - name: Prep crash support (mac) + # Ensures no lingering crashes from the previous run. + if: startsWith(matrix.build_type, 'Debug') && startsWith(matrix.os, 'macos') + run: | + rm -rf ~/Library/Logs/DiagnosticReports/* + + - name: Run tests (windows & macos) + if: startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'macos') env: LANG: en_US run: | cd build ctest --verbose + + - name: Run tests (linux) + # Linux exists as its own standalone execution step in order to invoke + # platform-specific `ulimit` to enable crash collection. The ulimit + # command must be invoked in same shell instance of that runs the + # tests. + if: startsWith(matrix.os, 'ubuntu') + env: + LANG: en_US + run: | + ulimit -c unlimited + cd build + sudo ctest --verbose + + - name: Prep bins for achive (linux) + # Copies all of the binary files into one directory for ease in + # archiving. Directory contents are then marked readable for the + # archive step. + if: failure() && startsWith(matrix.build_type, 'Debug') && ( startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos') ) + shell: bash + run: | + sudo rm -rf /tmp/bins/* || : + sudo mkdir -p /tmp/bins/ + sudo rm -rf ./build/app/tests/firebase_test + sudo cp -f ./build/*/tests/firebase* /tmp/bins + sudo chmod -R +rwx /tmp/bins/* || : + + - name: Prep crash data for archive (linux) + # Marks the contents of the core dump directory to be readable for the + # archiving step on linux. + shell: bash + if: failure() && startsWith(matrix.build_type, 'Debug') && startsWith(matrix.os, 'ubuntu') + run: | + sudo chmod -R +rwx /tmp/cores/* || : + + - name: Prep crash data for archive (macos) + # Freshly made diagnostic reports are marked as readable for + # the archive step. Note: for some reason /tmp/cores doesn't survive + # long enough for archiving on mac, so prep the DiagnosticReports + # directory instead. + shell: bash + if: failure() && startsWith(matrix.build_type, 'Debug') && startsWith(matrix.os, 'macos') + run: | + sudo chmod -R +rwx ~/Library/Logs/DiagnosticReports/* || : + + - name: Archive crashes and binaries (linux) + uses: actions/upload-artifact@v2 + if: failure() && startsWith(matrix.build_type, 'Debug') && startsWith(matrix.os, 'ubuntu') + with: + name: crashes-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.architecture }}-${{ matrix.python_version }}-${{ env.BUILD_GENERATOR_NO_SPACES }} + path: | + /tmp/cores/* + /tmp/bins/* + + - name: Archive crashes (mac) + uses: actions/upload-artifact@v2 + if: failure() && startsWith(matrix.build_type, 'Debug') && startsWith(matrix.os, 'macos') + with: + name: crashes-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.architecture }}-${{ matrix.python_version }}-${{ env.BUILD_GENERATOR_NO_SPACES }} + path: | + ~/Library/Logs/DiagnosticReports/* + /tmp/bins/* \ No newline at end of file diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml deleted file mode 100644 index 9ffa4ed390..0000000000 --- a/.github/workflows/windows.yml +++ /dev/null @@ -1,91 +0,0 @@ -name: Windows Builds - -on: - push: - pull_request: - -jobs: - build: - name: ${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.architecture }}-${{ matrix.python_version }}-${{ matrix.generator }} - runs-on: ${{ matrix.os }} - strategy: - # If any of the configurations fail, others will proceed to run - fail-fast: false - matrix: - os: [windows-latest,] - build_type: ["Release"] - architecture: ["x64",] - python_version: [2.7] - generator: ["Visual Studio 16 2019",] - include: - - os: windows-latest - architecture: "x64" - vcpkg_triplet: "x64-windows-static" - # For x64, this variable probably doesnt make sense but - # for x86, the command line argument to pass to cmake is -A Win32 and not -A x86 - msbuild_platform: "x64" - - steps: - # Check out with submodule (vcpkg is a submodule) - - uses: actions/checkout@v2 - with: - submodules: true - - - name: Set env variables for subsequent steps (all) - run: | - echo "::set-env name=VCPKG_RESPONSE_FILE::external/vcpkg_${{ matrix.vcpkg_triplet }}_response_file.txt" - echo "::set-env name=PIP_REQUIREMENTS_FILE::external/pip_requirements.txt" - - - name: Install Ninja - if: startsWith(matrix.generator, 'Ninja') && startsWith(matrix.os, 'windows') - run: | - choco install ninja - - - name: Cache vcpkg C++ dependencies - id: cache_vcpkg - uses: actions/cache@v2 - with: - path: external/vcpkg/installed - key: dev-vcpkg-${{ matrix.vcpkg_triplet }}-${{ hashFiles(format('{0}', env.VCPKG_RESPONSE_FILE)) }}-${{ hashFiles('.git/modules/external/vcpkg/HEAD') }} - - - name: Install vcpkg packages (windows) - if: steps.cache_vcpkg.outputs.cache-hit!='true' && startsWith(matrix.os, 'windows') - run: | - ${{ github.workspace }}/external/vcpkg/bootstrap-vcpkg.bat -disableMetrics - ${{ github.workspace }}/external/vcpkg/vcpkg install @${{env.VCPKG_RESPONSE_FILE}} - - - name: Setup python - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python_version }} - architecture: ${{ matrix.architecture }} - - - name: Install pip packages - run: | - python -m pip install --upgrade pip - pip install -r ${{ env.PIP_REQUIREMENTS_FILE }} - - - name: Configure - shell: bash - run: | - mkdir build - cmake \ - -S . \ - -B build \ - -G "${{ matrix.generator }}" \ - -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ - -DCMAKE_TOOLCHAIN_FILE=external/vcpkg/scripts/buildsystems/vcpkg.cmake \ - -DVCPKG_TARGET_TRIPLET=${{ matrix.vcpkg_triplet }} \ - - - name: Build - shell: bash - run: cmake --build build --config ${{ matrix.build_type }} -j 8 - - - name: Print built libraries - shell: bash - run: | - find build -name "*.lib" - find build -name "*.dll" - find build -name "*.dylib" - find build -name "*.a" - find build -name "*.so"