Skip to content

Commit

Permalink
CI: modify ci
Browse files Browse the repository at this point in the history
  • Loading branch information
KangLin committed Feb 20, 2024
1 parent d1deb3b commit 162cd9e
Show file tree
Hide file tree
Showing 7 changed files with 189 additions and 304 deletions.
82 changes: 34 additions & 48 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,30 @@ jobs:
strategy:
matrix:
BUILD_TYPE: [Release]
qt_arch: [android_arm64_v8a, android_armv7, android_x86_64]
qt_arch: [android_arm64_v8a, android_x86_64]
qt_version: [6.6.1]
include:
- BUILD_TYPE: Release
qt_arch: android_arm64_v8a
qt_version: 6.6.1
VCPKG_TARGET_TRIPLET: arm-android
VCPKG_TARGET_TRIPLET: arm64-android
config_arch: arm64_v8a

- BUILD_TYPE: Release
qt_arch: android_armv7
qt_version: 6.6.1
VCPKG_TARGET_TRIPLET: arm-android

- BUILD_TYPE: Release
qt_version: 6.6.1
qt_arch: android_x86_64
VCPKG_TARGET_TRIPLET: x64-android
config_arch: x86_64

runs-on: ubuntu-latest

env:
artifact_name: build_android
SOURCE_DIR: ${{github.workspace}}/.cache/source
TOOSL_DIR: ${{github.workspace}}/.cache/tools
INSTALL_DIR: ${{github.workspace}}/.cache/install_${{matrix.BUILD_TYPE}}
INSTALL_DIR: ${{github.workspace}}/.cache/install
ChineseChessControl_VERSION: "v2.0.11"
VCPKGGITCOMMITID: a1a1cbc975abf909a6c8985a6a2b8fe20bbd9bd6
ANDROID_PLATFORM: android-23
ANDROID_NATIVE_API_LEVEL: 23
ChineseChessControl_VERSION: "v2.0.11"
VCPKGGITCOMMITID: 6359372f3ca1e6072e302e1d7238f31b259c5b51
qt_modules: 'qtimageformats qtmultimedia qtscxml qtwebchannel qtwebsockets qtwebview'

# Map the job outputs to step outputs
Expand All @@ -61,27 +56,38 @@ jobs:
cmake -E make_directory ${{env.INSTALL_DIR}}
cmake -E make_directory ${{github.workspace}}/build
- name: Cache Qt
- name: Cache installed
#if: false
id: cache-qt
uses: actions/cache@v1 # not v2!
uses: actions/cache@v2
id: cache-installed
with:
path: |
${{env.INSTALL_DIR}}
key: cache-installed-android-qt${{matrix.qt_version}}-${{matrix.qt_arch}}-${{matrix.BUILD_TYPE}}

- name: run vcpkg
uses: lukka/run-vcpkg@v11
with:
path: ${{env.TOOSL_DIR}}/qt
key: qt${{matrix.qt_version}}_${{matrix.qt_arch}}
# Indicates whether to only setup vcpkg (i.e. installing it and setting the environment variables VCPKG_ROOT, RUNVCPK_VCPKG_ROOT), without installing any port.
#setupOnly: # optional
#vcpkgGitURL: https://github.com/KangLin/vcpkg.git
vcpkgGitCommitId: ${{env.VCPKGGITCOMMITID}}
vcpkgDirectory: ${{ runner.workspace }}/vcpkg/

- name: Install Qt of gcc_64
uses: jurplel/install-qt-action@v3.2.1
uses: jurplel/install-qt-action@v3
with:
dir: '${{env.TOOSL_DIR}}/qt' # optional
version: '${{matrix.qt_version}}'
#host: 'linux'
target: 'desktop'
arch: 'gcc_64'
set-env: false
cached: '${{ steps.cache-qt.outputs.cache-hit }}' # optional, default is false
cache: true
cache-key-prefix: cached_qt

