test.yml 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. name: test
  2. # Default to 'contents: read', which grants actions to read commits.
  3. #
  4. # If any permission is set, any permission not included in the list is
  5. # implicitly set to "none".
  6. #
  7. # see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
  8. permissions:
  9. contents: read
  10. concurrency:
  11. group: ${{ github.workflow }}-${{ github.ref }}
  12. cancel-in-progress: true
  13. on:
  14. workflow_dispatch:
  15. push:
  16. branches:
  17. - 'master'
  18. - '[0-9]+.[0-9]+'
  19. - '[0-9]+.x'
  20. tags:
  21. - 'v*'
  22. pull_request:
  23. jobs:
  24. ctn:
  25. runs-on: ubuntu-24.04
  26. steps:
  27. -
  28. name: Set up Docker Buildx
  29. uses: docker/setup-buildx-action@v3
  30. -
  31. name: Test
  32. uses: docker/bake-action@v6
  33. with:
  34. targets: test-coverage
  35. -
  36. name: Send to Codecov
  37. uses: codecov/codecov-action@v5
  38. with:
  39. files: ./build/coverage/coverage.txt
  40. token: ${{ secrets.CODECOV_TOKEN }}
  41. host:
  42. runs-on: ${{ matrix.os }}
  43. env:
  44. GOPATH: ${{ github.workspace }}
  45. GOBIN: ${{ github.workspace }}/bin
  46. GO111MODULE: auto
  47. strategy:
  48. fail-fast: false
  49. matrix:
  50. os:
  51. - macos-13 # macOS 13 on Intel
  52. - macos-14 # macOS 14 on arm64 (Apple Silicon M1)
  53. # - windows-2022 # FIXME: some tests are failing on the Windows runner, as well as on Appveyor since June 24, 2018: https://ci.appveyor.com/project/docker/cli/history
  54. steps:
  55. -
  56. name: Checkout
  57. uses: actions/checkout@v4
  58. with:
  59. path: ${{ env.GOPATH }}/src/github.com/docker/cli
  60. -
  61. name: Set up Go
  62. uses: actions/setup-go@v5
  63. with:
  64. go-version: "1.23.8"
  65. -
  66. name: Test
  67. run: |
  68. go test -coverprofile=/tmp/coverage.txt $(go list ./... | grep -vE '/vendor/|/e2e/')
  69. go tool cover -func=/tmp/coverage.txt
  70. working-directory: ${{ env.GOPATH }}/src/github.com/docker/cli
  71. shell: bash
  72. -
  73. name: Send to Codecov
  74. uses: codecov/codecov-action@v5
  75. with:
  76. files: /tmp/coverage.txt
  77. working-directory: ${{ env.GOPATH }}/src/github.com/docker/cli
  78. token: ${{ secrets.CODECOV_TOKEN }}