Skip to content

Commit

Permalink
Merge pull request #20 from s12mmm3/openssl-cmake
Browse files Browse the repository at this point in the history
feat:添加ubuntu macos CI
  • Loading branch information
s12mmm3 committed Feb 8, 2024
2 parents b6d8561 + 79c4cd6 commit afd611b
Show file tree
Hide file tree
Showing 3 changed files with 185 additions and 27 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: MacOS
on:
# push代码时触发workflow
push:
paths:
- '**'
pull_request:
paths:
- '**'
jobs:
build:
name: Build
runs-on: macos-latest
strategy:
# 矩阵配置
matrix:
include:
# 5.12.12
- qt_version: 5.12.12
qt_arch: clang_64
# 5.15.2
- qt_version: 5.15.2
qt_arch: clang_64
# 6.2.4
- qt_version: 6.2.4
qt_arch: clang_64
# 6.6.0
- qt_version: 6.6.1
qt_arch: clang_64
modules: 'qthttpserver qtwebsockets'
env:
BUILD_TYPE: Release
BUILD_PATH: build
assume: --release
qt_target: 'desktop'
qt_host: 'mac'
archiveName: 'QCloudMusicApi-${{ github.ref_name }}-${{ matrix.qt_version }}-${{ matrix.qt_arch }}'
# 步骤
steps:
# 安装Qt
- name: Install Qt
if: 'true'
# 使用外部action。这个action专门用来安装Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt_version }}
host: ${{ env.qt_host }}
target: ${{ env.qt_target }}
arch: ${{ matrix.qt_arch }}
install-deps: 'true'
cache: 'true'
aqtversion: '==3.1.*'
modules: ${{ matrix.modules }}
# tools: ${{ matrix.tools }}
# 拉取代码
- uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: true

- name: CMake Build
id: build
run: |
cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_INSTALL_PREFIX=${{ github.workspace }} -B ${{ env.BUILD_PATH }}
ls
# CMake Install
- name: CMake Install
env:
prefix: ${{ github.workspace }}
run: |
cd ${{ github.workspace }}
cmake --build ${{ env.BUILD_PATH }} --target install --config ${{ env.BUILD_TYPE }}
ls
# tag 查询github-Release
# 上传artifacts
- uses: actions/upload-artifact@v4
with:
name: ${{ env.archiveName }}
path: ${{ github.workspace }}/${{ env.BUILD_PATH }}/${{ env.BUILD_TYPE }}
81 changes: 81 additions & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Ubuntu
on:
# push代码时触发workflow
push:
paths:
- '**'
pull_request:
paths:
- '**'
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
# 矩阵配置
matrix:
include:
# 5.12.12
- qt_version: 5.12.12
qt_arch: gcc_64
# 5.15.2
- qt_version: 5.15.2
qt_arch: gcc_64
# 6.2.4
- qt_version: 6.2.4
qt_arch: gcc_64
# 6.6.0
- qt_version: 6.6.1
qt_arch: gcc_64
modules: 'qthttpserver qtwebsockets'
env:
BUILD_TYPE: Release
BUILD_PATH: build
assume: --release
qt_target: 'desktop'
qt_host: 'linux'
archiveName: 'QCloudMusicApi-${{ github.ref_name }}-${{ matrix.qt_version }}-${{ matrix.qt_arch }}'
# 步骤
steps:
# 安装Qt
- name: Install Qt
if: 'true'
# 使用外部action。这个action专门用来安装Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt_version }}
host: ${{ env.qt_host }}
target: ${{ env.qt_target }}
arch: ${{ matrix.qt_arch }}
install-deps: 'true'
cache: 'true'
aqtversion: '==3.1.*'
modules: ${{ matrix.modules }}
# tools: ${{ matrix.tools }}
# 拉取代码
- uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: true

