1
0
mirror of https://github.com/jaredtao/TaoQuick.git synced 2025-01-31 21:22:58 +08:00

update ci

This commit is contained in:
jared 2019-12-07 15:45:19 +08:00
parent 2aa358e710
commit a6838ead34
8 changed files with 476 additions and 78 deletions

46
.github/workflows/android.yml vendored Normal file
View File

@ -0,0 +1,46 @@
name: Android
on:
push:
paths-ignore:
- 'README.md'
- 'LICENSE'
pull_request:
paths-ignore:
- 'README.md'
- 'LICENSE'
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
# 5.9.8 版本低,需要额外设置工具链。这里暂不支持。
qt_ver: [5.12.6]
qt_target: [android]
# android_arm64_v8a 暂时不支持. install-qt-action 依赖的aqtinstall版本为0.5*,需要升级
# qt_arch: [android_x86,android_armv7,android_arm64_v8a]
qt_arch: [android_x86,android_armv7]
# exclude:
# - qt_ver: 5.9.8
# qt_arch: android_arm64_v8a
steps:
- name: Install Qt
# if: steps.cacheqt.outputs.cache-hit != 'true'
uses: jurplel/install-qt-action@v2.0.0
with:
# Version of Qt to install
version: ${{ matrix.qt_ver }}
# Target platform for build
target: ${{ matrix.qt_target }}
# Architecture for Windows/Android
arch: ${{ matrix.qt_arch }}
- uses: actions/checkout@v1
with:
fetch-depth: 1
- name: build android
run: |
export ANDROID_SDK_ROOT=$ANDROID_HOME
export ANDROID_NDK_ROOT=$ANDROID_HOME/ndk-bundle
qmake
make

33
.github/workflows/ios.yml vendored Normal file
View File

@ -0,0 +1,33 @@
name: IOS
on:
push:
paths-ignore:
- 'README.md'
pull_request:
paths-ignore:
- 'README.md'
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest]
qt_ver: [5.12.6]
qt_target: [ios]
steps:
- name: Install Qt
# if: steps.cacheqt.outputs.cache-hit != 'true'
uses: jurplel/install-qt-action@v2.0.0
with:
# Version of Qt to install
version: ${{ matrix.qt_ver }}
# Target platform for build
target: ${{ matrix.qt_target }}
- uses: actions/checkout@v1
with:
fetch-depth: 1
- name: build ios
run: |
qmake -r -spec macx-ios-clang CONFIG+=release CONFIG+=iphoneos
make

131
.github/workflows/macos.yml vendored Normal file
View File

