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
20 changes: 20 additions & 0 deletions .github/archive-workflows/test-authsvc-docker-push-action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,26 @@ jobs:
- name: Create Custom Docker Network
run: docker network create authsvc-net

- name: Cache Docker Image Archive
id: image-cache
uses: actions/cache@v6
with:
path: /tmp/docker-images
key: ${{ runner.os }}-docker-postgres-18

# Step 2: If cache is found, load the image into the Docker daemon local registry
- name: Load Cached Docker Image
if: steps.image-cache.outputs.cache-hit == 'true'
run: docker load --input /tmp/docker-images/postgres.tar

# Step 3: If cache is missed, pull the fresh image and archive it for the "Save" step
- name: Pull and Archive Docker Image
if: steps.image-cache.outputs.cache-hit != 'true'
run: |
mkdir -p /tmp/docker-images
docker pull postgres:18
docker save --output /tmp/docker-images/postgres.tar postgres:18

- name: Start PostgreSQL Container
run: >
docker run -d --rm --name db-authsvc --network authsvc-net
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/test-authsvc-container-jobs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: "integration tests for authsvc Using Container Job"
on:
push

jobs:
authsvc-test:
runs-on: ubuntu-latest
container:
image: oven/bun:1.4
env:
NODE_ENV: test
volumes:
- docker_images:/temp/docker_images

environment: test
defaults:
run:
working-directory: ./auth-svc
services:
db-authsvc:
image: postgres:18
env:
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD}}
POSTGRES_USER: ${{ secrets.POSTGRES_USER}}
POSTGRES_DB: ${{ secrets.POSTGRES_DB}}
options: >-
--health-cmd pg_isready
--health-interval 4s
--health-timeout 2s
--health-retries 2
steps:
- name: Check out repository code
uses: actions/checkout@v6


- name: Install Deps
run: bun install --frozen-lockfile

- name: Migrate DataBase
run: bun run drizzlekit-dev migrate
env:
DOTENV_PRIVATE_KEY_DEVELOPMENT: ${{ secrets.DOTENV_PRIVATE_KEY_DEVELOPMENT }}
- name: Run Tests
run: bun run test
env:
DOTENV_PRIVATE_KEY_DEVELOPMENT: ${{ secrets.DOTENV_PRIVATE_KEY_DEVELOPMENT }}



2 changes: 1 addition & 1 deletion auth-svc/dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM oven/bun:1.3-alpine AS base
FROM oven/bun:1.4-alpine AS base
RUN mkdir -p /usr/auth-svc
WORKDIR /usr/auth-svc

Expand Down