Skip to content

Add CI script for Windows MSVC build #55

Add CI script for Windows MSVC build

Add CI script for Windows MSVC build #55

name: Linux CI (Ubuntu, Multi Arch)
# Based on the workflow file of QGroundControl repo
on: [ workflow_dispatch, push ]
defaults:
run:
shell: bash
env:
SOURCE_DIR: ${{ github.workspace }}/SerialTest
QCP_VERSION: 2.1.1
ARTIFACT: SerialTest
jobs:
build:
runs-on: ubuntu-22.04
name: Build on ${{ matrix.distro }} ${{ matrix.arch }}
strategy:
matrix:
include:
- arch: armv7
distro: ubuntu22.04
- arch: aarch64
distro: ubuntu22.04
- arch: riscv64
distro: ubuntu22.04
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
path: SerialTest
- name: Download QCustomPlot
run: |
wget https://www.qcustomplot.com/release/${{ env.QCP_VERSION }}/QCustomPlot-source.tar.gz
tar -xzf QCustomPlot-source.tar.gz
cp qcustomplot-source/qcustomplot.* ${{ env.SOURCE_DIR }}/src
- name: Create build directory
run: |
mkdir ${{ runner.temp }}/shadow_build_dir
- name: Build
uses: uraimo/run-on-arch-action@v2.7.1
id: build
with:
arch: ${{ matrix.arch }}
distro: ${{ matrix.distro }}
# Create an artifacts directory
# setup: |
# mkdir -p "${PWD}/artifacts"
# Mount the artifacts directory as /artifacts in the container
dockerRunArgs: |
--volume "${{ env.SOURCE_DIR }}:/shadow_src_dir"
--volume "${{ runner.temp }}/shadow_build_dir:/shadow_build_dir"
# Pass some environment variables to the container
# env: | # YAML, but pipe character is necessary
# artifact_name: git-${{ matrix.distro }}_${{ matrix.arch }}
# The shell to run commands with in the container
shell: /bin/sh
# Install some dependencies in the container. This speeds up builds if
# you are also using githubToken. Any dependencies installed here will
# be part of the container image that gets cached, so subsequent
# builds don't have to re-install them. The image layer is cached
# publicly in your project's package repository, so it is vital that
# no secrets are present in the container state or logs.
install: |
apt-get update -q -y
apt-get install -q -y git build-essential
apt-get install -q -y qtbase5-dev qt5-qmake libqt5serialport5-dev qtconnectivity5-dev
# Produce a binary artifact and place it in the mounted volume
run: |
cd /shadow_build_dir
export QT_SELECT=qt5
qmake -r /shadow_src_dir/src/SerialTest.pro
make -j$((`nproc` + 1)) && make clean
- name: Save artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT }}_${{ matrix.arch }}
path: ${{ runner.temp }}/shadow_build_dir/**/${{ env.ARTIFACT }}