Skip to content

Commit

Permalink
CI: Recovering CI for Windows and Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
XMuli committed Oct 31, 2022
1 parent baf3cf9 commit ead8c9a
Show file tree
Hide file tree
Showing 7 changed files with 420 additions and 336 deletions.
Binary file removed .github/workflows/.DS_Store
Binary file not shown.
126 changes: 126 additions & 0 deletions .github/workflows/Linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
name: Linux
on:
push:
paths-ignore:
# - '**'
- 'README.md'
pull_request:
paths-ignore:
- 'README.md'
jobs:
build:
name: Build
# 运行平台, ubuntu-latest 目前是 Ubuntu 20.04
# 参考文档 https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md
runs-on: ${{ matrix.os }}
strategy:
matrix: # 矩阵配置
qt_ver: [5.15.2] # 参考: https://mirrors.cloud.tencent.com/qt/online/qtsdkrepository/linux_x64/desktop/qt5_51211
qt_target: [desktop]
qt_arch: [gcc_64]
arch: [arm64, amd64]
os: [ubuntu-20.04] # ubuntu-18.04
env:
targetName: PicShot
targetLowerName: picshot
targetOS: debian
# ACTIONS_ALLOW_UNSECURE_COMMANDS: true

steps:
# - name: Cache Qt # 使用缓存安装Qt模块
# id: cache-qt
# uses: actions/cache@v1 # not v2! 参见 https://github.com/jurplel/install-qt-action
# with:
# path: ../Qt
# key: ${{ runner.os }}-QtCache-1

# - name: setupQt
# if: steps.cache-qt.outputs.cache-hit == 'true'
# shell: pwsh
# env:
# QtPath: ${{ github.workspace }}/../Qt/${{ matrix.qt_ver }}/${{ matrix.qt_arch_install }}
# QtPluginPath: ${{ github.workspace }}/../Qt/${{ matrix.qt_ver }}/${{ matrix.qt_arch_install }}/plugins
# Qml2ImportPath: ${{ github.workspace }}/../Qt/${{ matrix.qt_ver }}/${{ matrix.qt_arch_install }}/qml
# run: |
# $Qt5_Dir="${{ env.QtPath }}"
# $QT_PLUGIN_PATH="${{ env.QtPluginPath }}"
# $QML2_IMPORT_PATH="${{ env.Qml2ImportPath }}"

# echo "Qt5_Dir=$Qt5_Dir" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# echo "QT_PLUGIN_PATH=$QT_PLUGIN_PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# echo "QML2_IMPORT_PATH=$QML2_IMPORT_PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append

# echo "GITHUB_PATH=$Qt5_Dir/bin" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append

- name: Install Qt
# if: steps.cache-qt.outputs.cache-hit != 'true'
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt_ver }}
arch: ${{ matrix.qt_arch }}
set-env: true
# cached: ${{ steps.cache-qt.outputs.cache-hit }} // 默认 'false'

- uses: actions/checkout@v2
with:
fetch-depth: 1