- name: CMake Build
id: build
run: |
cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_INSTALL_PREFIX=${{ github.workspace }} -B ${{ env.BUILD_PATH }}
ls
# CMake Install
- name: CMake Install
env:
prefix: ${{ github.workspace }}
run: |
cd ${{ github.workspace }}
cmake --build ${{ env.BUILD_PATH }} --target install --config ${{ env.BUILD_TYPE }}
ls
# tag 查询github-Release
# 上传artifacts
- uses: actions/upload-artifact@v4
with:
name: ${{ env.archiveName }}
path: ${{ github.workspace }}/${{ env.BUILD_PATH }}/${{ env.BUILD_TYPE }}
51 changes: 24 additions & 27 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,43 @@ on:
jobs:
build:
name: Build
# 运行平台, windows-latest目前是windows server 2019
# 参考文档 https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md
runs-on: windows-2019
runs-on: windows-latest
strategy:
# 矩阵配置
matrix:
include:
# 5.12.12
- qt_ver: 5.12.12
- qt_version: 5.12.12
qt_arch: win64_msvc2015_64
arch: x64
- qt_ver: 5.12.12
- qt_version: 5.12.12
qt_arch: win64_msvc2017_64
arch: x64
# 5.15.2
- qt_ver: 5.15.2
- qt_version: 5.15.2
qt_arch: win32_msvc2019
arch: win32
- qt_ver: 5.15.2
- qt_version: 5.15.2
qt_arch: win64_msvc2019_64
arch: x64
# 6.2.4
- qt_ver: 6.2.4
- qt_version: 6.2.4
qt_arch: win64_msvc2019_64
arch: x64
# 6.6.0
- qt_ver: 6.6.0
- qt_version: 6.6.0
qt_arch: win64_msvc2019_64
arch: x64
modules: 'qthttpserver qtwebsockets'
env:
BUILD_TYPE: Release
BUILD_PATH: build
assume: --release
qt_target: 'desktop'
qt_host: 'windows'
# 压缩包名称
archiveName: 'QCloudMusicApi-${{ github.ref_name }}-${{ matrix.qt_version }}-${{ matrix.qt_arch }}.zip'
# 步骤
steps:
# 安装Qt
Expand All @@ -52,17 +55,17 @@ jobs:
# 使用外部action。这个action专门用来安装Qt
uses: jurplel/install-qt-action@v3
with:
# Version of Qt to install
version: ${{ matrix.qt_ver }}
# Target platform for build
# target: ${{ matrix.qt_target }}
version: ${{ matrix.qt_version }}
host: ${{ env.qt_host }}
target: ${{ env.qt_target }}
arch: ${{ matrix.qt_arch }}
install-deps: 'true'
cache: 'true'
aqtversion: '==2.0.5'
aqtversion: '==3.1.*'
modules: ${{ matrix.modules }}
# tools: ${{ matrix.tools }}
# 拉取代码
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: true
Expand All @@ -79,13 +82,11 @@ jobs:
shell: pwsh
run: |
cd ${{ github.workspace }}
cmake --build ${{ env.BUILD_PATH }} --target INSTALL --config ${{ env.BUILD_TYPE }}
cmake --build ${{ env.BUILD_PATH }} --target install --config ${{ env.BUILD_TYPE }}
ls
# 打包
- name: Package
id: package
env:
archiveName: 'QCloudMusicApi-${{ github.ref_name }}-${{ matrix.qt_ver }}-${{ matrix.qt_arch }}'
id: package
shell: pwsh
run: |
cd ${{ github.workspace }}/${{ env.BUILD_PATH }}
Expand All @@ -97,26 +98,22 @@ jobs:
windeployqt ${{ env.assume }} --qmldir . --no-translations --compiler-runtime ${{ env.BUILD_TYPE }}\bin\Test.exe
windeployqt ${{ env.assume }} --qmldir . --no-translations --compiler-runtime ${{ env.BUILD_TYPE }}\bin\ApiServer.exe
# 打包zip
Compress-Archive -Path ${{ env.BUILD_TYPE }}\* ${env:archiveName}'.zip'
Compress-Archive -Path ${{ env.BUILD_TYPE }}\* ${{ env.archiveName }}
Tree ${{ env.BUILD_TYPE }} /F
# 记录packageName给后续step
$name = ${env:archiveName}
echo "::set-output name=packageName::$name"
ls
# tag 查询github-Release
# 上传artifacts
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: ${{ steps.package.outputs.packageName }}
name: ${{ env.archiveName }}
path: ${{ github.workspace }}/${{ env.BUILD_PATH }}/${{ env.BUILD_TYPE }}
# tag 上传Release
- name: Upload Release
if: startsWith(github.event.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ github.workspace }}/${{ env.BUILD_PATH }}/${{ steps.package.outputs.packageName }}.zip
asset_name: ${{ steps.package.outputs.packageName }}.zip
file: ${{ github.workspace }}/${{ env.BUILD_PATH }}/${{ env.archiveName }}
asset_name: ${{ env.archiveName }}
tag: ${{ github.ref }}
overwrite: true

0 comments on commit afd611b

Please sign in to comment.