# Author: Kang Lin name: build_ubuntu on: workflow_call: outputs: name: description: "The artifact name" value: ${{ jobs.build_ubuntu.outputs.name }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} jobs: build_ubuntu: strategy: matrix: BUILD_TYPE: [Release, Debug] os: [ubuntu-24.04, ubuntu-24.04-arm, ubuntu-22.04-arm] # See: [About GitHub-hosted runners](https://docs.github.com/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners) # See: [Choosing the runner for a job](https://docs.github.com/actions/writing-workflows/choosing-where-your-workflow-runs/choosing-the-runner-for-a-job) # See: https://github.com/actions/runner-images/ runs-on: ${{matrix.os}} env: BUILD_DIR: ${{github.workspace}}/build SOURCE_DIR: ${{github.workspace}}/.cache/source TOOLS_DIR: ${{github.workspace}}/.cache/tools INSTALL_DIR: ${{github.workspace}}/.cache/install_${{matrix.os}}_${{matrix.BUILD_TYPE}} artifact_name: build_ubuntu SerialPortAssistant_VERSION: 0.5.33 # Map the job outputs to step outputs outputs: name: ${{ env.artifact_name }} steps: - name: Checkout Repository uses: actions/checkout@v3 with: submodules: recursive fetch-depth: 0 - name: Make directories run: | cmake -E make_directory ${{env.BUILD_DIR}} cmake -E make_directory ${{env.SOURCE_DIR}} cmake -E make_directory ${{env.TOOLS_DIR}} cmake -E make_directory ${{env.INSTALL_DIR}} - name: Install dependency libraries run: | sudo ./Script/build_depend.sh --apt_update --base --default \ --install ${{env.INSTALL_DIR}} \ --source ${{env.SOURCE_DIR}} \ --tools ${{env.TOOLS_DIR}} \ --build ${{env.BUILD_DIR}} if [ "ubuntu-22.04-arm" != ${{matrix.os}} ]; then sudo apt install -y -q qt6-5compat-dev fi - name: Cache installed uses: actions/cache@v3 id: cache-installed with: path: | ${{env.INSTALL_DIR}} key: install_ubuntu_${{matrix.os}}_${{matrix.BUILD_TYPE}} - name: git clone RabbitCommon working-directory: ${{env.SOURCE_DIR}} run: | git clone https://github.com/KangLin/RabbitCommon.git - name: build_debpackage.sh working-directory: ${{github.workspace}} env: RabbitCommon_ROOT: ${{env.SOURCE_DIR}}/RabbitCommon run: | ./Script/build_debpackage.sh - name: Update configure file working-directory: ${{github.workspace}} if: ${{ matrix.BUILD_TYPE == 'Release' }} run: | sudo Xvfb :97 -ac -screen 0 1200x900x24 & export DISPLAY=:97.0 export ARCH=`dpkg --print-architecture` export OS_NAME="ubuntu-`lsb_release -s -r`" cp ../serialportassistant_${{env.SerialPortAssistant_VERSION}}_${ARCH}.deb serialportassistant_${{env.SerialPortAssistant_VERSION}}_${OS_NAME}_${ARCH}.deb sudo apt install ./serialportassistant_${{env.SerialPortAssistant_VERSION}}_${OS_NAME}_${ARCH}.deb echo "test ......" ./Script/test_linux.sh echo "Update configure file ......" MD5=`md5sum serialportassistant_${{env.SerialPortAssistant_VERSION}}_${OS_NAME}_${ARCH}.deb | awk '{print $1}'` export QT_XCB_GL_INTEGRATION=none ulimit -c unlimited echo "# sudo sysctl -w kernel.core_pattern=core" sudo sysctl -w kernel.core_pattern=${{github.workspace}}/core /opt/SerialPortAssistant/bin/SerialPortAssistant \ -f "`pwd`/update_ubuntu_${OS_NAME}_${ARCH}.json" \ --foc 1 \ --md5 ${MD5} \ -m "${{env.SerialPortAssistant_VERSION}}" \ -p serialportassistant_${{env.SerialPortAssistant_VERSION}}_${OS_NAME}_${ARCH}.deb \ -u "https://github.com/KangLin/SerialPortAssistant/releases/download/v${{env.SerialPortAssistant_VERSION}}/serialportassistant_${{env.SerialPortAssistant_VERSION}}_${OS_NAME}_${ARCH}.deb;https://sourceforge.net/projects/SerialPortAssistant/v${{env.SerialPortAssistant_VERSION}}/serialportassistant_${{env.SerialPortAssistant_VERSION}}_${OS_NAME}_${ARCH}.deb?viasf=1" - name: Update version configure file if: ${{ matrix.BUILD_TYPE == 'Release' }} working-directory: ${{github.workspace}} run: | sudo Xvfb :98 -ac & export DISPLAY=:98.0 /opt/SerialPortAssistant/bin/SerialPortAssistant \ -f "${{github.workspace}}/version.json" \ --foc 0 \ --pv ${{env.SerialPortAssistant_VERSION}} - name: Update artifact if: ${{ matrix.BUILD_TYPE == 'Release' }} uses: actions/upload-artifact@v4 with: name: ${{ env.artifact_name }}_${{matrix.os}} path: | ${{github.workspace}}/serialportassistant_${{env.SerialPortAssistant_VERSION}}*.deb ${{github.workspace}}/update_*.json ${{github.workspace}}/version.json