Skip to content

优化

优化 #153

Workflow file for this run

# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
name: Build on Ubuntu
permissions:
contents: write
discussions: write
on:
push:
branches: [ develop, develop-linux, develop-ubuntu ]
tags:
- "v*.*.*"
- "v*.*.*-*"
paths-ignore:
- '**.md'
- 'changelog.txt'
- 'LEGAL'
- 'LICENSE'
- '.clang-*'
- '.gitignore'
- 'vcpkg.json'
- 'vcpkg-*.json'
- 'snap/**'
- 'docs/**'
- 'flatpak/**'
- 'src/base/platform/windows/**'
- 'src/base/platform/macos/**'
- '.github/**'
- '!.github/workflows/ubuntu.yml'
pull_request:
branches: [ develop, develop-linux, develop-ubuntu ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
fail-fast: false
matrix:
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
arch: [x86_64]
os: [ ubuntu-24.04 ]
build_type: [Release]
c_compiler: [clang]
cpp_compiler: [clang++]
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v3
with:
submodules: 'true'
- name: Pull submodules
run: |
git submodule update --remote --init
- name: Install system dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y libpcre2-dev libudev-dev libmtdev-dev libinput-dev libdrm-dev libgbm-dev \
libgtk-3-dev libkrb5-dev librange-v3-dev
# ssl sqlite
sudo apt-get install -y libssl-dev libcrypt-dev libsqlite3-dev
# x11
sudo apt-get install -y libxcb* libxkb* libfontconfig1-dev \
libfreetype6-dev libx11-dev libx11-xcb-dev \
libxext-dev libxfixes-dev libxi-dev libxrender-dev libxss-dev
# Multimedia
sudo apt-get install -y libasound2-dev libpulse-dev libopenal-dev libopenal-dev
# sqlite
sudo apt install -y libsqlite3-dev
# ffmpeg vpx qrencode
sudo apt install -y libvpx-dev libjpeg-dev libexif-dev libtiff-dev libpng16-16 libpng-dev libavcodec-dev libavdevice-dev libqrencode-dev
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: '5.15.2'
modules: 'qtwebengine'
- name: Install ok-gloox
run: |
git clone https://github.com/okstar-org/ok-gloox.git
cd ok-gloox
cmake -B out \
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} \
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
cmake --build out --config=${{ matrix.build_type }}
sudo cmake --install out
- name: Install ok-rtc
run: |
sudo apt install yasm libopenh264-dev libopus-dev libvpx-dev libpipewire-0.3-dev libspa-0.2-dev
git clone -b master https://github.com/okstar-org/ok-rtc.git
cd ok-rtc
git submodule update --init
cmake -B out \
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} \
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
cmake --build out --config=${{ matrix.build_type }}
sudo cmake --install out
- name: Set reusable strings
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DOK_CPACK=1
-S ${{ github.workspace }}
- name: Build
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
run: >
cmake --build ${{ steps.strings.outputs.build-output-dir }}
--config ${{ matrix.build_type }}
--target package
- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest --build-config ${{ matrix.build_type }}
- name: Upload to release
uses: softprops/action-gh-release@v1
if: ${{ startsWith(github.ref, 'refs/tags/') }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: |
${{ steps.strings.outputs.build-output-dir }}/ok-msg-desktop_${{matrix.os}}_${{ matrix.arch }}.deb