- name: pull 3rdparty code
run: |
cd ${{github.workspace}}
git submodule init
git submodule update
- name: gcc build
id: gcc-build
shell: bash
run: |
mkdir build
cd build
cmake ..
make
- name: NameVersion
id: NameVersion
if: startsWith(github.event.ref, 'refs/tags/')
shell: pwsh
run: |
$systemInfo="${{ env.targetOS }}-${{ matrix.arch }}-x64"
$productVersion="${{ github.ref }}".substring("refs/tags/v".length)
$productName="${{ env.targetLowerName }}-$productVersion-beta-$systemInfo"
echo "systemInfo=$systemInfo" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "productVersion=$productVersion" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "productName=$productName" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# tag打为.zip包
- name: Package
id: Package
if: startsWith(github.event.ref, 'refs/tags/')
shell: bash
run: |
mkdir bin
cp -r build/bin/${{ env.targetName }} bin
cp -r debian_portable/* bin
sudo chmod 777 bin/ldd.sh
sudo chmod 777 bin/${{ env.targetName }}.sh
cd bin
./ldd.sh ${{ env.targetName }}
cd ..
zip -q -r ${{ env.productName }}.zip bin/*
# tag上传Release
- name: uploadRelease
if: startsWith(github.event.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.upload_release }}
with:
draft: false
prerelease: false
files: |
${{ env.productName }}.zip
tag: ${{ github.ref }}
overwrite: true
132 changes: 132 additions & 0 deletions .github/workflows/LinuxDeb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
name: LinuxDeb
on:
push:
paths-ignore:
# - '**'
- 'README.md'
pull_request:
paths-ignore:
- 'README.md'
jobs:
build:
name: Build
# 运行平台, ubuntu-latest 目前是 Ubuntu 20.04
# 参考文档 https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md
runs-on: ${{ matrix.os }}
strategy:
matrix: # 矩阵配置
qt_ver: [5.15.2] # 参考: https://mirrors.cloud.tencent.com/qt/online/qtsdkrepository/linux_x64/desktop/qt5_5152
qt_target: [desktop]
qt_arch: [gcc_64]
arch: [amd64] # arm64
os: [ubuntu-20.04]
env:
targetName: PicShot
targetLowerName: picshot
targetOS: debian

steps:
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt_ver }}
arch: ${{ matrix.qt_arch }}
set-env: true

- uses: actions/checkout@v2
with:
fetch-depth: 1

- name: pull 3rdparty code
run: |
cd ${{github.workspace}}
git submodule init
git submodule update
- name: NameVersion
id: NameVersion
if: startsWith(github.event.ref, 'refs/tags/')
shell: pwsh
run: |
$systemInfo="${{ env.targetOS }}-${{ matrix.arch }}-x64"
$productVersion="${{ github.ref }}".substring("refs/tags/v".length)
# $productName="${{ env.targetName }}-$productVersion-beta-$systemInfo"
$productDebName="${{ env.targetLowerName }}-$productVersion"
echo "systemInfo=$systemInfo" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "productVersion=$productVersion" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# echo "productName=$productName" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "productDebName=$productDebName" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# 安装一些包 # libqt5*-dev
# sudo apt install wget tar dh-make debmake lintian cmake qtbase5-dev qt5-default libqt5x11extras5-dev libqt5svg5-dev libqt5*-dev
- name: AptInstallTool
id: AptInstallTool
if: startsWith(github.event.ref, 'refs/tags/')
shell: bash
run: |
sudo apt clean
sudo apt update
sudo apt install wget tar dh-make debmake lintian cmake devscripts qtbase5-dev qt5-default libqt5*-dev
# tag 打包 .deb,无动态库
- name: DebPackage
id: DebPackage
if: startsWith(github.event.ref, 'refs/tags/')
shell: bash
run: |
echo "-------------- debug 0 --------------"
pwd
echo $PATH
cd ..
cp -r ${{ env.targetName }} ${{ env.productDebName }}
tar -cvzf ${{ env.productDebName }}.tar.gz ${{ env.productDebName }}
echo "-------------- debug 1 --------------"
ls -al
cat >> ~/.bashrc <<EOF
DEBEMAIL="[email protected]"
DEBFULLNAME="XMuli"
export DEBEMAIL DEBFULLNAME
EOF
. ~/.bashrc
echo "-------------- debug 2 --------------"
cat ~/.bashrc
cd ${{ env.productDebName }}
pwd
ls -al
pwd
ls -al ..
# dh_make -f ../${{ env.productDebName }}.tar.gz -s -c mit -y
# https://askubuntu.com/questions/675154/dpkg-buildpackage-dpkg-source-no-upstream-tarball-found
# dpkg-buildpackage -us -uc
dpkg-buildpackage -b -rfakeroot -us -uc
echo "-------------- debug 3 --------------"
pwd
ls -al
pwd
ls -al ..
# tag上传Release
- name: uploadRelease
if: startsWith(github.event.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.upload_release }}
with:
draft: false
prerelease: false
files: |
../*.deb
tag: ${{ github.ref }}
overwrite: true
Loading

0 comments on commit ead8c9a

Please sign in to comment.