Update build-qv2ray-cmake.yml #59
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Qv2ray build matrix - cmake | |
on: | |
push: | |
branches-ignore: | |
- l10n_dev | |
release: | |
types: [prereleased] | |
workflow_dispatch: | |
jobs: | |
check_commit_msg: | |
outputs: | |
commit_message: ${{ steps.get_message.outputs.message }} | |
name: Check if the workflow has been disabled. | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Get commit message | |
id: get_message | |
run: | | |
echo "::set-output name=message::$(git log --format=%B -n 1 ${{ github.event.after }} | tr '\n' ' ')" | |
echo "message=\"$(git log --format=%B -n 1 ${{ github.event.after }} | tr '\n' ' ')\"" >> $GITHUB_ENV | |
build: | |
needs: check_commit_msg | |
if: ${{ !contains( needs.check_commit_msg.outputs.commit_message, '!QT5') }} | |
strategy: | |
matrix: | |
platform: [macos-latest] | |
arch: [x64] | |
#build_type: [RelWithDebInfo, Release] | |
build_type: [Release] | |
qt_version: [5.15.0] | |
#include: | |
# - platform: windows-latest | |
# arch: x64 | |
# qtarch: win64_msvc2019_64 | |
fail-fast: false | |
runs-on: ${{ matrix.platform }} | |
env: | |
_QV2RAY_BUILD_INFO_: "Qv2ray built from Github Action" | |
_QV2RAY_BUILD_EXTRA_INFO_: "qt${{ matrix.qt_version }}-${{ github.sha }}-ci.${{ matrix.platform }}" | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
steps: | |
- name: Get the version | |
id: get_version | |
shell: bash | |
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3) | |
- name: Checking out sources | |
uses: actions/checkout@v2 | |
with: | |
submodules: "recursive" | |
- name: Install Python 3.10 version | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10.11' | |
# ========================================================================================================= | |
- name: Install MSVC compiler | |
if: matrix.platform == 'windows-latest' | |
uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
# 14.1 is for vs2017, 14.2 is vs2019, following the upstream vcpkg build from Qv2ray-deps repo | |
toolset: 14.2 | |
arch: ${{ matrix.arch }} | |
- name: Cache Qt | |
id: cache-qt | |
uses: actions/cache@v1 | |
with: | |
path: ../Qt | |
key: QtCache-${{ matrix.platform }}-${{ matrix.arch }}-${{ matrix.qt_version }} | |
- name: Installing Qt - ${{ matrix.arch }} | |
uses: jurplel/install-qt-action@v2 | |
with: | |
version: ${{ matrix.qt_version }} | |
arch: ${{ matrix.qtarch }} | |
cached: ${{ steps.cache-qt.outputs.cache-hit }} | |
# ========================================================================================================= | |
- name: Linux - ${{ matrix.qt_version }} - Build preparation - Install Packages | |
if: matrix.platform == 'ubuntu-20.04' | |
run: | | |
sudo apt update | |
sudo apt install -y libgl-dev libx11-dev libxkbcommon-x11-dev libxcb-image0-dev libxcb-icccm4-dev libxcb-keysyms1 libxcb-render-util0 libxcb-xinerama0 \ | |
libprotobuf-dev protobuf-compiler protobuf-c-compiler libgrpc++-dev protobuf-compiler-grpc \ | |
ninja-build \ | |
fcitx-frontend-qt5 \ | |
fcitx5-frontend-qt5 \ | |
libcurl4-openssl-dev libssl-dev fuse | |
# -------------------------------------------------------- | |
- name: macOS - ${{ matrix.qt_version }} - Build preparation - Install Packages | |
if: matrix.platform == 'macos-latest' | |
run: | | |
brew install protobuf@21 | |
brew link protobuf@21 | |
brew install grpc@1.54 | |
brew link grpc@1.54 | |
brew install ninja pkg-config openssl | |
# -------------------------------------------------------- | |
- name: Win-${{ matrix.arch }} - ${{ matrix.qt_version }} - Setup Ninja | |
if: matrix.platform == 'windows-latest' | |
uses: ashutoshvarma/setup-ninja@master | |
with: | |
# ninja version to download. Default: 1.10.0 | |
version: 1.10.0 | |
- name: Win-${{ matrix.arch }} - ${{ matrix.qt_version }} - Build preparation - Download Dependencies | |
shell: bash | |
if: matrix.platform == 'windows-latest' | |
run: | | |
cd ./libs | |
./setup-libs.sh windows ${{ matrix.arch }} | |
# ========================================================================================================= Generate MakeFile and Build | |
- uses: actions/setup-node@v3 | |
if: matrix.platform == 'macos-latest' | |
with: | |
node-version: "18.x" | |
- run: npm install -g appdmg | |
if: matrix.platform == 'macos-latest' | |
- name: macOS - ${{ matrix.qt_version }} - Generate Dependencies and Build | |
shell: bash | |
if: matrix.platform == 'macos-latest' | |
env: | |
PKG_CONFIG_PATH: /usr/local/opt/openssl@1.1/lib/pkgconfig | |
run: | | |
mkdir build | |
cd build | |
cmake .. -GNinja \ | |
-DCMAKE_INSTALL_PREFIX=installed \ | |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ | |
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.13 \ | |
-DDS_STORE_SCRIPT=ON \ | |
-DQV2RAY_USE_V5_CORE=ON \ | |
-DQV2RAY_DEFAULT_VASSETS_PATH=/usr/local/opt/v2ray/share/v2ray \ | |
-DQV2RAY_DEFAULT_VCORE_PATH=/usr/local/opt/v2ray/bin/v2ray | |
cmake --build . --parallel $(sysctl -n hw.logicalcpu) | |
sudo cmake --install . | |
appdmg ../assets/package_dmg.json ../Qv2ray.dmg | |
# -------------------------------------------------------- | |
- name: Windows - ${{ matrix.qt_version }} - Generate Dependencies and Build | |
shell: bash | |
if: matrix.platform == 'windows-latest' | |
env: | |
CC: cl.exe | |
CXX: cl.exe | |
run: | | |
mkdir build | |
cd build | |
cmake .. -GNinja \ | |
-DCMAKE_INSTALL_PREFIX=./deployment \ | |
-DQV2RAY_USE_V5_CORE=ON \ | |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
cmake --build . --parallel $(nproc) | |
cmake --install . | |
cp -v ./*.pdb ./deployment || true | |
# -------------------------------------------------------- | |
- name: Linux - ${{ matrix.qt_version }} - Generate Dependencies and Build | |
if: matrix.platform == 'ubuntu-20.04' | |
shell: bash | |
run: | | |
mkdir build | |
cd build | |
cmake .. -GNinja \ | |
-DCMAKE_INSTALL_PREFIX=./AppDir/usr \ | |
-DQV2RAY_USE_V5_CORE=ON \ | |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ | |
-DQV2RAY_TRANSLATION_PATH=QApplication::applicationDirPath\(\)+"/../share/qv2ray/lang" | |
cmake --build . --parallel $(nproc) | |
cmake --install . | |
# ========================================================================================================= Deployments | |
- name: Linux - ${{ matrix.qt_version }} - Generating AppImage | |
if: matrix.platform == 'ubuntu-20.04' | |
run: | | |
cd build | |
cd AppDir | |
mkdir -p ./usr/lib/ | |
cp -fv /usr/lib/x86_64-linux-gnu/{libssl.so.1.1,libcrypto.so.1.1} ./usr/lib/ | |
cd .. | |
wget https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage | |
chmod +x ./linuxdeployqt-continuous-x86_64.AppImage | |
./linuxdeployqt-continuous-x86_64.AppImage AppDir/usr/share/applications/qv2ray.desktop \ | |
-appimage \ | |
-no-strip \ | |
-always-overwrite \ | |
-extra-plugins=iconengines,imageformats,platforminputcontexts | |
mv ./Qv2ray*.AppImage ./Qv2ray.AppImage | |
- name: Linux - ${{ matrix.qt_version }} - Uploading Artifact | |
if: matrix.platform == 'ubuntu-20.04' | |
uses: actions/upload-artifact@master | |
with: | |
name: Qv2ray-${{ github.sha }}.linux-${{ matrix.arch }}.qt${{ matrix.qt_version }}-${{ matrix.build_type }}.AppImage | |
path: build/Qv2ray.AppImage | |
- name: Linux - ${{ matrix.qt_version }} - Upload binaries to release | |
uses: svenstaro/upload-release-action@v1-release | |
if: github.event_name == 'release' && matrix.platform == 'ubuntu-20.04' && matrix.qt_version == '5.15.0' && matrix.build_type == 'Release' | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: build/Qv2ray.AppImage | |
asset_name: Qv2ray.${{ steps.get_version.outputs.VERSION }}.linux-${{ matrix.arch }}.AppImage | |
tag: ${{ github.ref }} | |
overwrite: true | |
# -------------------------------------------------------- | |
- name: macOS - ${{ matrix.qt_version }} - Uploading Artifact | |
if: matrix.platform == 'macos-latest' | |
uses: actions/upload-artifact@master | |
with: | |
name: Qv2ray-${{ github.sha }}.macOS-${{ matrix.arch }}.qt${{ matrix.qt_version }}-${{ matrix.build_type }}.dmg | |
path: Qv2ray.dmg | |
- name: macOS - ${{ matrix.qt_version }} - Upload binaries to release | |
uses: svenstaro/upload-release-action@v1-release | |
if: github.event_name == 'release' && matrix.platform == 'macos-latest' && matrix.qt_version == '5.15.0' && matrix.build_type == 'Release' | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: Qv2ray.dmg | |
asset_name: Qv2ray.${{ steps.get_version.outputs.VERSION }}.macOS-${{ matrix.arch }}.dmg | |
tag: ${{ github.ref }} | |
overwrite: true | |
# -------------------------------------------------------- | |
- name: Win-${{ matrix.arch }} - ${{ matrix.qt_version }} - Create 7z Release | |
if: matrix.platform == 'windows-latest' | |
uses: DuckSoft/create-7z-action@v1.0 | |
with: | |
pathSource: ./build/deployment/ | |
pathTarget: ./release.7z | |
- name: Win-${{ matrix.arch }} - ${{ matrix.qt_version }} - Uploading Artifact | |
if: matrix.platform == 'windows-latest' | |
uses: actions/upload-artifact@master | |
with: | |
name: Qv2ray-${{ github.sha }}.Windows-${{ matrix.arch }}.qt${{ matrix.qt_version }}-${{ matrix.build_type }}.7z | |
path: release.7z | |
- name: Win-${{ matrix.arch }} - ${{ matrix.qt_version }} - Upload binaries to release | |
uses: svenstaro/upload-release-action@v1-release | |
if: github.event_name == 'release' && matrix.platform == 'windows-latest' && matrix.qt_version == '5.15.0' && matrix.build_type == 'Release' | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: release.7z | |
asset_name: Qv2ray.${{ steps.get_version.outputs.VERSION }}.Windows-${{ matrix.arch }}.7z | |
tag: ${{ github.ref }} | |
overwrite: true |