- name: Install Qt of android
uses: jurplel/install-qt-action@v3.2.1
uses: jurplel/install-qt-action@v3
with:
# Directory to install Qt
dir: '${{env.TOOSL_DIR}}/qt' # optional
Expand All @@ -95,37 +101,14 @@ jobs:
arch: '${{matrix.qt_arch}}' # optional
# Additional Qt modules to install
modules: '${{env.qt_modules}}' # optional. See: https://ddalcino.github.io/aqt-list-server/
# Whether or not to actually download Qt
cached: '${{ steps.cache-qt.outputs.cache-hit }}' # optional, default is false

# - name: run-vcpkg
# uses: lukka/[email protected]
# with:
# # Indicates whether to only setup vcpkg (i.e. installing it and setting the environment variables VCPKG_ROOT, RUNVCPK_VCPKG_ROOT), without installing any port.
# #setupOnly: # optional
# #vcpkgGitURL: https://github.com/KangLin/vcpkg.git
# vcpkgGitCommitId: ${{env.VCPKGGITCOMMITID}}
# vcpkgDirectory: ${{ runner.workspace }}/vcpkg/
# # Since the cache must be invalidated when content of the vcpkg.json file changes, let's
# # compute its hash and append this to the computed cache's key.
# appendedCacheKey: android-qt${{matrix.qt_version}}-${{matrix.VCPKG_TARGET_TRIPLET}}-${{matrix.BUILD_TYPE}}-${{env.VCPKGGITCOMMITID}}
# additionalCachedPaths: $VCPKG_ROOT/installed
# vcpkgTriplet: '${{ matrix.VCPKG_TARGET_TRIPLET }}'
# vcpkgArguments: 'zlib openssl'

- name: Cache installed
uses: actions/cache@v3
id: cache-installed
with:
path: |
${{env.INSTALL_DIR}}
key: cache-installed-android-qt${{matrix.qt_version}}-${{matrix.VCPKG_TARGET_TRIPLET}}-${{matrix.BUILD_TYPE}}
cache: true
cache-key-prefix: cached_qt