@ -0,0 +1,131 @@
name: MacOS
on:
push:
paths-ignore:
- 'README.md'
- 'LICENSE'
pull_request:
paths-ignore:
- 'README.md'
- 'LICENSE'
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest]
qt_ver: [5.12.6]
qt_arch: [clang_64]
env:
targetName: TaoQuickApp
steps:
- name: cacheQt
id: MacosCacheQt
uses: actions/cache@v1
with:
path: ../Qt/${{matrix.qt_ver}}/${{matrix.qt_arch}}
key: ${{ runner.os }}-Qt/${{matrix.qt_ver}}/${{matrix.qt_arch}}
- name: setupQt
if: steps.MacosCacheQt.outputs.cache-hit == 'true'
shell: pwsh
env:
QtPath: ../Qt/${{matrix.qt_ver}}/${{matrix.qt_arch}}
run: |
$qt_Path=${env:QtPath}
echo "::set-env name=Qt5_Dir::$qt_Path"
echo "::add-path::$qt_Path/bin"
- name: Install Qt
if: steps.MacosCacheQt.outputs.cache-hit != 'true'
uses: jurplel/install-qt-action@v2.0.0
with:
version: ${{ matrix.qt_ver }}
- uses: actions/checkout@v1
with:
fetch-depth: 1
- name: build macos
run: |
qmake
make
# tag 打包
- name: package
if: startsWith(github.event.ref, 'refs/tags/')
run: |
# 拷贝依赖
macdeployqt bin/${targetName}.app -qmldir=. -verbose=1 -dmg
# tag 查询github-Release
- name: queryRelease
id: queryReleaseMacos
if: startsWith(github.event.ref, 'refs/tags/')
shell: pwsh
env:
githubFullName: ${{ github.event.repository.full_name }}
ref: ${{ github.event.ref }}
run: |
[string]$tag = ${env:ref}.Substring(${env:ref}.LastIndexOf('/') + 1)
[string]$url = 'https://api.github.com/repos/' + ${env:githubFullName} + '/releases/tags/' + ${tag}
$response={}
try {
$response = Invoke-RestMethod -Uri $url -Method Get
} catch {
Write-Host "StatusCode:" $_.Exception.Response.StatusCode.value__
Write-Host "StatusDescription:" $_.Exception.Response.StatusDescription
# 没查到,输出
echo "::set-output name=needCreateRelease::true"
return
}
[string]$latestUpUrl = $response.upload_url
Write-Host 'latestUpUrl:'$latestUpUrl
if ($latestUpUrl.Length -eq 0) {
# 没查到,输出
echo "::set-output name=needCreateRelease::true"
}
# tag 创建github-Release
- name: createReleaseWin
id: createReleaseWin
if: startsWith(github.event.ref, 'refs/tags/') && steps.queryReleaseMacos.outputs.needCreateRelease == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: actions/create-release@v1.0.0
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: ${{ github.event.head_commit.message }}
draft: false
prerelease: false
# 重定向upload_url到环境变量uploadUrl。
- name: getLatestTagRelease
# tag 上一步无论成功还是失败都执行
if: startsWith(github.event.ref, 'refs/tags/')
shell: pwsh
env:
githubFullName: ${{ github.event.repository.full_name }}
upUrl: ${{ steps.queryReleaseMacos.outputs.upload_url }}
ref: ${{ github.event.ref }}
run: |
# upUrl不为空导出就完事
if (${env:upUrl}.Length -gt 0) {
$v=${env:upUrl}
echo "::set-env name=uploadUrl::$v"
return
}
[string]$tag = ${env:ref}.Substring(${env:ref}.LastIndexOf('/') + 1)
[string]$url = 'https://api.github.com/repos/' + ${env:githubFullName} + '/releases/tags/' + ${tag}
$response = Invoke-RestMethod -Uri $url -Method Get
[string]$latestUpUrl = $response.upload_url
Write-Host 'latestUpUrl:'$latestUpUrl
echo "::set-env name=uploadUrl::$latestUpUrl"
Write-Host 'env uploadUrl:'${env:uploadUrl}
# tag 上传Release
- name: uploadRelease
id: uploadRelease
if: startsWith(github.event.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: actions/upload-release-asset@v1.0.1
with:
upload_url: ${{ env.uploadUrl }}
asset_path: ./bin/${{ env.targetName }}.dmg
asset_name: ${{ runner.os }}-${{ env.targetName }}.dmg
asset_content_type: application/applefile

50
.github/workflows/ubuntu.yml vendored Normal file
View File

@ -0,0 +1,50 @@
name: Ubuntu
# Qt官方没有linux平台的x86包
on:
push:
paths-ignore:
- 'README.md'
- 'LICENSE'
pull_request:
paths-ignore:
- 'README.md'
- 'LICENSE'
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-16.04,ubuntu-18.04]
qt_ver: [5.12.6]
qt_arch: [gcc_64]
steps:
- name: cacheQt
id: UbuntuCacheQt
uses: actions/cache@v1
with:
path: ../Qt/${{matrix.qt_ver}}/${{matrix.qt_arch}}
key: ${{ runner.os }}-Qt/${{matrix.qt_ver}}/${{matrix.qt_arch}}
- name: setupQt
if: steps.UbuntuCacheQt.outputs.cache-hit == 'true'
shell: pwsh
env:
QtPath: ../Qt/${{matrix.qt_ver}}/${{matrix.qt_arch}}
run: |
$qt_Path=${env:QtPath}
echo "::set-env name=Qt5_Dir::$qt_Path"
echo "::add-path::$qt_Path/bin"
- name: Install Qt
if: steps.UbuntuCacheQt.outputs.cache-hit != 'true'
uses: jurplel/install-qt-action@v2.0.0
with:
version: ${{ matrix.qt_ver }}
- name: ubuntu install GL library
run: sudo apt-get install -y libglew-dev libglfw3-dev
- uses: actions/checkout@v1
with:
fetch-depth: 1
- name: build ubuntu
run: |
qmake
make

175
.github/workflows/windows.yml vendored Normal file
View File

