|
| 1 | +name: KOS-Go Checks |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + paths: |
| 6 | + - 'packages/kos-go/kos_mobile/**' |
| 7 | + branches: |
| 8 | + - develop |
| 9 | + pull_request: |
| 10 | + branches: |
| 11 | + - develop |
| 12 | + |
| 13 | +jobs: |
| 14 | + build-go-linux: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + permissions: |
| 17 | + contents: write |
| 18 | + steps: |
| 19 | + - name: Checkout repository |
| 20 | + uses: actions/checkout@v4 |
| 21 | + with: |
| 22 | + submodules: recursive |
| 23 | + |
| 24 | + - name: Setup Go |
| 25 | + uses: actions/setup-go@v5 |
| 26 | + with: |
| 27 | + go-version: '1.21' |
| 28 | + |
| 29 | + - name: RustUp |
| 30 | + uses: klever-io/kos-rs/.github/actions/rustup@develop |
| 31 | + with: |
| 32 | + with_cache: true |
| 33 | + |
| 34 | + - name: Build Linux Go bindings |
| 35 | + run: make build-go |
| 36 | + |
| 37 | + - name: Copy .so to Go package |
| 38 | + run: | |
| 39 | + mkdir -p packages/kos-go/kos_mobile/lib/linux-amd64 |
| 40 | + cp target/release/libkos_mobile.so packages/kos-go/kos_mobile/lib/linux-amd64/ |
| 41 | +
|
| 42 | + - name: Commit and push changes |
| 43 | + if: github.event_name != 'push' || !contains(github.event.head_commit.message, '[skip ci]') |
| 44 | + uses: stefanzweifel/git-auto-commit-action@v4 |
| 45 | + with: |
| 46 | + commit_message: "Update Linux Go bindings library" |
| 47 | + file_pattern: "packages/kos-go/kos_mobile/lib/linux-amd64/libkos_mobile.so" |
| 48 | + |
| 49 | + - name: Run Go tests |
| 50 | + run: | |
| 51 | + cd packages/kos-go |
| 52 | + make test |
| 53 | +
|
| 54 | + build-go-linux-musl: |
| 55 | + runs-on: ubuntu-latest |
| 56 | + permissions: |
| 57 | + contents: write |
| 58 | + steps: |
| 59 | + - name: Checkout repository |
| 60 | + uses: actions/checkout@v4 |
| 61 | + with: |
| 62 | + submodules: recursive |
| 63 | + |
| 64 | + - name: Setup Go |
| 65 | + uses: actions/setup-go@v5 |
| 66 | + with: |
| 67 | + go-version: '1.21' |
| 68 | + |
| 69 | + - name: RustUp |
| 70 | + uses: klever-io/kos-rs/.github/actions/rustup@develop |
| 71 | + with: |
| 72 | + with_cache: true |
| 73 | + |
| 74 | + - name: Install musl tools |
| 75 | + run: sudo apt-get update && sudo apt-get install -y musl-tools |
| 76 | + |
| 77 | + - name: Build Linux musl Go bindings |
| 78 | + run: | |
| 79 | + rustup target add x86_64-unknown-linux-musl |
| 80 | + make build-go-musl |
| 81 | +
|
| 82 | + - name: Copy .so to Go package |
| 83 | + run: | |
| 84 | + mkdir -p packages/kos-go/kos_mobile/lib/linux-amd64 |
| 85 | + cp target/x86_64-unknown-linux-musl/release/libkos_mobile.so packages/kos-go/kos_mobile/lib/linux-musl-amd64/ |
| 86 | +
|
| 87 | + - name: Commit and push changes |
| 88 | + if: github.event_name != 'push' || !contains(github.event.head_commit.message, '[skip ci]') |
| 89 | + uses: stefanzweifel/git-auto-commit-action@v4 |
| 90 | + with: |
| 91 | + commit_message: "Update Linux musl Go bindings library" |
| 92 | + file_pattern: "packages/kos-go/kos_mobile/lib/linux-musl-amd64/libkos_mobile.so" |
| 93 | + |
| 94 | + - name: Run Go tests |
| 95 | + run: | |
| 96 | + cd packages/kos-go |
| 97 | + make test-linux-musl |
| 98 | +
|
| 99 | + build-go-mac: |
| 100 | + runs-on: [ "macos-14" ] |
| 101 | + permissions: |
| 102 | + contents: write |
| 103 | + steps: |
| 104 | + - name: Checkout repository |
| 105 | + uses: actions/checkout@v4 |
| 106 | + with: |
| 107 | + submodules: recursive |
| 108 | + |
| 109 | + - name: Setup Go |
| 110 | + uses: actions/setup-go@v5 |
| 111 | + with: |
| 112 | + go-version: '1.21' |
| 113 | + |
| 114 | + - name: Install Rust toolchain |
| 115 | + shell: bash |
| 116 | + run: | |
| 117 | + set -e |
| 118 | + rustup component add --toolchain stable rustfmt clippy |
| 119 | + rustup default stable |
| 120 | +
|
| 121 | + - name: Setup protobuf |
| 122 | + run: brew install protobuf |
| 123 | + |
| 124 | + - name: Build Mac Go bindings |
| 125 | + run: make build-go |
| 126 | + |
| 127 | + - name: Copy dylib to Go package |
| 128 | + run: | |
| 129 | + mkdir -p packages/kos-go/kos_mobile/lib/darwin-aarch64 |
| 130 | + cp target/release/libkos_mobile.dylib packages/kos-go/kos_mobile/lib/darwin-aarch64/ |
| 131 | +
|
| 132 | + - name: Commit and push changes |
| 133 | + if: github.event_name != 'push' || !contains(github.event.head_commit.message, '[skip ci]') |
| 134 | + uses: stefanzweifel/git-auto-commit-action@v4 |
| 135 | + with: |
| 136 | + commit_message: "Update macOS Go bindings library" |
| 137 | + file_pattern: "packages/kos-go/kos_mobile/lib/darwin-aarch64/libkos_mobile.dylib" |
| 138 | + |
| 139 | + - name: Run Go tests |
| 140 | + run: | |
| 141 | + cd packages/kos-go |
| 142 | + make test |
0 commit comments