FluentUI/.github/workflows/ubuntu.yml

77 lines
2.6 KiB
YAML
Raw Normal View History

2023-03-08 00:12:02 +08:00
name: Ubuntu
2023-03-08 15:33:48 +08:00
# Qt官方没有linux平台的x86包
2023-03-08 00:12:02 +08:00
on:
2023-03-08 15:22:43 +08:00
workflow_dispatch:
2023-03-08 00:12:02 +08:00
push:
paths:
- '*.pro'
- 'src/**'
- '.github/workflows/ubuntu.yml'
pull_request:
paths:
- '*.pro'
- 'src/**'
- '.github/workflows/ubuntu.yml'
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
2023-03-28 21:56:36 +08:00
os: [ubuntu-20.04]
2023-03-30 21:52:55 +08:00
qt_ver: [6.4.3]
2023-03-08 00:12:02 +08:00
qt_arch: [gcc_64]
2023-03-08 15:22:43 +08:00
env:
targetName: example
2023-03-08 00:12:02 +08:00
steps:
2023-04-02 23:36:23 +08:00
- name: '⚙️ Cache Qt'
id: cache-qt
uses: actions/cache@v3
with:
path: ${{ runner.workspace }}/Qt
key: ${{runner.os}}-qtcachedir-${{ matrix.qt_ver }}
2023-03-08 00:12:02 +08:00
- name: Install Qt
2023-03-30 22:18:42 +08:00
uses: jurplel/install-qt-action@v3
2023-03-08 00:12:02 +08:00
with:
version: ${{ matrix.qt_ver }}
2023-04-02 23:36:23 +08:00
cache: ${{steps.cache-qt.outputs.cache-hit}}
2023-03-30 22:18:42 +08:00
arch: ${{ matrix.qt_arch }}
2023-03-30 23:25:48 +08:00
modules: 'qt5compat qtmultimedia qtshadertools qtimageformats'
2023-03-08 00:12:02 +08:00
- name: ubuntu install GL library
2023-04-08 21:23:03 +08:00
run: sudo apt-get install -y libglew-dev libglfw3-dev
2023-03-08 00:12:02 +08:00
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: build ubuntu
run: |
qmake
2023-03-08 15:17:31 +08:00
make
- name: install QT linux deploy
uses: miurahr/install-linuxdeploy-action@v1
with:
plugins: qt appimage
2023-04-02 23:36:23 +08:00
- name: Check if svg file exists
run: if [ ! -f "${targetName}.svg" ]; then echo "File not found, creating..."; touch ${targetName}.svg; fi
2023-03-08 15:17:31 +08:00
# 打包
- name: package
run: |
# make sure Qt plugin finds QML sources so it can deploy the imported files
2023-03-25 13:35:21 +08:00
export QML_SOURCES_PATHS=src
2023-03-08 15:17:31 +08:00
# 拷贝依赖
2023-03-25 12:21:00 +08:00
linuxdeploy-x86_64.AppImage --plugin=qt --output=appimage --create-desktop-file --icon-file=${targetName}.svg --executable=bin/release/${targetName} --appdir bin/release/
2023-03-08 15:17:31 +08:00
mv ${{ env.targetName }}-*.AppImage ${{ env.targetName }}.AppImage
# 上传artifacts
- uses: actions/upload-artifact@v2
with:
2023-03-08 15:56:53 +08:00
name: ${{ env.targetName }}_${{ matrix.os }}_${{matrix.qt_ver}}
2023-03-08 15:17:31 +08:00
path: ${{ env.targetName }}.AppImage
# tag 上传Release
- name: uploadRelease
if: startsWith(github.event.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.targetName }}.AppImage
asset_name: ${{ env.targetName }}_${{ github.ref_name }}_${{ matrix.os }}_Qt${{ matrix.qt_ver }}.AppImage
2023-03-08 15:17:31 +08:00
tag: ${{ github.ref }}
overwrite: true