Merge branch 'NJUPT-SAST-Cpp:main' into main #29
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: Ubuntu | |
on: | |
push: | |
paths: | |
- "*.txt" | |
- "src/**" | |
- "!**.qml" | |
- "!**.md" | |
- "!**.cmake" | |
- ".github/**" | |
pull_request: | |
paths: | |
- "src/**" | |
- "!**.qml" | |
- "!**.md" | |
- "!**.cmake" | |
workflow_dispatch: | |
permissions: write-all | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
qt_ver: [6.6.1] | |
qt_arch: [gcc_64] | |
env: | |
targetName: sast-music | |
QT_MODULES: "qt5compat qthttpserver qtshadertools qtmultimedia" | |
steps: | |
- name: check out repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: install Qt | |
uses: jurplel/install-qt-action@v3 | |
with: | |
version: ${{ matrix.qt_ver }} | |
cache: ${{ steps.cache-qt.outputs.cache-hit }} | |
arch: ${{ matrix.qt_arch }} | |
modules: ${{ env.QT_MODULES }} | |
- name: setup Ninja | |
uses: ashutoshvarma/[email protected] | |
with: | |
version: "1.11.1" | |
- name: install GL library (Ubuntu) | |
run: sudo apt-get install -y libxcb-cursor0 libgl1-mesa-dev libxcb1-dev libgtk-3-dev libxkbcommon-x11-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-randr0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxcb-xinerama0-dev libxcb-sync-dev libxcb-render-util0-dev libxcb-shm0-dev | |
- name: ubuntu install libfuse2 | |
run: sudo apt install libfuse2 | |
- name: install Fcitx5 for Qt | |
run: | | |
sudo apt-get install -y extra-cmake-modules | |
git clone --depth 1 --branch 5.1.1 https://github.com/fcitx/fcitx5-qt | |
cmake -DBUILD_ONLY_PLUGIN=ON -DENABLE_QT4=OFF -DENABLE_QT5=OFF -DENABLE_QT6=ON -G Ninja -S ./fcitx5-qt -B ./fcitx5-qt-build -DCMAKE_PREFIX_PATH=${{ env.Qt6_DIR }} -DCMAKE_BUILD_TYPE=Release | |
cmake --build ./fcitx5-qt-build --parallel --config Release | |
cmake --install ./fcitx5-qt-build | |
- name: Configure CMake | |
run: cmake -G Ninja -S ${{ github.workspace }} -B ${{ github.workspace }}/build -DCMAKE_PREFIX_PATH=${{ env.Qt6_DIR }} -DCMAKE_BUILD_TYPE=Release | |
- name: Build | |
run: cmake --build ${{ github.workspace }}/build --config Release --parallel | |
- name: install Qt linux deploy | |
uses: miurahr/install-linuxdeploy-action@v1 | |
with: | |
plugins: qt appimage | |
- name: package | |
env: | |
EXTRA_QT_PLUGINS: qt5compat | |
run: | | |
export QML_SOURCES_PATHS=./ | |
echo "[Desktop Entry]" > sast-music-appimage.desktop | |
echo "Categories=X-Multimedia;" >> sast-music-appimage.desktop | |
echo "Icon=app_icon" >> sast-music-appimage.desktop | |
echo "Name=SAST Music" >> sast-music-appimage.desktop | |
echo "Type=Application" >> sast-music-appimage.desktop | |
echo "Exec=sast-music" >> sast-music-appimage.desktop | |
mv bin/release/sast_music bin/release/sast-music | |
linuxdeploy-x86_64.AppImage --plugin=qt --output=appimage --desktop-file=sast-music-appimage.desktop --icon-file=app_icon.svg --executable=bin/release/sast-music --appdir AppDir | |
mv SAST_Music-*.AppImage ${{ env.targetName }}_appimage_x86_64.AppImage | |
- name: Calculate SHA256 | |
run: | | |
touch sast-music.sha256 | |
sha256sum ${{ env.targetName }}_appimage_x86_64.AppImage > sast-music.sha256 | |
echo "SHA256 value is:" | |
cat sast-music.sha256 | |
- uses: actions/upload-artifact@v2 | |
if: startsWith(github.event.ref, 'refs/tags/') | |
with: | |
name: ${{ env.targetName }}_sha256 | |
path: sast-music.sha256 | |
- name: upload SHA256 | |
if: startsWith(github.event.ref, 'refs/tags/') | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: sast-music.sha256 | |
asset_name: sast-music-appimage.sha256 | |
tag: ${{ github.ref }} | |
overwrite: true | |
- uses: actions/upload-artifact@v2 | |
if: startsWith(github.event.ref, 'refs/tags/') | |
with: | |
name: ${{ env.targetName }}_appimage_x86_64.AppImage | |
path: ${{ env.targetName }}_appimage_x86_64.AppImage | |
- name: upload release | |
if: startsWith(github.event.ref, 'refs/tags/') | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ${{ env.targetName }}_appimage_x86_64.AppImage | |
asset_name: ${{ env.targetName }}_appimage_x86_64.AppImage | |
tag: ${{ github.ref }} | |
overwrite: true | |