From 4206f5d2697729436bd9cfb7bfee869c275283be Mon Sep 17 00:00:00 2001 From: Ivan Komissarov Date: Sun, 11 Apr 2021 18:57:25 +0300 Subject: GitHub actions: Add MinGW build and tests on Windows Change-Id: I50944a7ad0a1f4f2fc09bcaab43fc88044107ff9 Reviewed-by: Christian Kandeler --- .github/actions/download-mingw/action.yml | 19 ++++++++ .github/workflows/main.yml | 76 +++++++++++++++++++++++++++++++ scripts/install-qt.sh | 13 ++++++ 3 files changed, 108 insertions(+) create mode 100644 .github/actions/download-mingw/action.yml diff --git a/.github/actions/download-mingw/action.yml b/.github/actions/download-mingw/action.yml new file mode 100644 index 000000000..f8fb47f28 --- /dev/null +++ b/.github/actions/download-mingw/action.yml @@ -0,0 +1,19 @@ +name: 'Download MinGW' +description: 'Downloads MinGW' +inputs: + version: + description: 'MinGW version' + required: false + default: '8.1.0' + toolchain: + description: 'Toolchain' + required: false + default: 'win64_mingw' +runs: + using: "composite" + steps: + - name: Install MinGW + run: | + MINGW_DIR=$(./scripts/install-qt.sh -d $HOME/Qt --version ${{ inputs.version }} --toolchain ${{ inputs.toolchain }} mingw) + (cygpath -w ${MINGW_DIR} 2>/dev/null || echo ${MINGW_DIR}) >> ${GITHUB_PATH} + shell: bash diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 98c1a8b11..6744efb6a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -218,6 +218,71 @@ jobs: name: qbs-windows-${{ github.run_id }}.zip path: release/qbs-windows-${{ github.run_id }}.zip + build-windows-mingw: + name: Build on Windows (MinGW) + runs-on: windows-latest + timeout-minutes: 60 + env: + BUILD_OPTIONS: | + modules.cpp.compilerWrapper:ccache + modules.qbsbuildconfig.enableAddressSanitizer:false + modules.qbsbuildconfig.enableBundledQt:true + products.qbs_archive.targetName:qbs-windows-${{ github.run_id }} + products.qbs_archive.includeTests:true, + QT_ASSUME_STDERR_HAS_CONSOLE: 1 + WITH_TESTS: 0 + CCACHE_DIR: ${{ github.workspace }}\ccache + steps: + - uses: actions/checkout@v1 + - name: prepare timestamp + id: get-timestamp + run: echo ::set-output name=timestamp::$(date -u +"%Y-%m-%dT%H:%M:%SZ") + shell: bash + - name: ccache cache files + uses: actions/cache@v2 + with: + path: ${{ github.workspace }}/ccache + key: ${{ runner.os }}-mingw-ccache-${{ steps.get-timestamp.outputs.timestamp }} + restore-keys: ${{ runner.os }}-mingw-ccache- + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install required packages + run: | + choco install ccache + python -m pip install --upgrade pip + pip install beautifulsoup4 lxml + - name: Install Qt + uses: ./.github/actions/download-qt + with: + toolchain: win64_mingw81 + - name: Install Qt Creator + uses: ./.github/actions/download-qtc + - name: Install MinGW + uses: ./.github/actions/download-mingw + - name: Setup Qbs + run: | + qbs setup-toolchains --detect + qbs setup-toolchains --type mingw $(which g++).exe mingw-qt + qbs setup-qt $(which qmake).exe qt + qbs config profiles.qt.baseProfile mingw-qt + qbs config defaultProfile qt + qbs config --list + shell: bash + - name: Print ccache stats + run: ccache -s + - name: Build Qbs + run: scripts/build-qbs-with-qbs.sh + shell: bash + - name: Print ccache stats + run: ccache -s + - name: Upload artifacts + uses: 'actions/upload-artifact@v2' + with: + name: qbs-windows-mingw-${{ github.run_id }}.zip + path: release/qbs-windows-mingw-${{ github.run_id }}.zip + test-linux: name: ${{ matrix.config.name }} runs-on: ubuntu-latest @@ -596,6 +661,14 @@ jobs: qtVersion: '5.15.2', script: './scripts/test-qbs.sh', } + - { + name: 'Run Windows tests (MinGW)', + target: 'desktop', + toolchain: 'win64_mingw81', + testProfile: 'mingw-qt', + qtVersion: '5.15.2', + script: './scripts/test-qbs.sh', + } env: QTEST_FUNCTION_TIMEOUT: 9000000 QBS_AUTOTEST_PROFILE: 'qt' @@ -623,9 +696,12 @@ jobs: with: toolchain: ${{ matrix.config.toolchain }} version: ${{ matrix.config.qtVersion }} + - name: Install MinGW + uses: ./.github/actions/download-mingw - name: Setup Qbs run: | qbs setup-toolchains --detect + qbs setup-toolchains --type mingw $(which g++).exe mingw-qt qbs setup-qt $(which qmake).exe qt qbs config profiles.qt.baseProfile ${{ matrix.config.testProfile }} qbs config defaultProfile qt diff --git a/scripts/install-qt.sh b/scripts/install-qt.sh index 9a3595062..fa7600a32 100755 --- a/scripts/install-qt.sh +++ b/scripts/install-qt.sh @@ -256,7 +256,14 @@ function compute_url(){ REMOTE_PATH="${SHORT_VERSION}/${VERSION}/installer_source/${HOST_OS}/qtcreator.7z" echo "${BASE_URL}/${REMOTE_PATH}" return 0 + elif [[ "${COMPONENT}" =~ "mingw" ]]; then + REMOTE_BASE="tools_mingw/qt.tools.${TOOLCHAIN}${VERSION//./}" + REMOTE_PATH="$(${CURL} ${BASE_URL}/${REMOTE_BASE}/ | grep -o -E "[[:alnum:]_.\-]*7z" | grep -v "meta" | head -1)" + if [ ! -z "${REMOTE_PATH}" ]; then + echo "${BASE_URL}/${REMOTE_BASE}/${REMOTE_PATH}" + return 0 + fi else REMOTE_BASES=( # New repository format (>=6.0.0) @@ -364,6 +371,12 @@ for COMPONENT in ${COMPONENTS}; do # Print the directory so that the caller can # adjust the PATH variable. echo $(dirname "${CONF_FILE}") + elif [[ "${COMPONENT}" =~ "mingw" ]]; then + if [[ "${TOOLCHAIN}" =~ "win64_mingw" ]]; then + echo "${UNPACK_DIR}/Tools/mingw${VERSION//./}_64/bin" + elif [[ "${TOOLCHAIN}" =~ "win32_mingw" ]]; then + echo "${UNPACK_DIR}/Tools/mingw${VERSION//./}/bin" + fi elif [[ "${COMPONENT}" =~ "qtcreator" ]]; then if [ "${HOST_OS}" == "mac_x64" ]; then echo "${UNPACK_DIR}/Qt Creator.app/Contents/MacOS" -- cgit v1.2.3