Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: CI Pipeline

on:
push:
branches: [ "cd" ]
pull_request:
branches: [ main, master ]

jobs:
test:
name: Run Tests
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'
cache: true

- name: Install dependencies
run: |
cd gin-api
go mod download

- name: Run tests
run: |
cd gin-api
go test ./...

- name: Run test coverage
run: |
cd gin-api
go test -cover ./...

build:
name: Build and Push Docker Images
runs-on: ubuntu-latest
needs: test
permissions:
contents: read
packages: write

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract backend metadata
id: meta-backend
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository_owner }}/backend
tags: |
type=ref,event=branch
type=ref,event=pr
type=sha,format=short

- name: Build and push backend image
uses: docker/build-push-action@v4
with:
context: ./gin-api
file: ./gin-api/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta-backend.outputs.tags }}
labels: ${{ steps.meta-backend.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build seeder image
uses: docker/build-push-action@v4
with:
context: ./gin-api
file: ./gin-api/Dockerfile.seeder
push: false
tags: sviper-seeder:latest
cache-from: type=gha
cache-to: type=gha,mode=max
Empty file added gin-api/config/stub
Empty file.
Loading