docker.yml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. # Copyright 2019-2023 Tauri Programme within The Commons Conservancy
  2. # SPDX-License-Identifier: Apache-2.0
  3. # SPDX-License-Identifier: MIT
  4. name: docker
  5. on:
  6. workflow_dispatch:
  7. #pull_request:
  8. # paths:
  9. # - '.docker/**'
  10. # - '.github/workflows/docker.yml'
  11. jobs:
  12. setup:
  13. runs-on: ubuntu-latest
  14. steps:
  15. - name: Checkout
  16. uses: actions/checkout@v3
  17. - name: install stable
  18. uses: actions-rs/toolchain@v1
  19. with:
  20. toolchain: stable
  21. - name: install Linux dependencies
  22. run: |
  23. sudo apt-get update
  24. sudo apt-get install -y libgtk-3-dev
  25. - name: install cross
  26. run: cargo install cross --git https://github.com/cross-rs/cross
  27. - name: Upload cross
  28. uses: actions/upload-artifact@v3
  29. with:
  30. name: cross
  31. path: '~/.cargo/bin/cross'
  32. if-no-files-found: error
  33. - name: build CLI
  34. uses: actions-rs/cargo@v1
  35. with:
  36. command: build
  37. args: --manifest-path ./tooling/cli/Cargo.toml
  38. - name: Upload CLI
  39. uses: actions/upload-artifact@v3
  40. with:
  41. name: cargo-tauri
  42. path: tooling/cli/target/debug/cargo-tauri
  43. if-no-files-found: error
  44. docker:
  45. needs: setup
  46. runs-on: ubuntu-latest
  47. strategy:
  48. fail-fast: false
  49. matrix:
  50. target:
  51. - { name: 'aarch64-unknown-linux-gnu', filename: 'aarch64' }
  52. steps:
  53. - name: Checkout
  54. uses: actions/checkout@v3
  55. - name: install stable
  56. uses: actions-rs/toolchain@v1
  57. with:
  58. toolchain: stable
  59. override: true
  60. default: true
  61. target: ${{ matrix.target.name }}
  62. - name: Setup node
  63. uses: actions/setup-node@v3
  64. with:
  65. node-version: 16
  66. - name: Download cross
  67. uses: actions/download-artifact@v3
  68. with:
  69. name: cross
  70. path: '~/.cargo/bin'
  71. - name: Download CLI
  72. uses: actions/download-artifact@v3
  73. with:
  74. name: cargo-tauri
  75. path: 'examples/api'
  76. - name: Set up QEMU
  77. uses: docker/setup-qemu-action@v2
  78. - name: Set up Docker Buildx
  79. uses: docker/setup-buildx-action@v2
  80. - name: Login to GitHub Container Registry
  81. uses: docker/login-action@v2
  82. with:
  83. registry: ghcr.io
  84. username: ${{ github.repository_owner }}
  85. password: ${{ secrets.GITHUB_TOKEN }}
  86. - name: Build and export to Docker
  87. uses: docker/build-push-action@v3
  88. with:
  89. context: .docker/cross
  90. file: .docker/cross/${{ matrix.target.filename }}.Dockerfile
  91. load: true
  92. tags: ${{ matrix.target.name }}:latest
  93. - name: install dependencies
  94. run: |
  95. sudo apt-get update
  96. sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev
  97. - name: Test
  98. run: |
  99. cd tooling/api
  100. yarn && yarn build
  101. cd ../../examples/api
  102. yarn
  103. . .setup-cross.sh
  104. chmod +x cargo-tauri
  105. chmod +x $HOME/.cargo/bin/cross
  106. ./cargo-tauri build --runner cross --bundles deb --target ${{ matrix.target.name }} --verbose
  107. - name: Build and push
  108. uses: docker/build-push-action@v3
  109. with:
  110. context: .docker/cross
  111. file: .docker/cross/${{ matrix.target.filename }}.Dockerfile
  112. push: true
  113. tags: ghcr.io/${{ github.repository }}/${{ matrix.target.name }}:latest