|
| 1 | +name: SDK CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: ["**"] |
| 6 | + workflow_call: |
| 7 | + inputs: |
| 8 | + artifact_suffix: |
| 9 | + required: false |
| 10 | + type: string |
| 11 | + default: "" |
| 12 | + description: "Suffix to add to artifact names" |
| 13 | + upload_artifacts: |
| 14 | + required: false |
| 15 | + type: boolean |
| 16 | + default: false |
| 17 | + description: "Whether to upload SDK artifacts" |
| 18 | + |
| 19 | +permissions: |
| 20 | + contents: read |
| 21 | + |
| 22 | +jobs: |
| 23 | + sdk: |
| 24 | + name: Codegen and smoke builds |
| 25 | + runs-on: ubuntu-latest |
| 26 | + steps: |
| 27 | + - name: Checkout |
| 28 | + uses: actions/checkout@v4 |
| 29 | + |
| 30 | + - name: Set up Go |
| 31 | + uses: actions/setup-go@v5 |
| 32 | + with: |
| 33 | + go-version: stable |
| 34 | + cache: true |
| 35 | + cache-dependency-path: | |
| 36 | + viiper/go.sum |
| 37 | +
|
| 38 | + - name: Run code generation |
| 39 | + working-directory: viiper |
| 40 | + run: go run ./cmd/viiper codegen |
| 41 | + |
| 42 | + - name: Set up Node.js |
| 43 | + uses: actions/setup-node@v4 |
| 44 | + with: |
| 45 | + node-version: '24' |
| 46 | + cache: 'npm' |
| 47 | + cache-dependency-path: | |
| 48 | + clients/typescript/package-lock.json |
| 49 | + examples/typescript/package-lock.json |
| 50 | +
|
| 51 | + - name: Build TypeScript SDK |
| 52 | + working-directory: clients/typescript |
| 53 | + run: | |
| 54 | + npm install |
| 55 | + npm run build |
| 56 | + npm pack |
| 57 | +
|
| 58 | + - name: Build TypeScript examples (smoke) |
| 59 | + working-directory: examples/typescript |
| 60 | + run: | |
| 61 | + npm install |
| 62 | + npm run build |
| 63 | +
|
| 64 | + - name: Set up .NET SDK |
| 65 | + uses: actions/setup-dotnet@v4 |
| 66 | + with: |
| 67 | + dotnet-version: '8.0.x' |
| 68 | + |
| 69 | + - name: Pack C# SDK (smoke) |
| 70 | + run: dotnet pack clients/csharp/Viiper.Client/Viiper.Client.csproj -c Release -o artifacts/nuget |
| 71 | + |
| 72 | + - name: Build C# examples (smoke) |
| 73 | + run: | |
| 74 | + dotnet build examples/csharp/virtual_keyboard/VirtualKeyboard.csproj -c Release |
| 75 | + dotnet build examples/csharp/virtual_mouse/VirtualMouse.csproj -c Release |
| 76 | + dotnet build examples/csharp/virtual_x360_pad/VirtualX360Pad.csproj -c Release |
| 77 | +
|
| 78 | + - name: Set up CMake |
| 79 | + uses: jwlawson/actions-setup-cmake@v2 |
| 80 | + with: |
| 81 | + cmake-version: '3.26.x' |
| 82 | + |
| 83 | + - name: Build C SDK (smoke) |
| 84 | + run: | |
| 85 | + cmake -S clients/c -B clients/c/build |
| 86 | + cmake --build clients/c/build --config Release --parallel |
| 87 | +
|
| 88 | + - name: Rename TypeScript SDK tarball |
| 89 | + if: ${{ inputs.upload_artifacts }} |
| 90 | + working-directory: clients/typescript |
| 91 | + run: | |
| 92 | + for file in viiperclient-*.tgz; do |
| 93 | + if [ -f "$file" ]; then |
| 94 | + mv "$file" "viiperclient-typescript-sdk${{ inputs.artifact_suffix }}.tgz" |
| 95 | + fi |
| 96 | + done |
| 97 | +
|
| 98 | + - name: Upload TypeScript SDK tarball |
| 99 | + if: ${{ inputs.upload_artifacts }} |
| 100 | + uses: actions/upload-artifact@v4 |
| 101 | + with: |
| 102 | + name: typescript-sdk${{ inputs.artifact_suffix }} |
| 103 | + path: clients/typescript/viiperclient-typescript-sdk${{ inputs.artifact_suffix }}.tgz |
| 104 | + if-no-files-found: error |
| 105 | + |
| 106 | + - name: Upload C# SDK nupkg |
| 107 | + if: ${{ inputs.upload_artifacts }} |
| 108 | + uses: actions/upload-artifact@v4 |
| 109 | + with: |
| 110 | + name: csharp-sdk-nupkg${{ inputs.artifact_suffix }} |
| 111 | + path: artifacts/nuget/*.nupkg |
| 112 | + if-no-files-found: error |
| 113 | + |
| 114 | + - name: Archive C SDK source |
| 115 | + if: ${{ inputs.upload_artifacts }} |
| 116 | + run: tar -czf c-sdk-source${{ inputs.artifact_suffix }}.tar.gz -C clients/c . |
| 117 | + |
| 118 | + - name: Upload C SDK source |
| 119 | + if: ${{ inputs.upload_artifacts }} |
| 120 | + uses: actions/upload-artifact@v4 |
| 121 | + with: |
| 122 | + name: c-sdk-source${{ inputs.artifact_suffix }} |
| 123 | + path: c-sdk-source${{ inputs.artifact_suffix }}.tar.gz |
| 124 | + if-no-files-found: error |
0 commit comments