gate user role #6885
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and run all tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
test: | |
if: ${{ !(contains(github.head_ref, 'ui/')) || !(contains(github.head_ref, 'cms/')) }} | |
strategy: | |
matrix: | |
go-version: [1.21.x] | |
os: [ubuntu-latest, macos-latest] | |
postgres-version: ["15"] | |
redis-version: ["6.2.6"] | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:${{ matrix.postgres-version }} | |
ports: | |
- 5432:5432 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_DB: convoy | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_MAX_CONNECTIONS: 2000 | |
# set up health check for postgres | |
options: --health-cmd pg_isready --health-interval 10ms --health-timeout 500ms --health-retries 15 | |
steps: | |
- name: Start Redis v${{ matrix.redis-version }} | |
uses: supercharge/[email protected] | |
with: | |
redis-version: ${{ matrix.redis-version }} | |
redis-port: 6379 | |
- name: Get the version | |
id: get_version | |
run: echo ::set-output name=tag::$(echo ${GITHUB_SHA:8}) | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Cache go modules | |
uses: actions/cache@v1 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }} | |
restore-keys: ${{ runner.os }}-go-${{ hashFiles('go.sum') }} | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Get and verify dependencies | |
run: go mod download && go mod verify | |
- name: Build app to make sure there are zero issues | |
run: go build -o convoy ./cmd | |
- name: Go vet | |
run: go vet ./... | |
- name: Migrate Postgres | |
run: go run ./cmd migrate up | |
env: | |
CONVOY_DB_SCHEME: postgres | |
CONVOY_DB_HOST: localhost | |
CONVOY_DB_USERNAME: postgres | |
CONVOY_DB_PASSWORD: postgres | |
CONVOY_DB_DATABASE: convoy | |
CONVOY_DB_OPTIONS: sslmode=disable&connect_timeout=30 | |
CONVOY_DB_PORT: 5432 | |
CONVOY_REDIS_SCHEME: redis | |
CONVOY_REDIS_HOST: localhost | |
CONVOY_REDIS_PORT: 6379 | |
- name: Run integration tests | |
run: make integration_tests | |
env: | |
TEST_DB_SCHEME: postgres | |
TEST_DB_HOST: localhost | |
TEST_DB_USERNAME: postgres | |
TEST_DB_PASSWORD: postgres | |
TEST_DB_DATABASE: convoy | |
TEST_DB_OPTIONS: sslmode=disable&connect_timeout=30 | |
TEST_DB_PORT: 5432 | |
TEST_REDIS_SCHEME: redis | |
TEST_REDIS_HOST: localhost | |
TEST_REDIS_PORT: 6379 | |
- name: Run integration tests (with test containers) | |
run: make docker_e2e_tests | |
env: | |
TEST_LICENSE_KEY: ${{ secrets.CONVOY_TEST_LICENSE_KEY }} | |
TEST_DB_SCHEME: postgres | |
TEST_DB_HOST: localhost | |
TEST_DB_USERNAME: postgres | |
TEST_DB_PASSWORD: postgres | |
TEST_DB_DATABASE: convoy | |
TEST_DB_OPTIONS: sslmode=disable&connect_timeout=30 | |
TEST_DB_PORT: 5432 | |
TEST_REDIS_SCHEME: redis | |
TEST_REDIS_HOST: localhost | |
TEST_REDIS_PORT: 6379 | |