docker-image-rust-target-multi.yml 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. name: Build Dim Bin and Dockerize
  2. on:
  3. push:
  4. branches: [ 'master', 'docker-build' ]
  5. tags: 'v*'
  6. workflow_dispatch:
  7. env:
  8. CARGO_TERM_COLOR: always
  9. jobs:
  10. create-ui:
  11. runs-on: ubuntu-latest
  12. steps:
  13. - name: Checkout repository
  14. uses: actions/checkout@v3
  15. - name: Build UI
  16. uses: actions/setup-node@v3
  17. with:
  18. node-version: '18'
  19. cache: 'yarn'
  20. - run: npm install -g yarn
  21. - run: yarn -d --cwd ui/ install
  22. env:
  23. NODE_OPTIONS: --openssl-legacy-provider
  24. - run: yarn -d --cwd ui/ build
  25. env:
  26. NODE_OPTIONS: --openssl-legacy-provider
  27. - name: upload ui artifacts
  28. uses: actions/upload-artifact@v3
  29. with:
  30. name: ui
  31. path: ui/build
  32. build-armhf:
  33. needs: [create-ui]
  34. runs-on: ubuntu-latest
  35. container:
  36. image: rust:1.63
  37. env:
  38. CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc
  39. OPENSSL_INCLUDE_DIR: "/usr/include/openssl/"
  40. OPENSSL_LIB_DIR: "/usr/lib/arm-linux-gnueabihf/"
  41. CARGO_TERM_COLOR: always
  42. steps:
  43. - name: add armhf architecture
  44. run: dpkg --add-architecture armhf
  45. - name: install runtime
  46. run: apt update && apt install -y pkg-config gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf libc6-armhf-cross libc6-dev-armhf-cross tar ca-certificates
  47. - name: Checkout repository
  48. uses: actions/checkout@v2
  49. - name: Download webui
  50. uses: actions/download-artifact@v3
  51. with:
  52. name: ui
  53. path: ui/build
  54. - uses: actions/cache@v3
  55. with:
  56. path: |
  57. .cargo/bin
  58. .cargo/registry/index
  59. .cargo/registry/cache
  60. .cargo/git/db
  61. target
  62. key: dim-bin-armhf-${{ hashFiles('**/Cargo.lock') }}
  63. restore-keys: |
  64. dim-bin-armhf-
  65. - name: add armhf target
  66. run: rustup target add armv7-unknown-linux-gnueabihf
  67. - name: smoke test
  68. run: rustc --version
  69. - name: compile armhf
  70. run: cargo build --target=armv7-unknown-linux-gnueabihf --release
  71. - name: check path
  72. run: ls -al target/
  73. - name: upload armhf artifacts
  74. uses: actions/upload-artifact@v3
  75. with:
  76. name: armhf-bin
  77. path: target/armv7-unknown-linux-gnueabihf/release/dim
  78. build-aarch64:
  79. needs: [create-ui]
  80. runs-on: ubuntu-latest
  81. container:
  82. image: rust:1.63
  83. env:
  84. CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
  85. OPENSSL_INCLUDE_DIR: "/usr/include/openssl/"
  86. OPENSSL_LIB_DIR: "/usr/lib/aarch64-linux-gnu/"
  87. CARGO_TERM_COLOR: always
  88. steps:
  89. - name: add arm64 architecture
  90. run: dpkg --add-architecture arm64
  91. - name: install runtime
  92. run: apt update && apt install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libc6-arm64-cross libc6-dev-arm64-cross libssl-dev:arm64
  93. - name: Checkout repository
  94. uses: actions/checkout@v2
  95. - name: Download webui
  96. uses: actions/download-artifact@v3
  97. with:
  98. name: ui
  99. path: ui/build
  100. - uses: actions/cache@v3
  101. with:
  102. path: |
  103. .cargo/bin
  104. .cargo/registry/index
  105. .cargo/registry/cache
  106. .cargo/git/db
  107. target
  108. key: dim-bin-aarch64-${{ hashFiles('**/Cargo.lock') }}
  109. restore-keys: |
  110. dim-bin-aarch64-
  111. - name: add arm64 target
  112. run: rustup target add aarch64-unknown-linux-gnu
  113. - name: smoke test
  114. run: rustc --version
  115. - name: compile aarch64
  116. run: cargo build --target=aarch64-unknown-linux-gnu --release
  117. - name: check path
  118. run: ls -al target/
  119. - name: upload aarch64 artifacts
  120. uses: actions/upload-artifact@v3
  121. with:
  122. name: aarch64-bin
  123. path: target/aarch64-unknown-linux-gnu/release/dim
  124. build-amd64:
  125. needs: [create-ui]
  126. runs-on: ubuntu-latest
  127. container:
  128. image: rust:1.63
  129. env:
  130. CARGO_TERM_COLOR: always
  131. steps:
  132. - name: install runtime
  133. run: apt update && apt install -y gcc-x86-64-linux-gnu g++-x86-64-linux-gnu libc6-dev libssl-dev libva-dev libva-drm2 libva2
  134. - name: Checkout repository
  135. uses: actions/checkout@v2
  136. - name: Download webui
  137. uses: actions/download-artifact@v3
  138. with:
  139. name: ui
  140. path: ui/build
  141. - uses: actions/cache@v3
  142. with:
  143. path: |
  144. .cargo/bin
  145. .cargo/registry/index
  146. .cargo/registry/cache
  147. .cargo/git/db
  148. target
  149. key: dim-bin-amd64-${{ hashFiles('**/Cargo.lock') }}
  150. restore-keys: |
  151. dim-bin-amd64-
  152. - name: add x86_64 target
  153. run: rustup target add x86_64-unknown-linux-gnu
  154. - name: smoke test
  155. run: rustc --version
  156. - name: compile amd64
  157. run: cargo build --features vaapi --target=x86_64-unknown-linux-gnu --release
  158. - name: check path
  159. run: ls -al target/
  160. - name: upload amd64 artifacts
  161. uses: actions/upload-artifact@v3
  162. with:
  163. name: amd64-bin
  164. path: target/x86_64-unknown-linux-gnu/release/dim
  165. build-docker-image:
  166. needs: [build-armhf,build-aarch64,build-amd64]
  167. name: Build Docker image
  168. runs-on: ubuntu-latest
  169. permissions:
  170. contents: read
  171. packages: write
  172. steps:
  173. - name: fetch repo
  174. uses: actions/checkout@v3
  175. - name: Download armhf dim artifacts
  176. uses: actions/download-artifact@v3
  177. with:
  178. name: armhf-bin
  179. path: bin/armhf-bin
  180. - name: Download armhf dim artifacts
  181. uses: actions/download-artifact@v3
  182. with:
  183. name: aarch64-bin
  184. path: bin/aarch64-bin
  185. - name: Download amd64 dim artifacts
  186. uses: actions/download-artifact@v3
  187. with:
  188. name: amd64-bin
  189. path: bin/amd64-bin
  190. - name: check path
  191. run: ls -al
  192. - name: check bin path
  193. run: ls -al bin/
  194. - name: setup qemu
  195. uses: docker/setup-qemu-action@v2
  196. - uses: docker/setup-buildx-action@v2
  197. - uses: docker/metadata-action@v4
  198. id: meta
  199. with:
  200. images: ghcr.io/${{ github.repository }}
  201. tags: |
  202. type=ref,event=branch
  203. type=ref,event=pr
  204. type=semver,pattern={{version}}
  205. type=semver,pattern={{major}}.{{minor}}
  206. - uses: docker/login-action@v2
  207. with:
  208. registry: ghcr.io
  209. username: ${{ github.actor }}
  210. password: ${{ secrets.GITHUB_TOKEN }}
  211. - uses: docker/build-push-action@v4
  212. with:
  213. #push: true
  214. push: ${{ github.event_name != 'pull_request' }}
  215. context: .
  216. platforms: linux/amd64,linux/arm64,linux/arm/v7
  217. file: ./.github/workflows/Dockerfile.ci
  218. tags: ${{ steps.meta.outputs.tags }}
  219. labels: ${{ steps.meta.outputs.labels }}
  220. cache-to: type=gha,mode=max
  221. cache-from: type=gha