Skip to content

Commit

Permalink
Added github actions matrix
Browse files Browse the repository at this point in the history
Moved from my testbed application.
Not all platforms build.
Deployment needs to be updated.
  • Loading branch information
cristianadam committed Dec 18, 2019
1 parent 6737d55 commit a5a6f2b
Showing 1 changed file with 226 additions and 0 deletions.
226 changes: 226 additions & 0 deletions .github/workflows/build_qmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 1,226 @@
name: QMake Build Matrix

on: [push]

jobs:
build:
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
config:
- {
artifact: "Windows.tar.xz",
os: windows-latest,
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat",

qt-base-url: "https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_5140",
qt-package-name: "qt.qt5.5140.win64_msvc2017_64",
qt-dir-prefix: "5.14.0/msvc2017_64",
qtc-base-url: "https://download.qt.io/official_releases/qtcreator/4.11/4.11.0",
qtc-platform: "windows_msvc2017_x64",
qtc-source: "qt-creator-opensource-src-4.11.0"
}
- {
artifact: "Linux.tar.xz",
os: ubuntu-latest,

qt-base-url: "https://download.qt.io/online/qtsdkrepository/linux_x64/desktop/qt5_5140",
qt-package-name: "qt.qt5.5140.gcc_64",
qt-dir-prefix: "5.14.0/gcc_64",
qtc-base-url: "https://download.qt.io/official_releases/qtcreator/4.11/4.11.0",
qtc-platform: "linux_gcc_64_rhel72",
qtc-source: "qt-creator-opensource-src-4.11.0"
}
- {
artifact: "macOS.tar.xz",
os: macos-latest,

qt-base-url: "https://download.qt.io/online/qtsdkrepository/mac_x64/desktop/qt5_5140",
qt-package-name: "qt.qt5.5140.clang_64",
qt-dir-prefix: "5.14.0/clang_64",
qtc-base-url: "https://download.qt.io/official_releases/qtcreator/4.11/4.11.0",
qtc-platform: "mac_x64",
qtc-source: "qt-creator-opensource-src-4.11.0"
}

steps:
- uses: actions/checkout@v1

