diff --git a/.github/workflows/ci_build.yaml b/.github/workflows/ci_build.yaml new file mode 100644 index 0000000000..dc795a0e09 --- /dev/null +++ b/.github/workflows/ci_build.yaml @@ -0,0 +1,138 @@ +name: CI Build + +on: + pull_request: + types: [opened, synchronize, reopened] + push: + branches: + - master + +jobs: + build: + name: "${{matrix.os}}, ${{matrix.qt_version}}, ${{matrix.build_type}} " + runs-on: ${{matrix.os}} + strategy: + fail-fast: false + matrix: + include: + - os: windows-latest + build_type: qtwebengine with hunspell + qt_version: 5.15.2 + - os: windows-latest + build_type: qtwebengine without hunspell + qt_version: 5.15.2 + + - os: ubuntu-18.04 + build_type: qtwebkit with hunspell + qt_version: repository + apt-dependencies: git build-essential cmake qtbase5-dev libqt5core5a libqt5gui5 libqt5multimedia5 qtmultimedia5-dev libqt5network5 libqt5printsupport5 libqt5qml5 qtdeclarative5-dev libqt5svg5 libqt5svg5-dev libqt5widgets5 libhunspell-dev libqt5webkit5 libqt5webkit5-dev + - os: ubuntu-18.04 + build_type: qtwebkit without hunspell + qt_version: repository + apt-dependencies: git build-essential cmake qtbase5-dev libqt5core5a libqt5gui5 libqt5multimedia5 qtmultimedia5-dev libqt5network5 libqt5printsupport5 libqt5qml5 qtdeclarative5-dev libqt5svg5 libqt5svg5-dev libqt5widgets5 libqt5webkit5 libqt5webkit5-dev + - os: ubuntu-18.04 + build_type: qtwebengine with hunspell + qt_version: 5.15.2 + apt-dependencies: git build-essential cmake libhunspell-dev + - os: ubuntu-20.04 + build_type: qtwebkit with hunspell + qt_version: repository + apt-dependencies: git build-essential cmake qtbase5-dev libqt5core5a libqt5gui5 libqt5multimedia5 qtmultimedia5-dev libqt5network5 libqt5printsupport5 libqt5qml5 qtdeclarative5-dev libqt5svg5 libqt5svg5-dev libqt5widgets5 libhunspell-dev libqt5webkit5 libqt5webkit5-dev + + - os: macOS-latest + build_type: qtwebengine with hunspell + qt_version: 5.15.2 + - os: macOS-latest + build_type: qtwebengine without hunspell + qt_version: 5.15.2 + + steps: + - name: Get Otter Browser source + uses: actions/checkout@v1 + with: + submodules: false + fetch-depth: 1 + + - name: Cache Qt + if: !startsWith(matrix.qt_version, 'repository') + id: cache-qt + uses: actions/cache@v2 + with: + path: ${{runner.workspace}}/Qt + key: ${{runner.os}}-QtCache + + - name: Install Qt ${{matrix.qt_version}} with QtWebEngine + if: startsWith(matrix.os, 'windows') && startsWith(matrix.build_type, 'qtwebengine') || startsWith(matrix.os, 'macos') && startsWith(matrix.build_type, 'qtwebengine') || startsWith(matrix.os, 'ubuntu') && !startsWith(matrix.qt_version, 'repository') && startsWith(matrix.build_type, 'qtwebengine') + uses: jurplel/install-qt-action@v2 + with: + version: ${{matrix.qt_version}} + modules: qtwebengine + cached: ${{steps.cache-qt.outputs.cache-hit}} + + - name: Install Qt ${{matrix.qt_version}} without QtWebEngine + if: startsWith(matrix.os, 'windows') && startsWith(matrix.build_type, 'qtwebkit') || startsWith(matrix.os, 'macos') && startsWith(matrix.build_type, 'qtwebkit') || startsWith(matrix.os, 'ubuntu') && !startsWith(matrix.qt_version, 'repository') && startsWith(matrix.build_type, 'qtwebkit') + uses: jurplel/install-qt-action@v2 + with: + version: ${{matrix.qt_version}} + cached: ${{steps.cache-qt.outputs.cache-hit}} + + - name: Install hunspell dependencies on Windows + if: startsWith(matrix.os, 'windows') && endsWith(matrix.build_type, 'with hunspell') + uses: msys2/setup-msys2@v2 + with: + install: >- + base-devel + mingw-w64-x86_64-toolchain + mingw-w64-x86_64-libtool + + - name: Install hunspell on Windows + if: startsWith(matrix.os, 'windows') && endsWith(matrix.build_type, 'with hunspell') + shell: msys2 {0} + run: | + curl -Ls https://github.com/hunspell/hunspell/files/2573619/hunspell-1.7.0.tar.gz -o hunspell.tar.gz + tar -xf hunspell.tar.gz + cd hunspell-1.7.0 + autoreconf -vfi + ./configure + make -j2 + echo "CMAKE_BUILD_EXTRA=-DHunspell_INCLUDE_DIR=$RUNNER_WORKSPACE\hunspell-1.7.0\src\ -DHunspell_LIBRARIES=hunspell-1.7" >> $GITHUB_ENV + + - name: Install dependencies + shell: bash + run: | + + # Install APT dependencies on Ubuntu + if [[ "${{ matrix.os }}" = "ubuntu"* ]]; then + echo "Updating apt repository index" + sudo apt update + echo "Installing apt packages" + sudo apt install -y ${{ matrix.apt-dependencies }} + fi + + # Install Hunspell on MacOS + if [[ "${{ matrix.os }}" = "macOS"* && "${{ matrix.build_type }}" != *"without"* ]]; then + echo "Installing Hunspell" + brew install hunspell + fi + + - name: Create Build Environment + shell: bash + run: cmake -E make_directory "${{runner.workspace}}/build" + + - name: Configure CMake + working-directory: ${{runner.workspace}}/build + shell: bash + run: cmake $GITHUB_WORKSPACE $CMAKE_BUILD_EXTRA + + - name: Build Otter Browser + working-directory: ${{runner.workspace}}/build + shell: bash + run: cmake --build . --parallel 3 + + - name: Output system stats + if: ${{ always() }} + working-directory: ${{runner.workspace}}/build + shell: bash + run: | + echo "Disk usage:" + df -h