- name: git clone RabbitCommon
working-directory: ${{env.SOURCE_DIR}}
run: |
git clone https://github.com/KangLin/RabbitCommon.git
- name: build ChineseChessControl
working-directory: ${{github.workspace}}/build
env:
Expand All @@ -136,6 +119,9 @@ jobs:
run: |
sudo chmod 777 ${Qt6_DIR}/bin/qt-cmake
${Qt6_DIR}/bin/qt-cmake .. \
-DCMARK_SHARED=OFF \
-DCMARK_TESTS=OFF \
-DCMARK_STATIC=ON \
-DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}} \
-DQT_HOST_PATH=${Qt6_DIR}/../gcc_64 \
-DANDROID_PLATFORM=${{env.ANDROID_PLATFORM}} \
Expand All @@ -144,10 +130,10 @@ jobs:
-DQT_ENABLE_VERBOSE_DEPLOYMENT=OFF \
-DQt6LinguistTools_DIR=${Qt6_DIR}/../gcc_64/lib/cmake/Qt6LinguistTools \
-DCMAKE_INSTALL_PREFIX=`pwd`/install
cmake --build . --config ${{matrix.BUILD_TYPE}} --target all
cmake --build . --config ${{matrix.BUILD_TYPE}} --target install
cmake --build . --config ${{matrix.BUILD_TYPE}} --target all
APK_FILE=`find . -name "android-*.apk"`
cp $APK_FILE ChineseChessControl_${{env.ChineseChessControl_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}_${{matrix.BUILD_TYPE}}.apk
cmake --build . --config ${{matrix.BUILD_TYPE}} --target install
7z a ChineseChessControl_${{env.ChineseChessControl_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}_${{matrix.BUILD_TYPE}}.zip install/*
- name: Update artifact
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 作者:康林<[email protected]>
# 作者:康林 <[email protected]>

name: build

Expand Down Expand Up @@ -80,10 +80,14 @@ jobs:
echo "文件签名:" >> ${{github.workspace}}/Note.md
for file in *
do
#echo $file
if [ -f $file ] && [ "${file##*.}" != "xml" ]; then
md5sum $file > $file.md5sum
cat $file.md5sum >> ${{github.workspace}}/Note.md
echo "$file"
if [ -f $file ]; then
if [ "${file##*.}" != "xml" ] && [ "${file##*.}" != "json" ]; then
md5sum $file > $file.md5sum
cat $file.md5sum >> ${{github.workspace}}/Notes.md
fi
else
rm -fr $file
fi
done
Expand Down
54 changes: 23 additions & 31 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ jobs:
BUILD_TYPE: [Release, Debug]
qt_version: [6.5.1, 5.15.2, 5.12.12]
qt_arch: [clang_64]
VCPKG_TARGET_TRIPLET: [x64-osx]
include:
- qt_version: 6.5.1
qt_modules: 'qtscxml qtmultimedia qtimageformats'

- qt_version: 5.15.2

- qt_version: 5.12.12

runs-on: macos-latest
Expand All @@ -32,10 +34,10 @@ jobs:
SOURCE_DIR: ${{github.workspace}}/.cache/source
TOOSL_DIR: ${{github.workspace}}/.cache/tools
INSTALL_DIR: ${{github.workspace}}/.cache/install_macos
ChineseChessControl_VERSION: "2.0.11"
artifact_name: build_macos
qt_modules: 'qtwebengine ${{ matrix.qt_modules }}'
VCPKGGITCOMMITID: 6359372f3ca1e6072e302e1d7238f31b259c5b51
VCPKGGITCOMMITID: a1a1cbc975abf909a6c8985a6a2b8fe20bbd9bd6
artifact_name: build_macos
ChineseChessControl_VERSION: "2.0.11"

# Map the job outputs to step outputs
outputs:
Expand All @@ -45,7 +47,7 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: true
submodules: recursive

- name: Make directories
run: |
Expand All @@ -60,43 +62,28 @@ jobs:
with:
path: |
${{env.INSTALL_DIR}}
key: Cache-macos-installed-qt${{matrix.qt_version}}-${{matrix.BUILD_TYPE}}
key: Cache-installed-macos

- name: run-vcpkg
uses: lukka/run-vcpkg@v7
- name: run vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: ${{env.VCPKGGITCOMMITID}}
vcpkgDirectory: ${{runner.workspace}}/vcpkg/
# Since the cache must be invalidated when content of the vcpkg.json file changes, let's
# compute its hash and append this to the computed cache's key.
appendedCacheKey: cache-vcpkg-msvc-${{matrix.triplet}}-qt${{matrix.qt_version}}-${{matrix.BUILD_TYPE}}-${{env.VCPKGGITCOMMITID}}
vcpkgTriplet: '${{matrix.triplet}}'
vcpkgArguments: 'zlib openssl'

- name: Cache Qt
id: cache-qt
uses: actions/cache@v1 # not v2!
with:
path: ${{env.TOOSL_DIR}}/qt
key: qt${{matrix.qt_version}}-${{matrix.qt_arch}}

- name: Install Qt
# You may pin to the exact commit or the version.
# uses: jurplel/install-qt-action@a962fb91949c8e846a3e4a944d50e7ef5cc3a28a
uses: jurplel/[email protected]
uses: jurplel/install-qt-action@v3
with:
# Directory to install Qt
dir: ${{env.TOOSL_DIR}}/qt # optional
# Version of Qt to install
version: ${{matrix.qt_version}} # optional, default is 5.15.2
dir: '${{env.TOOSL_DIR}}/qt' # optional
version: '${{matrix.qt_version}}' # optional, default is 5.15.2
arch: '${{matrix.qt_arch}}' # optional
modules: '${{env.qt_modules}}' # optional. See: https://ddalcino.github.io/aqt-list-server/
cache: ${{steps.cache-qt.outputs.cache-hit}} # optional, default is false
cache: true
cache-key-prefix: cached_qt

- name: git clone RabbitCommon
working-directory: ${{env.SOURCE_DIR}}
run: |
git clone https://github.com/KangLin/RabbitCommon.git
run: git clone https://github.com/KangLin/RabbitCommon.git

- name: build ChineseChessControl
working-directory: ${{github.workspace}}/build
env:
Expand All @@ -108,8 +95,12 @@ jobs:
-DCMARK_STATIC=ON \
-DCMAKE_BUILD_TYPE=${{ matrix.BUILD_TYPE }} \
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/build/install \
-DCMAKE_PREFIX_PATH=${{env.INSTALL_DIR}}/lib/cmake
-DCMAKE_PREFIX_PATH=${{env.INSTALL_DIR}}/lib/cmake \
-DVCPKG_VERBOSE=ON \
-DX_VCPKG_APPLOCAL_DEPS_INSTALL=ON \
-DCMAKE_TOOLCHAIN_FILE=${{env.VCPKG_ROOT}}/scripts/buildsystems/vcpkg.cmake
cmake --build . --config ${{ matrix.BUILD_TYPE }} --target install
7z a ChineseChessControl_${{env.LunarCalendar_VERSION}}_macos_qt${{matrix.qt_version}}_${{ matrix.BUILD_TYPE }}.zip ./install/*
cmake --build . --config ${{ matrix.BUILD_TYPE }} --target package
- name: Update artifact
Expand All @@ -119,6 +110,7 @@ jobs:
name: ${{ env.artifact_name }}
path: |
${{github.workspace}}/build/chinesechesscontrol_*.tar.gz
${{github.workspace}}/build/ChineseChessControl_${{env.LunarCalendar_VERSION}}_macos_qt${{matrix.qt_version}}_${{ matrix.BUILD_TYPE }}.zip
# - name: Upload To Github Release
# if: ${{ matrix.BUILD_TYPE == 'Release' && startsWith(github.ref, 'refs/tags/') }}
Expand Down
22 changes: 8 additions & 14 deletions .github/workflows/mingw.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: build_mingw
name: mingw

on:
workflow_call:
Expand All @@ -9,11 +9,9 @@ on:

jobs:
build_mingw:
name: build mingw

strategy:
matrix:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: [Release, Debug]

defaults:
Expand All @@ -26,8 +24,8 @@ jobs:
SOURCE_DIR: ${{github.workspace}}\.cache\source
TOOSL_DIR: ${{github.workspace}}\.cache\tools
INSTALL_DIR: ${{github.workspace}}\.cache\install_mingw
ChineseChessControl_VERSION: "v2.0.11"
artifact_name: build_mingw
ChineseChessControl_VERSION: "v2.0.11"

# Map the job outputs to step outputs
outputs:
Expand Down Expand Up @@ -55,19 +53,14 @@ jobs:
mingw-w64-x86_64-make ^
mingw-w64-x86_64-nsis ^
mingw-w64-x86_64-gcc ^
mingw-w64-x86_64-qt5 ^
mingw-w64-x86_64-qt6 ^
mingw-w64-x86_64-qt6-multimedia ^
mingw-w64-x86_64-qt6-svg ^
mingw-w64-x86_64-qtwebkit ^
mingw-w64-x86_64-zlib ^
mingw-w64-x86_64-7zip ^
git base-devel
- name: Cache installed
uses: actions/cache@v3
id: cache-installed
with:
path: |
${{env.INSTALL_DIR}}
key: cache-installed-mingw

- name: git clone RabbitCommon
working-directory: ${{env.SOURCE_DIR}}
run: |
Expand All @@ -87,7 +80,8 @@ jobs:
-DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}} ^
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/install ^
-DCMAKE_PREFIX_PATH=${{env.INSTALL_DIR}} ^
-DCMAKE_CXX_COMPILER_ARCHITECTURE_ID=x86_64
-DINSTALL_QT=ON ^
-DBUILD_APP=ON
cmake --build . --config ${{ matrix.BUILD_TYPE }}
- name: Package
Expand Down
Loading

0 comments on commit 162cd9e

Please sign in to comment.