@ -0,0 +1,175 @@
name: Windows
on:
# push代码时触发workflow
push:
# 忽略README.md
paths-ignore:
- 'README.md'
- 'LICENSE'
# pull_request时触发workflow
pull_request:
# 忽略README.md
paths-ignore:
- 'README.md'
- 'LICENSE'
jobs:
build:
name: Build
# 运行平台, windows-latest目前是windows server 2019
runs-on: windows-latest
strategy:
# 矩阵配置
matrix:
qt_ver: [5.12.6]
qt_target: [desktop]
# mingw用不了
# qt_arch: [win64_msvc2017_64, win32_msvc2017, win32_mingw53,win32_mingw73]
qt_arch: [win64_msvc2017_64, win32_msvc2017]
# 额外设置msvc_arch
include:
- qt_arch: win64_msvc2017_64
msvc_arch: x64
qt_arch_install: msvc2017_64
- qt_arch: win32_msvc2017
msvc_arch: x86
qt_arch_install: msvc2017
env:
targetName: TaoQuickApp.exe
# 步骤
steps:
- name: cacheQt
id: WindowsCacheQt
uses: actions/cache@v1
with:
path: ../Qt/${{matrix.qt_ver}}/${{matrix.qt_arch_install}}
key: ${{ runner.os }}-Qt/${{matrix.qt_ver}}/${{matrix.qt_arch}}
- name: setupQt
if: steps.WindowsCacheQt.outputs.cache-hit == 'true'
shell: pwsh
env:
QtPath: ../Qt/${{matrix.qt_ver}}/${{matrix.qt_arch_install}}
run: |
$qt_Path=${env:QtPath}
echo "::set-env name=Qt5_Dir::$qt_Path"
echo "::add-path::$qt_Path/bin"
# 安装Qt
- name: Install Qt
if: steps.WindowsCacheQt.outputs.cache-hit != 'true'
# 使用外部action。这个action专门用来安装Qt
uses: jurplel/install-qt-action@v2.0.0
with:
# Version of Qt to install
version: ${{ matrix.qt_ver }}
# Target platform for build
target: ${{ matrix.qt_target }}
# Architecture for Windows/Android
arch: ${{ matrix.qt_arch }}
# 拉取代码
- uses: actions/checkout@v1
with:
fetch-depth: 1
# 编译msvc
- name: build-msvc
shell: cmd
env:
vc_arch: ${{ matrix.msvc_arch }}
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" %vc_arch%
qmake
nmake
# tag 打包
- name: package
if: startsWith(github.event.ref, 'refs/tags/')
env:
VCINSTALLDIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC'
archiveName: ${{ matrix.qt_ver }}-${{ matrix.qt_target }}-${{ matrix.qt_arch }}
shell: pwsh
run: |
# 创建文件夹
New-Item -ItemType Directory ${env:archiveName}
# 拷贝exe
Copy-Item bin\${env:targetName} ${env:archiveName}\
# 拷贝依赖
windeployqt --qmldir . ${env:archiveName}\${env:targetName}
# 打包zip
Compress-Archive -Path ${env:archiveName} ${env:archiveName}'.zip'
# 记录环境变量packageName给后续step
$name = ${env:archiveName}
echo "::set-env name=packageName::$name"
# 打印环境变量packageName
Write-Host 'packageName:'${env:packageName}
# tag 查询github-Release
- name: queryReleaseWin
id: queryReleaseWin
if: startsWith(github.event.ref, 'refs/tags/')
shell: pwsh
env:
githubFullName: ${{ github.event.repository.full_name }}
ref: ${{ github.event.ref }}
run: |
[string]$tag = ${env:ref}.Substring(${env:ref}.LastIndexOf('/') + 1)
[string]$url = 'https://api.github.com/repos/' + ${env:githubFullName} + '/releases/tags/' + ${tag}
$response={}
try {
$response = Invoke-RestMethod -Uri $url -Method Get
} catch {
Write-Host "StatusCode:" $_.Exception.Response.StatusCode.value__
Write-Host "StatusDescription:" $_.Exception.Response.StatusDescription
# 没查到,输出
echo "::set-output name=needCreateRelease::true"
return
}
[string]$latestUpUrl = $response.upload_url
Write-Host 'latestUpUrl:'$latestUpUrl
if ($latestUpUrl.Length -eq 0) {
# 没查到,输出
echo "::set-output name=needCreateRelease::true"
}
# tag 创建github-Release
- name: createReleaseWin
id: createReleaseWin
if: startsWith(github.event.ref, 'refs/tags/') && steps.queryReleaseWin.outputs.needCreateRelease == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: actions/create-release@v1.0.0
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: ${{ github.event.head_commit.message }}
draft: false
prerelease: false
# 重定向upload_url到环境变量uploadUrl。
- name: getLatestTagRelease
# tag 上一步无论成功还是失败都执行
if: startsWith(github.event.ref, 'refs/tags/')
shell: pwsh
env:
githubFullName: ${{ github.event.repository.full_name }}
upUrl: ${{ steps.createReleaseWin.outputs.upload_url }}
ref: ${{ github.event.ref }}
run: |
# upUrl不为空导出就完事
if (${env:upUrl}.Length -gt 0) {
$v=${env:upUrl}
echo "::set-env name=uploadUrl::$v"
return
}
[string]$tag = ${env:ref}.Substring(${env:ref}.LastIndexOf('/') + 1)
[string]$url = 'https://api.github.com/repos/' + ${env:githubFullName} + '/releases/tags/' + ${tag}
$response = Invoke-RestMethod -Uri $url -Method Get
[string]$latestUpUrl = $response.upload_url
Write-Host 'latestUpUrl:'$latestUpUrl
echo "::set-env name=uploadUrl::$latestUpUrl"
Write-Host 'env uploadUrl:'${env:uploadUrl}
# tag 上传Release
- name: uploadRelease
id: uploadRelease
if: startsWith(github.event.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: actions/upload-release-asset@v1.0.1
with:
upload_url: ${{ env.uploadUrl }}
asset_path: ./${{ env.packageName }}.zip
asset_name: ${{ env.packageName }}.zip
asset_content_type: application/zip

View File

@ -1,37 +0,0 @@
language: cpp
sudo: required
compiler: gcc
group: deprecated-2019Q1
matrix:
include:
- os: linux
dist: xenial
env:
releaseName=TaoQuickApp_ubuntu_xenial_x64.AppImage
cache:
apt: true
directories:
- /opt/qt512/
- ./linuxdeployqt.AppImage
- os: osx
osx_image: xcode10.2
env:
releaseName=TaoQuickApp_macos10-14_xcode10-2.dmg
before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then chmod a+x ./scripts/macos/install.sh; ./scripts/macos/install.sh; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then chmod a+x ./scripts/ubuntu/install.sh; ./scripts/ubuntu/install.sh; fi
script:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then chmod a+x ./scripts/macos/build.sh; ./scripts/macos/build.sh; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then chmod a+x ./scripts/ubuntu/build.sh; ./scripts/ubuntu/build.sh; fi
before_deploy:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then chmod a+x ./scripts/macos/deploy.sh; ./scripts/macos/deploy.sh; fi
deploy: # 部署
provider: releases # 部署到 GitHub Release除此之外Travis CI 还支持发布到 fir.im、AWS、Google App Engine 等
api_key: $GITHUB_OAUTH_TOKEN # 填写 GitHub 的 token Settings -> Personal access tokens -> Generate new token
file: bin/release/${releaseName} # 部署文件路径
skip_cleanup: true # 设置为 true 以跳过清理,不然 apk 文件就会被清理
on: # 发布时机
tags: true # tags 设置为 true 表示只有在有 tag 的情况下才部署
notifications:
email: false

View File

@ -6,7 +6,9 @@
- [目录](#%e7%9b%ae%e5%bd%95)
- [TaoQuick](#taoquick)
- [徽章预览](#%e5%be%bd%e7%ab%a0%e9%a2%84%e8%a7%88)
- [项目状态](#%e9%a1%b9%e7%9b%ae%e7%8a%b6%e6%80%81)
- [项目](#%e9%a1%b9%e7%9b%ae)
- [编译](#%e7%bc%96%e8%af%91)
- [发布](#%e5%8f%91%e5%b8%83)
- [仓库状态](#%e4%bb%93%e5%ba%93%e7%8a%b6%e6%80%81)
- [Issue](#issue)
- [其它状态](#%e5%85%b6%e5%ae%83%e7%8a%b6%e6%80%81)
@ -19,6 +21,7 @@
- [功能列表](#%e5%8a%9f%e8%83%bd%e5%88%97%e8%a1%a8)
- [开发环境](#%e5%bc%80%e5%8f%91%e7%8e%af%e5%a2%83)
- [TaoQuick 安装和使用](#taoquick-%e5%ae%89%e8%a3%85%e5%92%8c%e4%bd%bf%e7%94%a8)
- [答疑和技术支持](#%e7%ad%94%e7%96%91%e5%92%8c%e6%8a%80%e6%9c%af%e6%94%af%e6%8c%81)
- [联系方式](#%e8%81%94%e7%b3%bb%e6%96%b9%e5%bc%8f)
- [赞助](#%e8%b5%9e%e5%8a%a9)
- [赞助列表](#%e8%b5%9e%e5%8a%a9%e5%88%97%e8%a1%a8)
@ -37,27 +40,54 @@
## 徽章预览
### 项目状态
|[最佳实践计划][CII-link]|[许可][license-link]| [Ubuntu/MacOS][lin-link] | [Windows][win-link] |[已发布][release-link]|[下载][download-link]|下载次数|
|:--:|:--:|:--:|:--:|:--:|:--:|:--:|
|![CII-badge]|![license-badge]|![lin-badge]| ![win-badge]|![release-badge] |![download-badge]|![download-latest]|
### 项目
|[最佳实践计划][CII-link]|[许可][license-link]|
|:--:|:--:|
|![CII-badge]|![license-badge]|
[CII-badge]: https://bestpractices.coreinfrastructure.org/projects/3060/badge
[CII-link]: https://bestpractices.coreinfrastructure.org/projects/3060
[license-link]: https://github.com/jaredtao/TaoQuick/blob/master/LICENSE "LICENSE"
[license-badge]: https://img.shields.io/badge/license-MIT-blue.svg "MIT"
[lin-badge]: https://travis-ci.com/jaredtao/TaoQuick.svg?branch=master "Travis build status"
[lin-link]: https://travis-ci.com/jaredtao/TaoQuick "Travis build status"
[win-badge]: https://ci.appveyor.com/api/projects/status/ontim37g33hvfv72?svg=true "AppVeyor build status"
[win-link]: https://ci.appveyor.com/project/jiawentao/TaoQuick "AppVeyor build status"
### 编译
| [Windows][win-link]| [Ubuntu][ubuntu-link]|[MacOS][macos-link]|[Android][android-link]|[IOS][ios-link]|
|---------------|---------------|-----------------|-----------------|----------------|
| ![win-badge] | ![ubuntu-badge] | ![macos-badge] |![android-badge] |![ios-badge] |
[win-link]: https://github.com/JaredTao/TaoQuick/actions?query=workflow%3AWindows "WindowsAction"
[win-badge]: https://github.com/JaredTao/TaoQuick/workflows/Windows/badge.svg "Windows"
[ubuntu-link]: https://github.com/JaredTao/TaoQuick/actions?query=workflow%3AUbuntu "UbuntuAction"
[ubuntu-badge]: https://github.com/JaredTao/TaoQuick/workflows/Ubuntu/badge.svg "Ubuntu"
[macos-link]: https://github.com/JaredTao/TaoQuick/actions?query=workflow%3AMacOS "MacOSAction"
[macos-badge]: https://github.com/JaredTao/TaoQuick/workflows/MacOS/badge.svg "MacOS"
[android-link]: https://github.com/JaredTao/TaoQuick/actions?query=workflow%3AAndroid "AndroidAction"
[android-badge]: https://github.com/JaredTao/TaoQuick/workflows/Android/badge.svg "Android"
[ios-link]: https://github.com/JaredTao/TaoQuick/actions?query=workflow%3AIOS "IOSAction"
[ios-badge]: https://github.com/JaredTao/TaoQuick/workflows/IOS/badge.svg "IOS"
### 发布
|[已发布][release-link]|[下载][download-link]|下载次数|
|:--:|:--:|:--:|
|![release-badge] |![download-badge]|![download-latest]|
[release-link]: https://github.com/jaredtao/TaoQuick/releases "Release status"
[release-badge]: https://img.shields.io/github/release/jaredtao/TaoQuick.svg?style=flat-square "Release status"
[download-link]: https://github.com/jaredtao/TaoQuick/releases/latest "Download status"
[download-badge]: https://img.shields.io/github/downloads/jaredtao/TaoQuick/total.svg "Download status"
[download-latest]: https://img.shields.io/github/downloads/jaredtao/TaoQuick/latest/total.svg "latest status"
[CII-badge]: https://bestpractices.coreinfrastructure.org/projects/3060/badge
[CII-link]: https://bestpractices.coreinfrastructure.org/projects/3060
### 仓库状态
|最新标签|用到的编程语言数量|用最多的编程语言|代码大小|仓库大小|
|:--: |:--: |:--:|:--:|:--:|
|![tag-latest]|![languanges]|![taolanguage]|![code-size]|![repo-size]|

View File

@ -1,30 +0,0 @@
version: build{build}
branches:
except:
- project/travis
environment:
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
releaseName: TaoQuick_win64
build_script:
- call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
- set QTDIR=C:\Qt\5.12\msvc2017_64
- set PATH=%PATH%;%QTDIR%\bin;
- qmake
- nmake
after_build:
- if "%APPVEYOR_REPO_TAG%"=="true" windeployqt bin\release\TaoQuickApp.exe --qmldir %QTDIR%\qml
artifacts:
- path: bin
name: $(releaseName)
deploy:
provider: GitHub
auth_token: $(GITHUB_OAUTH_TOKEN)
description: 'TaoQuickDemo Release'
draft: false
prerelease: false
on:
APPVEYOR_REPO_TAG: true