go.yml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. # This workflow will build a golang project
  2. # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
  3. name: Go
  4. on:
  5. push:
  6. branches: [ "main" ]
  7. pull_request:
  8. branches: [ "main" ]
  9. permissions:
  10. id-token: write
  11. contents: read
  12. jobs:
  13. build:
  14. runs-on: ubuntu-latest
  15. services:
  16. postgres:
  17. image: postgres
  18. env:
  19. POSTGRES_PASSWORD: postgres
  20. POSTGRES_USER: postgres
  21. POSTGRES_DB: postgres
  22. options: >-
  23. --health-cmd pg_isready
  24. --health-interval 10s
  25. --health-timeout 5s
  26. --health-retries 5
  27. ports:
  28. - 5432:5432
  29. steps:
  30. - uses: actions/checkout@v3
  31. - name: Set up Go
  32. uses: actions/setup-go@v3
  33. with:
  34. go-version-file: 'go.mod'
  35. cache: true
  36. - name: Install dependencies
  37. run: |
  38. sudo apt-get update
  39. sudo apt-get -y install libvips-dev
  40. - name: Configure AWS credentials
  41. uses: aws-actions/configure-aws-credentials@v2
  42. with:
  43. aws-region: ap-northeast-1
  44. role-to-assume: arn:aws:iam::475867236237:role/qor5-test-example-ci-github-actions-upload-assets
  45. - name: Build
  46. run: go build -v ./...
  47. - name: Test
  48. run: go test -v -p=1 -count=1 ./...
  49. env:
  50. DBURL: "postgres://postgres:postgres@localhost:5432/postgres"
  51. AWS_SDK_LOAD_CONFIG: 1
  52. S3_Bucket: "qor5-test-example-ci"
  53. S3_Region: "ap-northeast-1"