Skip to content

fix: tidying up deploy url error #43

fix: tidying up deploy url error

fix: tidying up deploy url error #43

Workflow file for this run

name: main
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
PORT: ${{ secrets.PORT }}
GIN_MODE: ${{ secrets.GIN_MODE }}
LOG_LEVEL: ${{ secrets.LOG_LEVEL }}
LOG_OUTPUT: ${{ secrets.LOG_OUTPUT }}
AUTHORIZATION_URL: ${{ secrets.AUTHORIZATION_URL }}
POSTGRES_HOST: ${{ secrets.POSTGRES_HOST }}
POSTGRES_PORT: ${{ secrets.POSTGRES_PORT }}
POSTGRES_USER: ${{ secrets.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
POSTGRES_DB: ${{ secrets.POSTGRES_DB }}
POSTGRES_URL: ${{ secrets.POSTGRES_URL }}
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
DB_URL: ${{ secrets.DB_URL }}
DEPLOY_HOOK: ${{ secrets.DEPLOY_HOOK }}
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version-file: go.mod
- name: Download dependencies
run: go mod download
- name: Build
run: go build -v ./...
- name: Test
run: go test -v ./internal/...
security:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Run Snyk to check for Go vulnerabilities
uses: snyk/actions/golang@master
with:
args: --severity-threshold=critical
test:
needs: [build, security]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Set up Docker Compose
run: docker-compose -f docker-compose.ci.yml up -d --build --no-cache
- name: Run project
run: make ci
- name: Set up Go for E2E tests
uses: actions/setup-go@v3
with:
go-version-file: go.mod
- name: Run E2E tests
run: go test -v ./e2e/...
- name: Get Docker Compose status
if: failure()
run: docker-compose -f docker-compose.ci.yml ps
- name: Get Docker Compose logs
if: failure()
run: docker-compose -f docker-compose.ci.yml logs
- name: Tear Down
if: always()
run: docker-compose -f docker-compose.ci.yml down
migrate:
needs: [test]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Run database migrations
run: |
docker run --rm \
-v $(pwd)/migrations:/migrations \
migrate/migrate \
-path /migrations \
-database "${{ env.DB_URL }}" \
up
deploy:
needs: [migrate]
runs-on: ubuntu-latest
steps:
- name: Deploy API to Render
run: |
curl -X POST \
-H "Content-Type: application/json" \
-d '{"branch": "main"}' \
${{ env.DEPLOY_HOOK }}