- name: Download Qt
shell: cmake -P {0}
run: |
file(DOWNLOAD "${{ matrix.config.qt-base-url }}/Updates.xml" ./Updates.xml SHOW_PROGRESS)
file(READ ./Updates.xml updates_xml)
string(REGEX MATCH "<Name>${{ matrix.config.qt-package-name }}.*<Version>([0-9 -.] )</Version>.*<DownloadableArchives>qtbase([a-zA-Z0-9_-] ).7z"
updates_xml_output "${updates_xml}")
set(package_version ${CMAKE_MATCH_1})
set(package_suffix ${CMAKE_MATCH_2})
string(REPLACE "-debug-symbols" "" package_suffix "${package_suffix}")
file(MAKE_DIRECTORY qt5)
foreach(package qtbase qtdeclarative qttools qtsvg)
file(DOWNLOAD "${{ matrix.config.qt-base-url }}/${{ matrix.config.qt-package-name }}/${package_version}${package}${package_suffix}.7z" ./${package}.7z SHOW_PROGRESS)
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ../${package}.7z WORKING_DIRECTORY qt5)
endforeach()
file(READ "qt5/${{ matrix.config.qt-dir-prefix }}/mkspecs/qconfig.pri" qtconfig)
string(REPLACE "Enterprise" "OpenSource" qtconfig "${qtconfig}")
string(REPLACE "licheck.exe" "" qtconfig "${qtconfig}")
string(REPLACE "licheck64" "" qtconfig "${qtconfig}")
string(REPLACE "licheck_mac" "" qtconfig "${qtconfig}")
file(WRITE "qt5/${{ matrix.config.qt-dir-prefix }}/mkspecs/qconfig.pri" "${qtconfig}")
- name: Download Qt Creator
shell: cmake -P {0}
run: |
file(DOWNLOAD "${{ matrix.config.qtc-base-url }}/${{ matrix.config.qtc-source }}" ./qtcreator_src.7z SHOW_PROGRESS)
file(DOWNLOAD "${{ matrix.config.qtc-base-url }}/installer_source/${{ matrix.config.qtc-platform }}/qtcreator.7z" ./qtcreator.7z SHOW_PROGRESS)
file(DOWNLOAD "${{ matrix.config.qtc-base-url }}/installer_source/${{ matrix.config.qtc-platform }}/qtcreator_dev.7z" ./qtcreator_dev.7z SHOW_PROGRESS)
file(MAKE_DIRECTORY qtcreator)
foreach(package qtcreator_src qtcreator qtcreator_dev)
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ../${package}.7z WORKING_DIRECTORY qtcreator)
endforeach()
- name: Configure
shell: cmake -P {0}
run: |
if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x")
execute_process(
COMMAND "${{ matrix.config.environment_script }}" && set
OUTPUT_FILE environment_script_output.txt
)
file(STRINGS environment_script_output.txt output_lines)
foreach(line IN LISTS output_lines)
if (line MATCHES "^([a-zA-Z0-9_-] )=(.*)$")
set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}")
endif()
endforeach()
endif()
execute_process(
COMMAND qt5/${{ matrix.config.qt-dir-prefix }}/bin/qmake
doxygen.pro
CONFIG =release
QTC_SOURCE=qtcreator
QTC_BUILD=qtcreator
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status")
endif()
- name: Build
shell: cmake -P {0}
run: |
if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x")
file(STRINGS environment_script_output.txt output_lines)
foreach(line IN LISTS output_lines)
if (line MATCHES "^([a-zA-Z0-9_-] )=(.*)$")
set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}")
endif()
endforeach()
endif()
if ("${{ runner.os }}" STREQUAL "Windows")
set(ENV{PATH} "qt5/${{ matrix.config.qt-dir-prefix }}/bin/;$ENV{PATH}")
else()
set(ENV{PATH} "qt5/${{ matrix.config.qt-dir-prefix }}/bin/:$ENV{PATH}")
set(ENV{LD_LIBRARY_PATH} "qtcreator/lib/Qt/lib:$ENV{LD_LIBRARY_PATH}")
endif()
set(make_program "make")
if ("${{ runner.os }}" STREQUAL "Windows")
set(make_program "qtcreator/bin/jom")
endif()
execute_process(
COMMAND ${make_program}
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status")
endif()
#- uses: actions/upload-artifact@v1
#with:
#path: ./${{ matrix.config.artifact }}
#name: ${{ matrix.config.artifact }}

release:
if: contains(github.ref, 'tags/v')
runs-on: ubuntu-latest
needs: build

steps:
- name: Create Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

- name: Store Release url
run: |
echo "${{ steps.create_release.outputs.upload_url }}" > ./upload_url
- uses: actions/upload-artifact@v1
with:
path: ./upload_url
name: upload_url

publish:
if: contains(github.ref, 'tags/v')
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
config:
- {
artifact: "Windows.tar.xz",
os: ubuntu-latest
}
- {
artifact: "Linux.tar.xz",
os: ubuntu-latest
}
- {
artifact: "macOS.tar.xz",
os: ubuntu-latest
}
needs: release

steps:
- name: Download artifact
uses: actions/download-artifact@v1
with:
name: ${{ matrix.config.artifact }}
path: ./

- name: Download URL
uses: actions/download-artifact@v1
with:
name: upload_url
path: ./
- id: set_upload_url
run: |
upload_url=`cat ./upload_url`
echo ::set-output name=upload_url::$upload_url
- name: Upload to Release
id: upload_to_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.set_upload_url.outputs.upload_url }}
asset_path: ./${{ matrix.config.artifact }}
asset_name: ${{ matrix.config.artifact }}
asset_content_type: application/x-gtar

0 comments on commit a5a6f2b

Please sign in to comment.