feat: add CORS middleware to all route handlers #20
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: GoCommerce Build and Push Docker Compose Services | |
on: | |
push: | |
branches: [ "dev" ] | |
pull_request: | |
branches: [ "dev" ] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.23' | |
- name: Install Dependencies | |
run: go mod tidy | |
- name: Run Linter | |
run: | | |
go install golang.org/x/lint/golint@latest | |
golint ./... | |
- name: Run Tests | |
run: go test -v ./... | |
env: | |
MONGODB_URI: ${{ secrets.MONGODB_URI }} | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Check out the repository | |
- uses: actions/checkout@v4 | |
# Step 2: Log in to Docker Hub | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
# Step 3: Build and push Docker image | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: ${{ secrets.DOCKER_USERNAME }}/gocommerce:latest | |
env: | |
JWT_SECRET_KEY: ${{ secrets.JWT_SECRET_KEY }} | |
RABBITMQ_URI: ${{ secrets.RABBITMQ_URI }} | |
MONGODB_URI: ${{ secrets.MONGODB_URI }} | |
MONGODB_NAME: GoCommerce | |
ORDER_QUEUE_NAME: orderNotifications | |
DEFAULT_TIMEOUT: 30s | |
PORT: 8000 |