e2e-mac.yml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. name: e2e-mac
  2. concurrency:
  3. group: ${{ github.workflow }}-${{ github.ref }}
  4. cancel-in-progress: true
  5. on:
  6. push:
  7. branches:
  8. - 'main'
  9. - 'e2e*'
  10. tags:
  11. - 'v*'
  12. pull_request:
  13. permissions:
  14. contents: read # to fetch code (actions/checkout)
  15. env:
  16. REPO_SLUG: "docker/compose-bin"
  17. jobs:
  18. e2e-mac:
  19. name: Build and test
  20. runs-on: ${{ matrix.os }}
  21. timeout-minutes: 55
  22. strategy:
  23. fail-fast: false
  24. matrix:
  25. os: [macos-latest-xl]
  26. # mode: [plugin, standalone]
  27. mode: [plugin]
  28. env:
  29. GO111MODULE: "on"
  30. steps:
  31. - uses: actions/checkout@v3
  32. - uses: actions/setup-go@v3
  33. with:
  34. go-version-file: go.mod
  35. cache: true
  36. check-latest: true
  37. # - name: Install and start Docker Desktop
  38. # uses: docker/desktop-action/[email protected]
  39. # if: ${{ contains(matrix.os, 'macos-latest') }}
  40. # Debugging why DD start fails, importing all steps from desktop-action/start
  41. - name: Get Date
  42. id: get-date
  43. run: |
  44. echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")"
  45. shell: bash
  46. - name: Get Docker app cache
  47. id: cache-docker-desktop-app
  48. uses: actions/cache@v3
  49. env:
  50. cache-name: cache-docker-desktop-app
  51. with:
  52. path: /Applications/Docker.app
  53. key: docker-desktop-app-mac-amd64-${{ steps.get-date.outputs.date }}
  54. - name: Get Docker install settings cache
  55. id: cache-docker-desktop-install-settings
  56. uses: actions/cache@v3
  57. env:
  58. cache-name: cache-docker-desktop-install-settings
  59. with:
  60. path: ./cache/desktopInstallSettings/
  61. key: docker-desktop-install-settings-mac-${{ steps.get-date.outputs.date }}
  62. - name: Block calls to segment.io
  63. id: redirect-segment
  64. shell: bash
  65. run: |
  66. echo '127.0.0.2 api.segment.io' | sudo tee -a /etc/hosts
  67. - name: Copy Desktop install settings in /Library
  68. if: steps.cache-docker-desktop-install-settings.outputs.cache-hit == 'true'
  69. shell: bash
  70. run: |
  71. echo "ls ./cache/desktopInstallSettings/"
  72. ls ./cache/desktopInstallSettings/
  73. sudo mkdir -p "/Library/Application Support/com.docker.docker"
  74. sudo cp ./cache/desktopInstallSettings/* "/Library/Application Support/com.docker.docker/"
  75. echo "/Library/Application Support/com.docker.docker/"
  76. ls "/Library/Application Support/com.docker.docker/"
  77. - name: Install Docker Desktop dmg
  78. if: steps.cache-docker-desktop-install-settings.outputs.cache-hit != 'true'
  79. shell: bash
  80. run: |
  81. sw_vers
  82. mkdir ./temp
  83. mkdir ./mount
  84. wget -q -O ./temp/DockerDesktop.dmg https://desktop.docker.com/mac/main/amd64/Docker.dmg
  85. /usr/bin/hdiutil attach -noverify ./temp/DockerDesktop.dmg -mountpoint ./mount/desktop -nobrowse
  86. echo "dmg mounted"
  87. sudo ./mount/desktop/Docker.app/Contents/MacOS/install --accept-license
  88. echo "dmg installed"
  89. echo "ls /Library/Application Support/com.docker.docker"
  90. ls "/Library/Application Support/com.docker.docker" || true
  91. mkdir -p ./cache/desktopInstallSettings
  92. cp "/Library/Application Support/com.docker.docker/"* ./cache/desktopInstallSettings/
  93. echo "ls ./cache/desktopInstallSettings/"
  94. ls ./cache/desktopInstallSettings/ || true
  95. /usr/bin/hdiutil detach ./mount/desktop
  96. echo "dmg unmounted"
  97. - name: Install Docker Desktop app
  98. shell: bash
  99. run: |
  100. sudo mkdir /Library/PrivilegedHelperTools
  101. sudo /Applications/Docker.app/Contents/MacOS/install config --user runner
  102. sudo /Applications/Docker.app/Contents/MacOS/install vmnetd
  103. echo "app installed"
  104. /usr/bin/open /Applications/Docker.app --args --unattended --add-host-docker-internal-registry
  105. echo "Docker starting..."
  106. - name: Wait for Docker to be up and running
  107. shell: bash
  108. run: |
  109. echo wait a minute
  110. sleep 30
  111. echo ...
  112. sleep 30
  113. echo ok
  114. - name: Upload diagnostics
  115. continue-on-error: true
  116. run: |
  117. /Applications/Docker.app/Contents/MacOS/com.docker.diagnose gather -upload
  118. - name: List Docker resources on machine
  119. run: |
  120. docker ps --all
  121. docker volume ls
  122. docker network ls
  123. docker image ls
  124. - name: Remove Docker resources on machine
  125. continue-on-error: true
  126. run: |
  127. docker kill $(docker ps -q)
  128. docker rm -f $(docker ps -aq)
  129. docker volume rm -f $(docker volume ls -q)
  130. docker ps --all
  131. - name: Unit tests
  132. run: make test
  133. - name: Build binaries
  134. run: |
  135. make
  136. - name: Check arch of go compose binary
  137. run: |
  138. file ./bin/build/docker-compose
  139. if: ${{ !contains(matrix.os, 'desktop-windows') }}
  140. -
  141. name: Test plugin mode
  142. if: ${{ matrix.mode == 'plugin' }}
  143. run: |
  144. make e2e-compose
  145. -
  146. name: Test standalone mode
  147. if: ${{ matrix.mode == 'standalone' }}
  148. run: |
  149. make e2e-compose-standalone