Skip to content
This repository was archived by the owner on Aug 2, 2025. It is now read-only.

Refactor: Move API logic to handlers #64

Refactor: Move API logic to handlers

Refactor: Move API logic to handlers #64

Workflow file for this run

name: "Continuous Integration"
on:
push:
pull_request:
jobs:
unit-test:
name: Unit Testing
runs-on: ubuntu-latest
permissions:
contents: write
checks: write
security-events: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Run unit tests
run: |
export PAD_NEW_LINES=false
docker compose -f docker/docker-compose.unit-test.yaml up -d
bun test
- name: Log unit test files
run: |
ls -lah reports/markdown
- name: Publish Test Report
if: always()
run: |
SUMMARY=""
for element in $(ls reports/markdown); do
SUMMARY="$(echo -e "${SUMMARY}\n$(cat "reports/markdown/${element}")")"
done
echo "$SUMMARY" >> $GITHUB_STEP_SUMMARY
build-scan:
name: Build and Security Scan
runs-on: ubuntu-latest
needs: unit-test
permissions:
contents: read
checks: write
security-events: write
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
tags: dockstatapi:ci-${{ github.sha }}
load: true
- name: Start and test container
run: |
docker run --name test-container -d dockstatapi:ci-${{ github.sha }}
sleep 10
docker ps | grep test-container
docker logs test-container
docker stop test-container
- name: Trivy vulnerability scan
uses: aquasecurity/trivy-action@0.28.0
with:
image-ref: "dockstatapi:ci-${{ github.sha }}"
format: "sarif"
output: "trivy-results.sarif"
severity: "HIGH,CRITICAL"
- name: Upload security results
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: "trivy-results.sarif"