-
Notifications
You must be signed in to change notification settings - Fork 47
184 lines (171 loc) · 7.13 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
on:
push:
branches: '**'
tags-ignore: '**'
pull_request:
release:
types: [published]
name: ci
env:
RELEASE: ${{ github.event_name == 'release' && '--release' || '' }}
jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- run: sudo apt-get update && sudo apt-get install libgtk-3-dev libhidapi-dev libudev-dev
- uses: actions/checkout@v2
- run: rustup component add rustfmt
- run: cargo test --all
- run: cargo fmt -- --check
linux-x86_64:
runs-on: ubuntu-20.04
steps:
- run: sudo apt-get update && sudo apt-get install cargo libgtk-3-dev libhidapi-dev libudev-dev patchelf
- uses: actions/checkout@v2
- run: cd linux && ./build.py $RELEASE
- uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: keyboard-configurator-linux-x86_64-${{ github.sha }}
path: linux/keyboard-configurator-x86_64.AppImage
linux-x86_64-test:
runs-on: ubuntu-latest
needs: linux-x86_64
steps:
- run: sudo apt-get install xvfb libfuse2
- uses: actions/download-artifact@v4
with:
name: keyboard-configurator-linux-x86_64-${{ github.sha }}
- run: chmod +x keyboard-configurator-x86_64.AppImage
- run: xvfb-run ./keyboard-configurator-x86_64.AppImage --help-gtk
windows-mingw32:
runs-on: windows-latest
steps:
- uses: msys2/setup-msys2@v2
with:
msystem: MINGW32
install: mingw-w64-i686-gtk3 mingw-w64-i686-rust mingw-w64-i686-toolchain mingw-w64-i686-ntldd mingw-w64-x86_64-imagemagick
- uses: actions/checkout@v2
- name: Build and package
shell: msys2 {0}
env:
SSL_COM_USERNAME: ${{ secrets.SSL_COM_USERNAME }}
SSL_COM_PASSWORD: ${{ secrets.SSL_COM_PASSWORD }}
SSL_COM_CREDENTIAL_ID: ${{ secrets.SSL_COM_CREDENTIAL_ID }}
SSL_COM_TOTP_SECRET: ${{ secrets.SSL_COM_TOTP_SECRET }}
MSYS2_ENV_CONV_EXCL: SSL_COM_TOTP_SECRET
SIGN: --sign
run: cd windows && python build.py $RELEASE $SIGN
- uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: keyboard-configurator-mingw32-${{ github.sha }}
path: windows/keyboard-configurator.msi
windows-mingw32-test:
runs-on: windows-latest
needs: windows-mingw32
steps:
- uses: actions/download-artifact@v4
with:
name: keyboard-configurator-mingw32-${{ github.sha }}
- run: msiexec /i keyboard-configurator.msi /qb
- run: Start-Sleep 10
- run: '& "C:\Program Files (x86)\System76\Keyboard Configurator\system76-keyboard-configurator.exe" --help-gtk'
macos:
runs-on: macos-13
steps:
- run: brew install gtk+3 imagemagick librsvg adwaita-icon-theme
- run: npm install -g appdmg
- run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- uses: actions/checkout@v2
- env:
AC_PASSWORD: ${{ github.event_name == 'release' && secrets.AC_PASSWORD || '' }}
AC_USERNAME: ${{ github.event_name == 'release' && secrets.AC_USERNAME || '' }}
MACOS_CERTIFICATE: ${{ github.event_name == 'release' && secrets.MACOS_CERTIFICATE || '' }}
MACOS_SCRIPT: ${{ github.event_name == 'release' && 'bash ./signing.sh' || 'python3 ./build.py' }}
run: cd macos && $MACOS_SCRIPT $RELEASE
- uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: keyboard-configurator-macos-${{ github.sha }}
path: macos/keyboard-configurator.dmg
macos-test:
runs-on: macos-13
needs: macos
steps:
- uses: actions/download-artifact@v4
with:
name: keyboard-configurator-macos-${{ github.sha }}
- run: mkdir mnt && hdiutil attach keyboard-configurator.dmg -mountpoint $PWD/mnt
- run: '"./mnt/System76 Keyboard Configurator.app/Contents/MacOS/keyboard-configurator" --help-gtk'
- run: 'open "mnt/System76 Keyboard Configurator.app" --args --help-gtk'
# `macos-14` runner uses Apple Silicon
macos-arm64:
runs-on: macos-14
steps:
- run: brew install gtk+3 imagemagick librsvg adwaita-icon-theme
- run: npm install -g appdmg
- run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- uses: actions/checkout@v2
- env:
AC_PASSWORD: ${{ github.event_name == 'release' && secrets.AC_PASSWORD || '' }}
AC_USERNAME: ${{ github.event_name == 'release' && secrets.AC_USERNAME || '' }}
MACOS_CERTIFICATE: ${{ github.event_name == 'release' && secrets.MACOS_CERTIFICATE || '' }}
MACOS_SCRIPT: ${{ github.event_name == 'release' && 'bash ./signing.sh' || 'python3 ./build.py' }}
run: cd macos && $MACOS_SCRIPT $RELEASE
- run: mv macos/keyboard-configurator.dmg macos/keyboard-configurator-arm64.dmg
- uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: keyboard-configurator-macos-arm64-${{ github.sha }}
path: macos/keyboard-configurator-arm64.dmg
macos-arm64-test:
runs-on: macos-14
needs: macos-arm64
steps:
- uses: actions/download-artifact@v4
with:
name: keyboard-configurator-macos-arm64-${{ github.sha }}
- run: mkdir mnt && hdiutil attach keyboard-configurator-arm64.dmg -mountpoint $PWD/mnt
- run: '"./mnt/System76 Keyboard Configurator.app/Contents/MacOS/keyboard-configurator" --help-gtk'
- run: 'open "mnt/System76 Keyboard Configurator.app" --args --help-gtk'
upload-to-release:
if: github.event_name == 'release'
runs-on: ubuntu-latest
needs: [linux-x86_64, windows-mingw32, macos, macos-arm64]
steps:
- uses: actions/checkout@v2
- run: echo VERSION=$(./.github/workflows/version.py) > $GITHUB_ENV
- uses: actions/download-artifact@v4
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: keyboard-configurator-linux-x86_64-${{ github.sha }}/keyboard-configurator-x86_64.AppImage
asset_name: keyboard-configurator-${{ env.VERSION }}-x86_64.AppImage
asset_content_type: application/vnd.appimage
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: keyboard-configurator-mingw32-${{ github.sha }}/keyboard-configurator.msi
asset_name: keyboard-configurator-${{ env.VERSION }}.msi
asset_content_type: application/x-msi
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: keyboard-configurator-macos-${{ github.sha }}/keyboard-configurator.dmg
asset_name: keyboard-configurator-${{ env.VERSION }}.dmg
asset_content_type: application/x-apple-diskimage
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: keyboard-configurator-macos-arm64-${{ github.sha }}/keyboard-configurator-arm64.dmg
asset_name: keyboard-configurator-arm64-${{ env.VERSION }}.dmg
asset_content_type: application/x-apple-diskimage