| 1 |
name: CI Test |
| 2 |
|
| 3 |
on: [push, pull_request] |
| 4 |
|
| 5 |
jobs: |
| 6 |
lint: |
| 7 |
runs-on: ubuntu-latest |
| 8 |
steps: |
| 9 |
- name: Setup go |
| 10 |
uses: actions/setup-go@v2 |
| 11 |
with: |
| 12 |
go-version: '^1.14' |
| 13 |
- name: Checkout repository |
| 14 |
uses: actions/checkout@v2 |
| 15 |
- name: Setup golangci-lint |
| 16 |
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.25.0 |
| 17 |
- name: Run golangci-lint |
| 18 |
run: golangci-lint run ./... |
| 19 |
- name: Verify Codegen |
| 20 |
run: ./hack/verify-deepcopy-gen.sh |
| 21 |
test: |
| 22 |
strategy: |
| 23 |
matrix: |
| 24 |
kong_version: [ '1.0.3', '1.1.2', '1.2.0', '1.3.0', '1.4.0', '2.0.4', '2.1.0'] |
| 25 |
env: |
| 26 |
KONG_VERSION: ${{ matrix.kong_version }} |
| 27 |
KONG_ENTERPRISE_REPO_USERNAME: ${{ secrets.KONG_ENTERPRISE_REPO_USERNAME }} |
| 28 |
KONG_ENTERPRISE_REPO_PASSSWORD: ${{ secrets.KONG_ENTERPRISE_REPO_PASSSWORD }} |
| 29 |
KONG_LICENSE_DATA: ${{ secrets.KONG_LICENSE_DATA }} |
| 30 |
KONG_ANONYMOUS_REPORTS: "off" |
| 31 |
runs-on: ubuntu-latest |
| 32 |
services: |
| 33 |
postgres: |
| 34 |
image: postgres:11.6-alpine |
| 35 |
ports: |
| 36 |
- 5432:5432 |
| 37 |
# needed because the postgres container does not provide a healthcheck |
| 38 |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 |
| 39 |
steps: |
| 40 |
- name: Setup go |
| 41 |
uses: actions/setup-go@v2 |
| 42 |
with: |
| 43 |
go-version: '^1.14' |
| 44 |
- name: Checkout repository |
| 45 |
uses: actions/checkout@v2 |
| 46 |
- name: Setup Postgres |
| 47 |
run: | |
| 48 |
psql -c 'create database kong;' -U postgres -h 127.0.0.1 -p 5432 |
| 49 |
psql -c 'create user kong;' -U postgres -h 127.0.0.1 -p 5432 |
| 50 |
psql -c 'GRANT ALL PRIVILEGES ON DATABASE "kong" to kong;' -U postgres -h 127.0.0.1 -p 5432 |
| 51 |
- name: Setup Kong |
| 52 |
run: bash .ci/setup_kong.sh |
| 53 |
- name: Run tests |
| 54 |
run: go test -v ./... |
| 55 |
test-enterprise: |
| 56 |
strategy: |
| 57 |
matrix: |
| 58 |
kong_version: ['enterprise-1.3.0.2', 'enterprise-1.5.0.2'] |
| 59 |
env: |
| 60 |
KONG_VERSION: ${{ matrix.kong_version }} |
| 61 |
KONG_ENTERPRISE_REPO_USERNAME: ${{ secrets.KONG_ENTERPRISE_REPO_USERNAME }} |
| 62 |
KONG_ENTERPRISE_REPO_PASSSWORD: ${{ secrets.KONG_ENTERPRISE_REPO_PASSSWORD }} |
| 63 |
KONG_LICENSE_DATA: ${{ secrets.KONG_LICENSE_DATA }} |
| 64 |
KONG_ANONYMOUS_REPORTS: "off" |
| 65 |
KONG_ADMIN_TOKEN: kong |
| 66 |
runs-on: ubuntu-latest |
| 67 |
services: |
| 68 |
postgres: |
| 69 |
image: postgres:11.6-alpine |
| 70 |
ports: |
| 71 |
- 5432:5432 |
| 72 |
# needed because the postgres container does not provide a healthcheck |
| 73 |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 |
| 74 |
steps: |
| 75 |
- name: Setup go |
| 76 |
uses: actions/setup-go@v2 |
| 77 |
with: |
| 78 |
go-version: '^1.14' |
| 79 |
- name: Checkout repository |
| 80 |
uses: actions/checkout@v2 |
| 81 |
- name: Setup Postgres |
| 82 |
run: | |
| 83 |
psql -c 'create database kong;' -U postgres -h 127.0.0.1 -p 5432 |
| 84 |
psql -c 'create user kong;' -U postgres -h 127.0.0.1 -p 5432 |
| 85 |
psql -c 'GRANT ALL PRIVILEGES ON DATABASE "kong" to kong;' -U postgres -h 127.0.0.1 -p 5432 |
| 86 |
- name: Setup Kong |
| 87 |
run: bash .ci/setup_kong.sh |
| 88 |
- name: Run tests |
| 89 |
run: go test -tags=enterprise -v ./... |