|
11 | 11 | - "CMakeLists.txt"
|
12 | 12 |
|
13 | 13 | jobs:
|
14 |
| - build-windows: |
15 |
| - runs-on: windows-latest |
| 14 | + build: |
| 15 | + runs-on: ${{ matrix.os }} |
16 | 16 | defaults:
|
17 | 17 | 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 |
19 | 39 | steps:
|
20 | 40 | - uses: actions/checkout@v4
|
| 41 | + |
| 42 | + - name: Setup environment |
| 43 | + if: matrix.os_name == 'windows' |
| 44 | + uses: msys2/setup-msys2@v2 |
21 | 45 | with:
|
22 |
| - fetch-depth: 0 |
23 |
| - - uses: msys2/setup-msys2@v2 |
24 |
| - with: |
25 |
| - msystem: MINGW64 |
| 46 | + msystem: ${{ matrix.msystem }} |
26 | 47 | 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 | + |
28 | 54 | - name: Build
|
| 55 | + if: matrix.os_name == 'windows' |
29 | 56 | run: |
|
30 | 57 | mkdir build
|
31 | 58 | cd build
|
32 | 59 | cmake -G"MSYS Makefiles" ..
|
33 | 60 | 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 |
45 | 61 |
|
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 |
57 | 62 | - name: Run CMake with Ninja
|
| 63 | + if: matrix.os_name != 'windows' |
58 | 64 | uses: lukka/run-cmake@v3
|
59 | 65 | id: runcmake
|
60 | 66 | with:
|
61 | 67 | cmakeListsTxtPath: "${{ github.workspace }}/CMakeLists.txt"
|
62 | 68 | 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 |
73 | 70 |
|
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 }} |
92 | 71 | - name: Zip build artifacts
|
93 | 72 | 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 | +
|
96 | 76 | - name: Upload build artifacts
|
97 | 77 | uses: actions/upload-artifact@v4
|
98 | 78 | 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 |
101 | 81 |
|
102 | 82 | create-release:
|
103 |
| - needs: [build-windows, build-macos, build-linux] |
| 83 | + needs: [build] |
104 | 84 | runs-on: ubuntu-latest
|
105 | 85 | steps:
|
106 | 86 | - uses: actions/checkout@v4
|
|
0 commit comments