|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+name: build-test
|
|
|
2
|
+
|
|
|
3
|
+# ------------- NOTE
|
|
|
4
|
+# please setup some secrets before running this workflow:
|
|
|
5
|
+# DOCKER_IMAGE should be the target image name on docker hub (e.g. "rustdesk/rustdesk-server-s6" )
|
|
|
6
|
+# DOCKER_IMAGE_CLASSIC should be the target image name on docker hub for the old build (e.g. "rustdesk/rustdesk-server" )
|
|
|
7
|
+# DOCKER_USERNAME is the username you normally use to login at https://hub.docker.com/
|
|
|
8
|
+# DOCKER_PASSWORD is a token you should create under "account settings / security" with read/write access
|
|
|
9
|
+
|
|
|
10
|
+on:
|
|
|
11
|
+ workflow_dispatch:
|
|
|
12
|
+ push:
|
|
|
13
|
+ tags:
|
|
|
14
|
+ - 'test.*'
|
|
|
15
|
+
|
|
|
16
|
+env:
|
|
|
17
|
+ CARGO_TERM_COLOR: always
|
|
|
18
|
+ LATEST_TAG: latest
|
|
|
19
|
+
|
|
|
20
|
+jobs:
|
|
|
21
|
+
|
|
|
22
|
+ # binary build
|
|
|
23
|
+ build:
|
|
|
24
|
+
|
|
|
25
|
+ name: Build - ${{ matrix.job.name }}
|
|
|
26
|
+ runs-on: ubuntu-24.04
|
|
|
27
|
+ strategy:
|
|
|
28
|
+ fail-fast: false
|
|
|
29
|
+ matrix:
|
|
|
30
|
+ job:
|
|
|
31
|
+ - { name: "amd64", target: "x86_64-unknown-linux-musl" }
|
|
|
32
|
+ - { name: "arm64v8", target: "aarch64-unknown-linux-musl" }
|
|
|
33
|
+ - { name: "armv7", target: "armv7-unknown-linux-musleabihf" }
|
|
|
34
|
+ - { name: "i386", target: "i686-unknown-linux-musl" }
|
|
|
35
|
+ #- { name: "amd64fb", target: "x86_64-unknown-freebsd" }
|
|
|
36
|
+
|
|
|
37
|
+ steps:
|
|
|
38
|
+
|
|
|
39
|
+ - name: Checkout
|
|
|
40
|
+ uses: actions/checkout@v3
|
|
|
41
|
+ with:
|
|
|
42
|
+ submodules: recursive
|
|
|
43
|
+
|
|
|
44
|
+ - name: Install toolchain
|
|
|
45
|
+ uses: actions-rs/toolchain@v1
|
|
|
46
|
+ with:
|
|
|
47
|
+ toolchain: stable
|
|
|
48
|
+ override: true
|
|
|
49
|
+ default: true
|
|
|
50
|
+ components: rustfmt
|
|
|
51
|
+ profile: minimal
|
|
|
52
|
+ target: ${{ matrix.job.target }}
|
|
|
53
|
+
|
|
|
54
|
+ - name: Build
|
|
|
55
|
+ uses: actions-rs/cargo@v1
|
|
|
56
|
+ with:
|
|
|
57
|
+ command: build
|
|
|
58
|
+ args: --release --all-features --target=${{ matrix.job.target }}
|
|
|
59
|
+ use-cross: true
|
|
|
60
|
+
|
|
|
61
|
+ - name: Exec chmod
|
|
|
62
|
+ run: chmod -v a+x target/${{ matrix.job.target }}/release/*
|
|
|
63
|
+
|
|
|
64
|
+ - name: Publish Artifacts
|
|
|
65
|
+ uses: actions/upload-artifact@v4
|
|
|
66
|
+ with:
|
|
|
67
|
+ name: binaries-linux-${{ matrix.job.name }}
|
|
|
68
|
+ path: |
|
|
|
69
|
+ target/${{ matrix.job.target }}/release/hbbr
|
|
|
70
|
+ target/${{ matrix.job.target }}/release/hbbs
|
|
|
71
|
+ target/${{ matrix.job.target }}/release/rustdesk-utils
|
|
|
72
|
+ if-no-files-found: error
|
|
|
73
|
+
|
|
|
74
|
+
|
|
|
75
|
+ # docker build and push of single-arch images
|
|
|
76
|
+ docker:
|
|
|
77
|
+
|
|
|
78
|
+ name: Docker push - ${{ matrix.job.name }}
|
|
|
79
|
+ needs: build
|
|
|
80
|
+ runs-on: ubuntu-24.04
|
|
|
81
|
+ strategy:
|
|
|
82
|
+ fail-fast: false
|
|
|
83
|
+ matrix:
|
|
|
84
|
+ job:
|
|
|
85
|
+ - { name: "amd64", docker_platform: "linux/amd64", s6_platform: "x86_64" }
|
|
|
86
|
+ - { name: "arm64v8", docker_platform: "linux/arm64", s6_platform: "aarch64" }
|
|
|
87
|
+ - { name: "armv7", docker_platform: "linux/arm/v7", s6_platform: "armhf" }
|
|
|
88
|
+# - { name: "i386", docker_platform: "linux/386", s6_platform: "i686" }
|
|
|
89
|
+
|
|
|
90
|
+ steps:
|
|
|
91
|
+
|
|
|
92
|
+ - name: Checkout
|
|
|
93
|
+ uses: actions/checkout@v3
|
|
|
94
|
+ with:
|
|
|
95
|
+ submodules: recursive
|
|
|
96
|
+
|
|
|
97
|
+ - name: Download binaries
|
|
|
98
|
+ uses: actions/download-artifact@v4
|
|
|
99
|
+ with:
|
|
|
100
|
+ name: binaries-linux-${{ matrix.job.name }}
|
|
|
101
|
+ path: docker/rootfs/usr/bin
|
|
|
102
|
+
|
|
|
103
|
+ - name: Make binaries executable
|
|
|
104
|
+ run: chmod -v a+x docker/rootfs/usr/bin/*
|
|
|
105
|
+
|
|
|
106
|
+ - name: Set up QEMU
|
|
|
107
|
+ uses: docker/setup-qemu-action@v2
|
|
|
108
|
+
|
|
|
109
|
+ - name: Set up Docker Buildx
|
|
|
110
|
+ uses: docker/setup-buildx-action@v2
|
|
|
111
|
+
|
|
|
112
|
+ - name: Log in to Docker Hub
|
|
|
113
|
+ if: github.event_name != 'pull_request'
|
|
|
114
|
+ uses: docker/login-action@v2
|
|
|
115
|
+ with:
|
|
|
116
|
+ username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
117
|
+ password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
118
|
+
|
|
|
119
|
+ - name: Extract metadata (tags, labels) for Docker
|
|
|
120
|
+ id: meta
|
|
|
121
|
+ uses: docker/metadata-action@v4
|
|
|
122
|
+ with:
|
|
|
123
|
+ images: registry.hub.docker.com/${{ secrets.DOCKER_IMAGE }}
|
|
|
124
|
+
|
|
|
125
|
+ - name: Get git tag
|
|
|
126
|
+ id: vars
|
|
|
127
|
+ run: |
|
|
|
128
|
+ T=${GITHUB_REF#refs/*/}
|
|
|
129
|
+ M=${T%%.*}
|
|
|
130
|
+ echo "GIT_TAG=$T" >> $GITHUB_ENV
|
|
|
131
|
+ echo "MAJOR_TAG=$M" >> $GITHUB_ENV
|
|
|
132
|
+
|
|
|
133
|
+ - name: Build and push Docker image
|
|
|
134
|
+ uses: docker/build-push-action@v5
|
|
|
135
|
+ with:
|
|
|
136
|
+ context: "./docker"
|
|
|
137
|
+ platforms: ${{ matrix.job.docker_platform }}
|
|
|
138
|
+ push: true
|
|
|
139
|
+ provenance: false
|
|
|
140
|
+ build-args: |
|
|
|
141
|
+ S6_ARCH=${{ matrix.job.s6_platform }}
|
|
|
142
|
+ tags: |
|
|
|
143
|
+ ${{ secrets.DOCKER_IMAGE }}:${{ env.GIT_TAG }}-${{ matrix.job.name }}
|
|
|
144
|
+ labels: ${{ steps.meta.outputs.labels }}
|
|
|
145
|
+
|
|
|
146
|
+ # docker build and push of multiarch images
|
|
|
147
|
+ docker-manifest:
|
|
|
148
|
+
|
|
|
149
|
+ name: Docker manifest s6
|
|
|
150
|
+ needs: docker
|
|
|
151
|
+ runs-on: ubuntu-24.04
|
|
|
152
|
+
|
|
|
153
|
+ steps:
|
|
|
154
|
+
|
|
|
155
|
+ - name: Log in to Docker Hub
|
|
|
156
|
+ if: github.event_name != 'pull_request'
|
|
|
157
|
+ uses: docker/login-action@v2
|
|
|
158
|
+ with:
|
|
|
159
|
+ username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
160
|
+ password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
161
|
+
|
|
|
162
|
+ - name: Get git tag
|
|
|
163
|
+ id: vars
|
|
|
164
|
+ run: |
|
|
|
165
|
+ T=${GITHUB_REF#refs/*/}
|
|
|
166
|
+ M=${T%%.*}
|
|
|
167
|
+ echo "GIT_TAG=$T" >> $GITHUB_ENV
|
|
|
168
|
+ echo "MAJOR_TAG=$M" >> $GITHUB_ENV
|
|
|
169
|
+
|
|
|
170
|
+ # manifest for :1.2.3 tag
|
|
|
171
|
+ # this has to run only if invoked by a new tag
|
|
|
172
|
+ - name: Create and push manifest (:ve.rs.ion)
|
|
|
173
|
+ uses: Noelware/docker-manifest-action@master
|
|
|
174
|
+ if: github.event_name != 'workflow_dispatch'
|
|
|
175
|
+ with:
|
|
|
176
|
+ tags: ${{ secrets.DOCKER_IMAGE }}:${{ env.GIT_TAG }}
|
|
|
177
|
+ inputs: |
|
|
|
178
|
+ ${{ secrets.DOCKER_IMAGE }}:${{ env.GIT_TAG }}-amd64,
|
|
|
179
|
+ ${{ secrets.DOCKER_IMAGE }}:${{ env.GIT_TAG }}-arm64v8,
|
|
|
180
|
+ ${{ secrets.DOCKER_IMAGE }}:${{ env.GIT_TAG }}-armv7,
|
|
|
181
|
+# ${{ secrets.DOCKER_IMAGE }}:${{ env.GIT_TAG }}-i386
|
|
|
182
|
+ push: true
|