Skip to content

Commit 9db0bb0

Browse files
committed
Implemented matrix to CI
2 parents aa8fa59 + 0cb5188 commit 9db0bb0

File tree

1 file changed

+43
-63
lines changed

1 file changed

+43
-63
lines changed

.github/workflows/continuos-release.yml

Lines changed: 43 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -11,96 +11,76 @@ on:
1111
- "CMakeLists.txt"
1212

1313
jobs:
14-
build-windows:
15-
runs-on: windows-latest
14+
build:
15+
runs-on: ${{ matrix.os }}
1616
defaults:
1717
run:
18-
shell: msys2 {0}
18+
shell: ${{ matrix.shell }}
19+
strategy:
20+
matrix:
21+
os: [windows-latest, ubuntu-latest, macos-latest]
22+
include:
23+
- os: windows-latest
24+
os_name: windows
25+
architecture: x86_64
26+
shell: msys2 {0}
27+
msystem: MINGW64
28+
install: base-devel mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-hidapi make zip
29+
- os: ubuntu-latest
30+
os_name: linux
31+
architecture: x86_64
32+
shell: bash
33+
install: sudo apt-get -y install libhidapi-dev
34+
- os: macos-latest
35+
os_name: macos
36+
architecture: x86_64
37+
shell: bash
38+
install: brew install hidapi
1939
steps:
2040
- uses: actions/checkout@v4
41+
42+
- name: Setup environment
43+
if: matrix.os_name == 'windows'
44+
uses: msys2/setup-msys2@v2
2145
with:
22-
fetch-depth: 0
23-
- uses: msys2/setup-msys2@v2
24-
with:
25-
msystem: MINGW64
46+
msystem: ${{ matrix.msystem }}
2647
update: true
27-
install: git base-devel mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-hidapi make
48+
install: ${{ matrix.install }}
49+
50+
- name: Install dependencies
51+
if: matrix.os_name != 'windows'
52+
run: ${{ matrix.install }}
53+
2854
- name: Build
55+
if: matrix.os_name == 'windows'
2956
run: |
3057
mkdir build
3158
cd build
3259
cmake -G"MSYS Makefiles" ..
3360
make
34-
- name: Zip binaries folder
35-
run: |
36-
$zipFile = "headsetcontrol-windows-x86_64.zip"
37-
$folder = "build/headsetcontrol.exe"
38-
Compress-Archive -Path $folder -DestinationPath $zipFile
39-
shell: powershell
40-
- name: Upload build artifacts
41-
uses: actions/upload-artifact@v4
42-
with:
43-
name: headsetcontrol-windows-x86_64
44-
path: headsetcontrol-windows-x86_64.zip
4561
46-
build-macos:
47-
runs-on: macos-latest
48-
env:
49-
buildDir: "${{ github.workspace }}/build"
50-
steps:
51-
- uses: actions/checkout@v4
52-
with:
53-
fetch-depth: 0
54-
- uses: lukka/get-cmake@latest
55-
- name: Install Dependencies
56-
run: brew install hidapi
5762
- name: Run CMake with Ninja
63+
if: matrix.os_name != 'windows'
5864
uses: lukka/run-cmake@v3
5965
id: runcmake
6066
with:
6167
cmakeListsTxtPath: "${{ github.workspace }}/CMakeLists.txt"
6268
buildWithCMakeArgs: "-- -v"
63-
buildDirectory: ${{ env.buildDir }}
64-
- name: Zip build artifacts
65-
run: |
66-
cd ${{ env.buildDir }}
67-
zip -r headsetcontrol-macos-x86_64.zip headsetcontrol
68-
- name: Upload build artifacts
69-
uses: actions/upload-artifact@v4
70-
with:
71-
name: headsetcontrol-macos-x86_64
72-
path: ${{ env.buildDir }}/headsetcontrol-macos-x86_64.zip
69+
buildDirectory: ${{ github.workspace }}/build
7370

74-
build-linux:
75-
runs-on: ubuntu-latest
76-
env:
77-
buildDir: "${{ github.workspace }}/build"
78-
steps:
79-
- uses: actions/checkout@v4
80-
with:
81-
fetch-depth: 0
82-
- uses: lukka/get-cmake@latest
83-
- name: Install Dependencies
84-
run: sudo apt-get -y install libhidapi-dev
85-
- name: Run CMake with Ninja
86-
uses: lukka/run-cmake@v3
87-
id: runcmake
88-
with:
89-
cmakeListsTxtPath: "${{ github.workspace }}/CMakeLists.txt"
90-
buildWithCMakeArgs: "-- -v"
91-
buildDirectory: ${{ env.buildDir }}
9271
- name: Zip build artifacts
9372
run: |
94-
cd ${{ env.buildDir }}
95-
zip -r headsetcontrol-linux-x86_64.zip headsetcontrol
73+
cd build
74+
zip -r headsetcontrol-${{ matrix.os_name }}-${{ matrix.architecture }}.zip headsetcontrol
75+
9676
- name: Upload build artifacts
9777
uses: actions/upload-artifact@v4
9878
with:
99-
name: headsetcontrol-linux-x86_64
100-
path: ${{ env.buildDir }}/headsetcontrol-linux-x86_64.zip
79+
name: headsetcontrol-${{ matrix.os_name }}-${{ matrix.architecture }}
80+
path: build/headsetcontrol-${{ matrix.os_name }}-${{ matrix.architecture }}.zip
10181

10282
create-release:
103-
needs: [build-windows, build-macos, build-linux]
83+
needs: [build]
10484
runs-on: ubuntu-latest
10585
steps:
10686
- uses: actions/checkout@v4

0 commit comments

Comments
 (0)