|
1 | | ---- |
2 | | -#------------------------------------------------------------------------------- |
3 | | -# Workflow configuration |
4 | | -#------------------------------------------------------------------------------- |
| 1 | +name: LabStreamGate CI |
5 | 2 |
|
6 | | -name: "Binary build" |
7 | 3 | on: |
8 | | - release: |
9 | | - types: [published] |
10 | 4 | push: |
11 | | - paths: |
12 | | - - ".github/workflows/build.yaml" |
13 | | - - "Cargo.toml" |
14 | | - - "crates/**" |
15 | | - - "macos/**" |
16 | | - - "windows/**" |
17 | | - - "deployments/**" |
18 | | - - "freedesktop/**" |
19 | | - pull_request_review: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
20 | 8 | workflow_dispatch: |
21 | 9 |
|
| 10 | +permissions: |
| 11 | + contents: read |
| 12 | + |
22 | 13 | env: |
23 | 14 | CARGO_TERM_COLOR: always |
24 | 15 |
|
25 | | -#------------------------------------------------------------------------------- |
26 | | -# Workflow jobs |
27 | | -#------------------------------------------------------------------------------- |
28 | | - |
29 | 16 | jobs: |
30 | | - build-linux: |
31 | | - name: "Build on Linux" |
32 | | - runs-on: ubuntu-22.04 |
| 17 | + gateway: |
| 18 | + name: Gateway build and tests |
| 19 | + runs-on: ubuntu-24.04 |
33 | 20 | steps: |
34 | | - # Checkout repository (and submodules) |
35 | | - - name: Checkout repository (and submodules) |
36 | | - uses: actions/checkout@v7 |
37 | | - with: |
38 | | - fetch-depth: 0 |
39 | | - submodules: recursive |
40 | | - # Get current git tag version |
41 | | - - name: Get git version |
42 | | - id: git_tag_version |
43 | | - run: | |
44 | | - export BUILD_VERSION=$(git describe --tags --abbrev=0) |
45 | | - echo "Build at version $BUILD_VERSION" |
46 | | - echo "BUILD_VERSION=$BUILD_VERSION" >> $GITHUB_OUTPUT |
47 | | - # Install dependencies (from package manager) |
48 | | - - name: Install dependencies (from package manager) |
49 | | - run: | |
50 | | - sudo apt-get install libgl1-mesa-dev libxcb1-dev libxkbcommon-x11-dev libx11-xcb-dev libxcb-cursor0 libzstd-dev fuse libfuse-dev libwayland-dev -y; |
51 | | - sudo apt-get install cmake ninja-build pkgconf libtool fish -y; |
52 | | - sudo apt-get install musl-tools musl-dev -y; |
53 | | - sudo apt-get install appstream -y; |
54 | | - # Build application |
55 | | - - name: Build application |
56 | | - run: | |
57 | | - rustup update stable && rustup default stable; |
58 | | - cargo build --release --bins; |
59 | | - - name: Build cli for musl |
60 | | - run: | |
61 | | - rustup target add x86_64-unknown-linux-musl; |
62 | | - cargo build --release -p wsrx --target x86_64-unknown-linux-musl; |
63 | | - # Deploy Glibc application |
64 | | - - name: Compress Glibc Binaries |
65 | | - run: tar --transform='s!.*/!!' -czvf wsrx-cli-linux-gnu-x86_64.tar.gz target/release/wsrx |
66 | | - # Deploy musl application |
67 | | - - name: Compress musl Binaries |
68 | | - run: tar --transform='s!.*/!!' -czvf wsrx-cli-linux-musl-x86_64.tar.gz target/x86_64-unknown-linux-musl/release/wsrx |
69 | | - # Build AppImage |
70 | | - - name: Build AppImage |
71 | | - run: | |
72 | | - ./deployments/appimage.fish |
73 | | - # Move files |
74 | | - - name: move files |
75 | | - run: | |
76 | | - mv wsrx-cli-linux-gnu-x86_64.tar.gz wsrx-cli-${{steps.git_tag_version.outputs.BUILD_VERSION}}-linux-gnu-x86_64.tar.gz |
77 | | - mv wsrx-cli-linux-musl-x86_64.tar.gz wsrx-cli-${{steps.git_tag_version.outputs.BUILD_VERSION}}-linux-musl-x86_64.tar.gz |
78 | | - mv WebSocketReflectorX-x86_64.AppImage WebSocketReflectorX-${{steps.git_tag_version.outputs.BUILD_VERSION}}-linux-gnu-x86_64.AppImage |
79 | | - # Upload Glibc cli package |
80 | | - - name: Upload Glibc cli package |
81 | | - uses: actions/upload-artifact@v7 |
82 | | - with: |
83 | | - name: wsrx-cli-${{steps.git_tag_version.outputs.BUILD_VERSION}}-linux-gnu-x86_64.tar.gz |
84 | | - path: wsrx-cli-${{steps.git_tag_version.outputs.BUILD_VERSION}}-linux-gnu-x86_64.tar.gz |
85 | | - # Upload musl cli package |
86 | | - - name: Upload musl cli package |
87 | | - uses: actions/upload-artifact@v7 |
88 | | - with: |
89 | | - name: wsrx-cli-${{steps.git_tag_version.outputs.BUILD_VERSION}}-linux-musl-x86_64.tar.gz |
90 | | - path: wsrx-cli-${{steps.git_tag_version.outputs.BUILD_VERSION}}-linux-musl-x86_64.tar.gz |
91 | | - # Upload AppImage |
92 | | - - name: Upload AppImage |
93 | | - uses: actions/upload-artifact@v7 |
94 | | - with: |
95 | | - name: WebSocketReflectorX-${{steps.git_tag_version.outputs.BUILD_VERSION}}-linux-gnu-x86_64.AppImage |
96 | | - path: WebSocketReflectorX-${{steps.git_tag_version.outputs.BUILD_VERSION}}-linux-gnu-x86_64.AppImage |
97 | | - # Upload to github release |
98 | | - - name: Release |
99 | | - uses: softprops/action-gh-release@v3 |
100 | | - if: startsWith(github.ref, 'refs/tags/') |
101 | | - with: |
102 | | - files: | |
103 | | - wsrx-cli-${{steps.git_tag_version.outputs.BUILD_VERSION}}-linux-musl-x86_64.tar.gz |
104 | | - wsrx-cli-${{steps.git_tag_version.outputs.BUILD_VERSION}}-linux-gnu-x86_64.tar.gz |
105 | | - WebSocketReflectorX-${{steps.git_tag_version.outputs.BUILD_VERSION}}-linux-gnu-x86_64.AppImage |
106 | | - build-windows: |
107 | | - name: "Build on Windows" |
108 | | - runs-on: windows-2022 |
109 | | - steps: |
110 | | - # Checkout repository (and submodules) |
111 | | - - name: Checkout repository (and submodules) |
112 | | - uses: actions/checkout@v7 |
113 | | - with: |
114 | | - fetch-depth: 0 |
115 | | - submodules: recursive |
116 | | - # Get current git tag version |
117 | | - - name: Get git version |
118 | | - id: git_tag_version |
119 | | - run: | |
120 | | - echo BUILD_VERSION=$(git describe --tags --abbrev=0) | Out-File -FilePath $env:GITHUB_OUTPUT -Append |
121 | | - - name: Install NASM for aws-lc-rs on Windows |
122 | | - uses: ilammy/setup-nasm@v1 |
123 | | - - name: Install ninja-build tool for aws-lc-fips-sys on Windows |
124 | | - uses: seanmiddleditch/gha-setup-ninja@v6 |
125 | | - # Build application |
126 | | - - name: Build application |
127 | | - run: | |
128 | | - rustup update stable && rustup default stable; |
129 | | - cargo build --release --bins; |
130 | | - # Compress cli binaries |
131 | | - - name: Compress CLI Binaries |
132 | | - run: 7z a wsrx-cli-windows-msvc-x86_64.zip target/release/wsrx.exe |
133 | | - # Deploy application |
134 | | - - name: Deploy application |
135 | | - run: sh deployments/nsis.sh |
136 | | - # Move files |
137 | | - - name: move files |
138 | | - run: | |
139 | | - mv wsrx-cli-windows-msvc-x86_64.zip wsrx-cli-${{steps.git_tag_version.outputs.BUILD_VERSION}}-windows-msvc-x86_64.zip |
140 | | - mv WebSocketReflectorX-installer-windows-msvc-x86_64.exe WebSocketReflectorX-${{steps.git_tag_version.outputs.BUILD_VERSION}}-installer-windows-msvc-x86_64.exe |
141 | | - mv WebSocketReflectorX-portable-windows-msvc-x86_64.zip WebSocketReflectorX-${{steps.git_tag_version.outputs.BUILD_VERSION}}-portable-windows-msvc-x86_64.zip |
142 | | - # Upload application ZIP |
143 | | - - name: Upload application ZIP |
144 | | - uses: actions/upload-artifact@v7 |
145 | | - with: |
146 | | - name: wsrx-cli-${{steps.git_tag_version.outputs.BUILD_VERSION}}-windows-msvc-x86_64.zip |
147 | | - path: wsrx-cli-${{steps.git_tag_version.outputs.BUILD_VERSION}}-windows-msvc-x86_64.zip |
148 | | - # Upload NSIS installer |
149 | | - - name: Upload NSIS installer |
150 | | - uses: actions/upload-artifact@v7 |
151 | | - with: |
152 | | - name: WebSocketReflectorX-${{steps.git_tag_version.outputs.BUILD_VERSION}}-installer-windows-msvc-x86_64.exe |
153 | | - path: WebSocketReflectorX-${{steps.git_tag_version.outputs.BUILD_VERSION}}-installer-windows-msvc-x86_64.exe |
154 | | - # Upload portable package |
155 | | - - name: Upload Portable package |
156 | | - uses: actions/upload-artifact@v7 |
157 | | - with: |
158 | | - name: WebSocketReflectorX-${{steps.git_tag_version.outputs.BUILD_VERSION}}-portable-windows-msvc-x86_64.zip |
159 | | - path: WebSocketReflectorX-${{steps.git_tag_version.outputs.BUILD_VERSION}}-portable-windows-msvc-x86_64.zip |
160 | | - # Upload to github release |
161 | | - - name: Release |
162 | | - uses: softprops/action-gh-release@v3 |
163 | | - if: startsWith(github.ref, 'refs/tags/') |
| 21 | + - name: Checkout |
| 22 | + uses: actions/checkout@v4 |
| 23 | + |
| 24 | + - name: Install Rust |
| 25 | + uses: dtolnay/rust-toolchain@stable |
164 | 26 | with: |
165 | | - files: | |
166 | | - wsrx-cli-${{steps.git_tag_version.outputs.BUILD_VERSION}}-windows-msvc-x86_64.zip |
167 | | - WebSocketReflectorX-${{steps.git_tag_version.outputs.BUILD_VERSION}}-installer-windows-msvc-x86_64.exe |
168 | | - WebSocketReflectorX-${{steps.git_tag_version.outputs.BUILD_VERSION}}-portable-windows-msvc-x86_64.zip |
169 | | - build-mac: |
170 | | - name: "Build on MacOS" |
171 | | - runs-on: macos-latest |
| 27 | + components: rustfmt, clippy |
| 28 | + |
| 29 | + - name: Cache Rust dependencies |
| 30 | + uses: Swatinem/rust-cache@v2 |
| 31 | + |
| 32 | + - name: Check formatting |
| 33 | + run: cargo fmt --all -- --check |
| 34 | + |
| 35 | + - name: Check gateway |
| 36 | + run: cargo check --locked -p wsrx --bin labstreamgate |
| 37 | + |
| 38 | + - name: Test transport library |
| 39 | + run: cargo test --locked -p wsrx --lib |
| 40 | + |
| 41 | + - name: Lint gateway |
| 42 | + run: cargo clippy --locked -p wsrx --bin labstreamgate -- -D warnings |
| 43 | + |
| 44 | + container: |
| 45 | + name: Container image |
| 46 | + runs-on: ubuntu-24.04 |
| 47 | + needs: gateway |
172 | 48 | steps: |
173 | | - # Checkout repository (and submodules) |
174 | | - - name: Checkout repository (and submodules) |
175 | | - uses: actions/checkout@v7 |
176 | | - with: |
177 | | - fetch-depth: 0 |
178 | | - submodules: recursive |
179 | | - # Get current git tag version |
180 | | - - name: Get git version |
181 | | - id: git_tag_version |
182 | | - run: | |
183 | | - export BUILD_VERSION=$(git describe --tags --abbrev=0) |
184 | | - echo "Build at version $BUILD_VERSION" |
185 | | - echo "BUILD_VERSION=$BUILD_VERSION" >> $GITHUB_OUTPUT |
186 | | - # Build CLI binaries |
187 | | - - name: Build CLI binaries |
188 | | - run: | |
189 | | - rustup update stable && rustup default stable; |
190 | | - cargo install cargo-bundle; |
191 | | - cargo build --release --bins; |
192 | | - # Build CLI binaries for x86_64 |
193 | | - - name: Build CLI binaries for x86_64 |
194 | | - run: | |
195 | | - rustup target add x86_64-apple-darwin; |
196 | | - cargo build --release --bins --target x86_64-apple-darwin; |
197 | | - # Compress aarch64 binaries |
198 | | - - name: Compress Binaries for aarch64 |
199 | | - run: zip -r -y -X wsrx-cli-macos-aarch64.zip target/release/wsrx |
200 | | - # Compress x86_64 binaries |
201 | | - - name: Compress Binaries for x86_64 |
202 | | - run: zip -r -y -X wsrx-cli-macos-x86_64.zip target/x86_64-apple-darwin/release/wsrx |
203 | | - # Build OSX DMG app |
204 | | - - name: Build DMG |
205 | | - run: | |
206 | | - sh deployments/macos.sh |
207 | | - # Move files |
208 | | - - name: move files |
209 | | - run: | |
210 | | - mv WebSocketReflectorX.dmg WebSocketReflectorX-${{steps.git_tag_version.outputs.BUILD_VERSION}}-macos-aarch64.dmg |
211 | | - mv WebSocketReflectorX.app.zip WebSocketReflectorX-${{steps.git_tag_version.outputs.BUILD_VERSION}}-macos-aarch64.app.zip |
212 | | - mv wsrx-cli-macos-aarch64.zip wsrx-cli-${{steps.git_tag_version.outputs.BUILD_VERSION}}-macos-aarch64.zip |
213 | | - mv wsrx-cli-macos-x86_64.zip wsrx-cli-${{steps.git_tag_version.outputs.BUILD_VERSION}}-macos-x86_64.zip |
214 | | - # Upload cli ZIP for aarch64 |
215 | | - - name: Upload cli ZIP for aarch64 |
216 | | - uses: actions/upload-artifact@v7 |
217 | | - with: |
218 | | - name: wsrx-cli-${{steps.git_tag_version.outputs.BUILD_VERSION}}-macos-aarch64.zip |
219 | | - path: wsrx-cli-${{steps.git_tag_version.outputs.BUILD_VERSION}}-macos-aarch64.zip |
220 | | - # Upload cli ZIP for aarch64 |
221 | | - - name: Upload cli ZIP for x86_64 |
222 | | - uses: actions/upload-artifact@v7 |
223 | | - with: |
224 | | - name: wsrx-cli-${{steps.git_tag_version.outputs.BUILD_VERSION}}-macos-x86_64.zip |
225 | | - path: wsrx-cli-${{steps.git_tag_version.outputs.BUILD_VERSION}}-macos-x86_64.zip |
226 | | - # Upload application ZIP for aarch64 |
227 | | - - name: Upload application ZIP for x86_64 |
228 | | - uses: actions/upload-artifact@v7 |
229 | | - with: |
230 | | - name: WebSocketReflectorX-${{steps.git_tag_version.outputs.BUILD_VERSION}}-macos-aarch64.app.zip |
231 | | - path: WebSocketReflectorX-${{steps.git_tag_version.outputs.BUILD_VERSION}}-macos-aarch64.app.zip |
232 | | - # Upload application DMG for aarch64 |
233 | | - - name: Upload application DMG for x86_64 |
234 | | - uses: actions/upload-artifact@v7 |
235 | | - with: |
236 | | - name: WebSocketReflectorX-${{steps.git_tag_version.outputs.BUILD_VERSION}}-macos-aarch64.dmg |
237 | | - path: WebSocketReflectorX-${{steps.git_tag_version.outputs.BUILD_VERSION}}-macos-aarch64.dmg |
238 | | - # Upload to github release |
239 | | - - name: Release |
240 | | - uses: softprops/action-gh-release@v3 |
241 | | - if: startsWith(github.ref, 'refs/tags/') |
242 | | - with: |
243 | | - files: | |
244 | | - wsrx-cli-${{steps.git_tag_version.outputs.BUILD_VERSION}}-macos-aarch64.zip |
245 | | - wsrx-cli-${{steps.git_tag_version.outputs.BUILD_VERSION}}-macos-x86_64.zip |
246 | | - WebSocketReflectorX-${{steps.git_tag_version.outputs.BUILD_VERSION}}-macos-aarch64.app.zip |
247 | | - WebSocketReflectorX-${{steps.git_tag_version.outputs.BUILD_VERSION}}-macos-aarch64.dmg |
| 49 | + - name: Checkout |
| 50 | + uses: actions/checkout@v4 |
| 51 | + |
| 52 | + - name: Build image |
| 53 | + run: docker build --tag labstreamgate:ci . |
0 commit comments