Skip to content

Commit 66cb712

Browse files
Build with composite action
1 parent fda357e commit 66cb712

File tree

2 files changed

+70
-98
lines changed

2 files changed

+70
-98
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: 'Build Companion'
2+
inputs:
3+
os:
4+
description: 'OS / Architecture'
5+
required: true
6+
qt-version:
7+
description: 'Qt version'
8+
default: '6.9.0'
9+
qt-arch:
10+
description: 'Qt architecture'
11+
required: runner.os != 'Linux'
12+
sdl2-version:
13+
description: 'SDL2 version'
14+
default: '2.32.8'
15+
16+
runs:
17+
using: "composite"
18+
steps:
19+
20+
- name: Install Qt
21+
if: runner.os != 'Linux'
22+
uses: jdpurcell/install-qt-action@v5
23+
env:
24+
AQT_CONFIG: ${{ github.workspace }}/tools/aqt-settings.ini
25+
with:
26+
version: ${{ inputs.qt-version }}
27+
modules: 'qtmultimedia qtserialport'
28+
arch: ${{ inputs.qt-arch }}
29+
cache: true
30+
cache-key-prefix: 'install-qt-action-${{ inputs.qt-arch }}'
31+
32+
- name: Setup SDL2
33+
if: runner.os != 'Linux'
34+
id: setup-sdl2
35+
uses: libsdl-org/setup-sdl@v1
36+
with:
37+
version: ${{ env.SDL_VERSION }}
38+
build-type: "Release"
39+
40+
- name: Setup MSVC
41+
if: runner.os == 'Windows'
42+
uses: ilammy/msvc-dev-cmd@v1
43+
44+
- name: Build
45+
shell: bash
46+
env:
47+
CMAKE_BUILD_TYPE: 'Release'
48+
run: |
49+
mkdir output && \
50+
CMAKE_PREFIX_PATH="$QT_ROOT_DIR;$SDL2_ROOT" \
51+
tools/build-companion.sh "$(pwd)" "$(pwd)/output/"
52+
53+
- name: Compose release filename
54+
run: echo "artifact_name=edgetx-cpn-${{ inputs.os }}-${GITHUB_REF##*/}" >> $GITHUB_ENV
55+
shell: bash
56+
57+
- name: Archive production artifacts
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: "${{ env.artifact_name }}"
61+
path: ${{github.workspace}}/output
62+
retention-days: 15

.github/workflows/companion.yml

Lines changed: 8 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@ on:
2121

2222
workflow_dispatch:
2323

24-
env:
25-
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
26-
CMAKE_BUILD_TYPE: Release
27-
QT_VERSION: '6.9.0'
28-
SDL_VERSION: '2.32.8'
29-
3024
jobs:
3125
build-linux:
3226
name: Linux Companion
@@ -43,22 +37,9 @@ jobs:
4337
with:
4438
submodules: recursive
4539

46-
- name: Build
47-
working-directory: ${{github.workspace}}
48-
shell: bash
49-
run: |
50-
mkdir output && \
51-
tools/build-companion.sh "$(pwd)" "$(pwd)/output/"
52-
53-
- name: Compose release filename
54-
run: echo "artifact_name=edgetx-cpn-linux-${GITHUB_REF##*/}" >> $GITHUB_ENV
55-
56-
- name: Archive production artifacts
57-
uses: actions/upload-artifact@v4
40+
- uses: ./.github/actions/build_companion
5841
with:
59-
name: "${{ env.artifact_name }}"
60-
path: ${{github.workspace}}/output
61-
retention-days: 15
42+
os: 'linux'
6243

6344
build-macos:
6445
name: macOS Companion
@@ -67,58 +48,24 @@ jobs:
6748
env:
6849
CMAKE_OSX_ARCHITECTURES: 'x86_64'
6950
CMAKE_OSX_DEPLOYMENT_TARGET: '10.15'
70-
QT_ARCH: 'clang_64'
7151

7252
steps:
7353
- name: Check out the repo
7454
uses: actions/checkout@v4
7555
with:
7656
submodules: recursive
7757

