Skip to content
Closed
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
Original file line number Diff line number Diff line change
@@ -1,12 +1,55 @@
name: Integration Tests
name: CI

on:
workflow_call:
pull_request:
branches: [ main ]

env:
GO_VERSION: '1.25'

jobs:
lint:
name: Lint Check
runs-on: ubuntu-latest

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

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true

- name: Check formatting
run: gofmt -l .

unit-tests:
name: Unit Tests
runs-on: ubuntu-latest

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

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true

- name: Download dependencies
run: go mod download

- name: Run unit tests
run: go test -v -race ./internal/...

integration-tests:
name: Integration Tests
runs-on: ubuntu-latest

services:
postgres:
image: postgres:17
Expand All @@ -29,7 +72,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
go-version: ${{ env.GO_VERSION }}
cache: true

- name: Install sql-migrate
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build and Deploy

on:
workflow_dispatch:
push:
branches: [ main, "feat/cd" ]

jobs:
test:
name: Tests
uses: ./.github/workflows/ci.yaml

build-and-push:
name: Build and Push
needs: test
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v3

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

- name: Login to Amazon ECR Public
id: login-ecr-public
uses: aws-actions/amazon-ecr-login@v2
with:
registry-type: public

- name: Build and Push Image
env:
REGISTRY: ${{ steps.login-ecr-public.outputs.registry }}
REGISTRY_ALIAS: d0w1o5s2
REPOSITORY: ubcea/echo-base
TAG: ${{ github.sha }}
run: |
docker build -t $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$TAG .
docker push $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$TAG

deploy:
name: Deploy to EC2
needs: build-and-push
runs-on: ubuntu-latest

steps:
- name: Stub
run: |
echo "not implemented"
exit 1
15 changes: 0 additions & 15 deletions .github/workflows/test-suite.yml

This file was deleted.

24 changes: 0 additions & 24 deletions .github/workflows/unit-tests.yml

This file was deleted.

Loading