ci.yml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. name: CI
  2. on:
  3. workflow_call:
  4. env:
  5. CGO_LDFLAGS_ALLOW: "-s|-w"
  6. PKG_CONFIG_LIBDIR: /opt/imgproxy/lib/pkgconfig
  7. LD_LIBRARY_PATH: /opt/imgproxy/lib
  8. GOFLAGS: -buildvcs=false
  9. jobs:
  10. test:
  11. runs-on: ubuntu-latest
  12. container:
  13. image: ghcr.io/imgproxy/imgproxy-base:latest
  14. steps:
  15. - name: Checkout
  16. uses: actions/checkout@v4
  17. with:
  18. submodules: true
  19. - name: Setup cache
  20. uses: actions/cache@v4
  21. with:
  22. path: |
  23. ~/.cache/go-build
  24. ~/go/pkg/mod
  25. key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
  26. restore-keys: |
  27. ${{ runner.os }}-go-
  28. - name: Download mods
  29. run: go mod download
  30. - name: Mark git workspace as safe
  31. run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
  32. - name: Test
  33. run: go test ./...
  34. lint:
  35. runs-on: ubuntu-latest
  36. container:
  37. image: ghcr.io/imgproxy/imgproxy-base:latest
  38. steps:
  39. - name: Checkout
  40. uses: actions/checkout@v4
  41. with:
  42. submodules: true
  43. - name: Setup cache
  44. uses: actions/cache@v4
  45. with:
  46. path: |
  47. ~/.cache/go-build
  48. ~/go/pkg/mod
  49. key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
  50. restore-keys: |
  51. ${{ runner.os }}-go-
  52. - name: Download mods
  53. run: go mod download
  54. - name: Lint
  55. uses: golangci/golangci-lint-action@v7
  56. with:
  57. version: v2.1.6
  58. args: --timeout 10m0s
  59. env:
  60. PKG_CONFIG_LIBDIR: /opt/imgproxy/lib/pkgconfig
  61. GOFLAGS: -buildvcs=false
  62. c-lint:
  63. runs-on: ubuntu-24.04
  64. permissions:
  65. contents: read
  66. steps:
  67. - uses: actions/checkout@v4
  68. with:
  69. submodules: true
  70. - uses: cpp-linter/cpp-linter-action@v2
  71. id: linter
  72. env:
  73. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  74. with:
  75. style: file
  76. version: 20
  77. tidy-checks: "-*" # disable clang-tidy
  78. - name: Fail fast
  79. continue-on-error: true # TODO: remove this line in the future
  80. if: steps.linter.outputs.checks-failed > 0
  81. run: exit 1