78-
- name: Install Qt
79-
uses: jdpurcell/install-qt-action@v5
80-
env:
81-
AQT_CONFIG: ${{ github.workspace }}/tools/aqt-settings.ini
82-
with:
83-
version: ${{ env.QT_VERSION }}
84-
modules: 'qtmultimedia qtserialport'
85-
arch: ${{ env.QT_ARCH }}
86-
cache: true
87-
cache-key-prefix: 'install-qt-action-${{ env.QT_ARCH }}'
88-
89-
- name: Setup SDL2
90-
id: setup-sdl2
91-
uses: libsdl-org/setup-sdl@v1
58+
- uses: ./.github/actions/build_companion
9259
with:
93-
version: ${{ env.SDL_VERSION }}
94-
build-type: "Release"
95-
96-
- name: Install Python Dependencies
97-
run: python3 -m pip install clang jinja2 lz4 pillow pydantic
98-
99-
- name: Build
100-
run: |
101-
mkdir output && \
102-
CMAKE_PREFIX_PATH="$QT_ROOT_DIR;$SDL2_ROOT" \
103-
tools/build-companion.sh "$(pwd)" "$(pwd)/output/"
104-
105-
- name: Compose release filename
106-
run: echo "artifact_name=edgetx-cpn-osx-${GITHUB_REF##*/}" >> $GITHUB_ENV
107-
108-
- name: Archive production artifacts
109-
uses: actions/upload-artifact@v4
110-
with:
111-
name: "${{ env.artifact_name }}"
112-
path: ${{github.workspace}}/output
113-
retention-days: 15
60+
os: 'macos'
61+
qt-arch: 'clang_64'
11462

11563
build-win64:
11664
name: Windows Companion
11765
runs-on: windows-2022
11866

11967
env:
12068
CMAKE_GENERATOR: 'Ninja'
121-
QT_ARCH: 'win64_msvc2022_64'
12269
CXX: 'clang++'
12370
CC: 'clang'
12471

@@ -132,44 +79,7 @@ jobs:
13279
with:
13380
submodules: recursive
13481

135-
- name: Install Qt
136-
uses: jdpurcell/install-qt-action@v5
137-
env:
138-
AQT_CONFIG: ${{ github.workspace }}/tools/aqt-settings.ini
139-
with:
140-
version: ${{ env.QT_VERSION }}
141-
modules: 'qtmultimedia qtserialport'
142-
arch: ${{ env.QT_ARCH }}
143-
cache: true
144-
cache-key-prefix: 'install-qt-action-${{ env.QT_ARCH }}'
145-
146-
- name: Setup SDL2
147-
id: setup-sdl2
148-
uses: libsdl-org/setup-sdl@v1
149-
with:
150-
version: ${{ env.SDL_VERSION }}
151-
build-type: "Release"
152-
153-
- name: Install Python Dependencies
154-
run: |
155-
echo $PATH
156-
$Python3_ROOT_DIR/python3.exe -m pip install clang jinja2 lz4 pillow pydantic
157-
158-
- name: Setup MSVC
159-
uses: ilammy/msvc-dev-cmd@v1
160-
161-
- name: Build
162-
run: |
163-
mkdir output && \
164-
CMAKE_PREFIX_PATH="$QT_ROOT_DIR;$SDL2_ROOT" \
165-
tools/build-companion.sh "$(pwd)" "$(pwd)/output/"
166-
167-
- name: Compose release filename
168-
run: echo "artifact_name=edgetx-cpn-win64-${GITHUB_REF##*/}" >> $GITHUB_ENV
169-
170-
- name: Archive production artifacts
171-
uses: actions/upload-artifact@v4
82+
- uses: ./.github/actions/build_companion
17283
with:
173-
name: "${{ env.artifact_name }}"
174-
path: ${{github.workspace}}/output
175-
retention-days: 15
84+
os: 'win64'
85+
qt-arch: 'win64_msvc2022_64'

0 commit comments

Comments
 (0)