mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-19 06:30:07 +08:00
216 lines
7.7 KiB
YAML
216 lines
7.7 KiB
YAML
name: Nekoray build matrix - cmake
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: 'Release Tag'
|
|
required: true
|
|
publish:
|
|
description: 'Publish: If want ignore'
|
|
required: false
|
|
artifact-pack:
|
|
description: 'artifact-pack: If want ignore'
|
|
required: false
|
|
jobs:
|
|
build-go:
|
|
strategy:
|
|
matrix:
|
|
cross_os: [ windows, linux ]
|
|
cross_arch: [ amd64 ]
|
|
include:
|
|
- cross_os: public_res
|
|
cross_arch: public_res
|
|
fail-fast: false
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checking out sources
|
|
uses: actions/checkout@v3
|
|
- name: Go Status
|
|
run: git ls-files go | xargs cat | sha1sum > go_status
|
|
- name: Cache Common Download
|
|
id: cache-common
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: artifacts.tgz
|
|
key: CommonCache-${{ matrix.cross_os }}-${{ matrix.cross_arch }}-${{ hashFiles('libs/*.sh', 'go_status', '*.txt') }}
|
|
- name: Install Golang
|
|
if: steps.cache-common.outputs.cache-hit != 'true'
|
|
uses: actions/setup-go@v3
|
|
with:
|
|
go-version: ^1.20
|
|
- name: Build golang parts
|
|
if: steps.cache-common.outputs.cache-hit != 'true'
|
|
shell: bash
|
|
run: |
|
|
[ ${{ matrix.cross_os }} == public_res ] || ./libs/get_source.sh
|
|
[ ${{ matrix.cross_os }} == public_res ] || GOOS=${{ matrix.cross_os }} GOARCH=${{ matrix.cross_arch }} ./libs/build_go.sh
|
|
[ ${{ matrix.cross_os }} == public_res ] || exit 0
|
|
./libs/build_public_res.sh
|
|
- name: Tar files
|
|
if: steps.cache-common.outputs.cache-hit != 'true'
|
|
run: tar czvf artifacts.tgz ./deployment
|
|
- name: Uploading Artifact
|
|
uses: actions/upload-artifact@master
|
|
with:
|
|
name: NekoRay-${{ github.sha }}-Common-${{ matrix.cross_os }}-${{ matrix.cross_arch }}
|
|
path: artifacts.tgz
|
|
build-cpp:
|
|
strategy:
|
|
matrix:
|
|
platform: [ windows-2022, ubuntu-20.04 ]
|
|
arch: [ x64 ]
|
|
fail-fast: false
|
|
|
|
runs-on: ${{ matrix.platform }}
|
|
env:
|
|
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
|
|
steps:
|
|
- name: Checking out sources
|
|
uses: actions/checkout@v3
|
|
with:
|
|
submodules: "recursive"
|
|
- name: Install MSVC compiler
|
|
if: matrix.platform == 'windows-2022'
|
|
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 }}
|
|
# ========================================================================================================= Qt Install
|
|
- name: Windows - Download Custom Qt 5.15 SDK
|
|
shell: bash
|
|
if: matrix.platform == 'windows-2022'
|
|
run: |
|
|
mkdir qtsdk ; cd qtsdk
|
|
curl -LSO https://github.com/MatsuriDayo/nekoray_qt_runtime/releases/download/20220503/Qt5.15.7-Windows-x86_64-VS2019-16.11.20-20221103.7z
|
|
7z x *.7z
|
|
rm *.7z
|
|
mv Qt* Qt
|
|
# ========================================================================================================= 编译与 Qt 无关的依赖
|
|
- name: Install ninja-build tool
|
|
uses: seanmiddleditch/gha-setup-ninja@v3
|
|
- name: Cache Download
|
|
id: cache-deps
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: libs/deps
|
|
key: DepsCache-${{ matrix.platform }}-${{ matrix.arch }}-${{ hashFiles('libs/build_deps_*.sh') }}
|
|
- name: Build Dependencies
|
|
shell: bash
|
|
if: steps.cache-deps.outputs.cache-hit != 'true' && matrix.platform != 'ubuntu-20.04'
|
|
run: |
|
|
./libs/build_deps_all.sh
|
|
- name: Build Dependencies (Docker)
|
|
shell: bash
|
|
if: steps.cache-deps.outputs.cache-hit != 'true' && matrix.platform == 'ubuntu-20.04'
|
|
run: |
|
|
docker run --rm \
|
|
-v $PWD:/nekoray \
|
|
-w /nekoray \
|
|
ghcr.io/matsuridayo/debian10-qt5:20230131 \
|
|
bash -c "./libs/build_deps_all.sh"
|
|
# ========================================================================================================= Generate MakeFile and Build
|
|
- name: Windows - Generate MakeFile and Build
|
|
shell: bash
|
|
if: matrix.platform == 'windows-2022'
|
|
env:
|
|
CC: cl.exe
|
|
CXX: cl.exe
|
|
run: |
|
|
source libs/env_qtsdk.sh $PWD/qtsdk/Qt
|
|
mkdir build
|
|
cd build
|
|
cmake -GNinja -DCMAKE_BUILD_TYPE=Release ..
|
|
ninja
|
|
cd ..
|
|
./libs/deploy_windows64.sh
|
|
- name: Linux - Generate MakeFile and Build
|
|
shell: bash
|
|
if: matrix.platform == 'ubuntu-20.04'
|
|
run: |
|
|
docker run --rm \
|
|
-v $PWD:/nekoray \
|
|
-w /nekoray \
|
|
ghcr.io/matsuridayo/debian10-qt5:20230131 \
|
|
bash -c "mkdir build && pushd build && cmake -GNinja -DCMAKE_BUILD_TYPE=Release .. && ninja && popd &&./libs/deploy_linux64.sh"
|
|
# ========================================================================================================= Deployments
|
|
- name: Tar files
|
|
shell: bash
|
|
run: tar czvf artifacts.tgz ./deployment
|
|
- name: Uploading Artifact
|
|
uses: actions/upload-artifact@master
|
|
with:
|
|
name: NekoRay-${{ github.sha }}-${{ matrix.platform }}-${{ matrix.arch }}
|
|
path: artifacts.tgz
|
|
publish:
|
|
name: Pack & Publish Release
|
|
if: github.event.inputs.artifact-pack != 'y'
|
|
runs-on: ubuntu-latest
|
|
needs:
|
|
- build-cpp
|
|
- build-go
|
|
steps:
|
|
- name: Checking out sources
|
|
uses: actions/checkout@v3
|
|
- name: Download Artifacts
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
path: download-artifact
|
|
- name: Pack
|
|
run: |
|
|
curl -Lo - https://github.com/tcnksm/ghr/releases/download/v0.13.0/ghr_v0.13.0_linux_amd64.tar.gz | tar xzv
|
|
mv ghr*linux_amd64/ghr .
|
|
####
|
|
source libs/deploy_common.sh
|
|
find . -name artifacts.tgz | xargs -n1 tar xvzf
|
|
cd deployment
|
|
cp -r public_res/* linux64
|
|
cp -r public_res/* windows64
|
|
rm -rf public_res *.pdb
|
|
####
|
|
mv linux64 nekoray
|
|
zip -r $version_standalone-linux64.zip nekoray
|
|
rm -rf nekoray
|
|
####
|
|
mv windows64 nekoray
|
|
zip -r $version_standalone-windows64.zip nekoray
|
|
rm -rf nekoray
|
|
- name: Pack Debian
|
|
if: github.event.inputs.publish != 'y'
|
|
run: |
|
|
source libs/deploy_common.sh
|
|
find . -name artifacts.tgz | xargs -n1 tar xvzf
|
|
cd deployment
|
|
cp -r public_res/* linux64
|
|
cp -r public_res/* windows64
|
|
rm -rf public_res *.pdb
|
|
####
|
|
bash ../libs/package_debian.sh ${{ github.event.inputs.tag }}
|
|
mv nekoray.deb $version_standalone-debian-x64.deb
|
|
sudo rm -rf nekoray
|
|
- name: Pack AppImage
|
|
run: |
|
|
source libs/deploy_common.sh
|
|
find . -name artifacts.tgz | xargs -n1 tar xvzf
|
|
cd deployment
|
|
cp -r public_res/* linux64
|
|
rm -rf public_res *.pdb
|
|
####
|
|
bash ../libs/package_appimage.sh
|
|
mv nekoray-x86_64.AppImage $version_standalone-linux-x64.AppImage
|
|
- name: Clean Up
|
|
run: |
|
|
cd deployment
|
|
rm -rf linux64
|
|
rm -rf windows64
|
|
- name: Uploading Artifact
|
|
uses: actions/upload-artifact@master
|
|
with:
|
|
name: Deployment-${{ github.sha }}
|
|
path: deployment
|
|
- name: Release
|
|
if: github.event.inputs.publish != 'y'
|
|
run: |
|
|
./ghr -delete -t "${{ github.token }}" -n "${{ github.event.inputs.tag }}" "${{ github.event.inputs.tag }}" deployment
|