feat: Add centralized logging with timestamp support #7
This file contains hidden or 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: Test and build | |
on: | |
push: | |
pull_request: | |
permissions: | |
contents: read | |
packages: write | |
jobs: | |
test: | |
name: 🔍 Lint and Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: 📥 Checkout code | |
uses: actions/checkout@v4 | |
- name: 🏗️ Setup Bun | |
uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: 1.2 | |
- name: 📦 Install dependencies | |
run: bun install | |
- name: 🔍 Run linting | |
run: bun run lint | |
- name: 🔍 Run typechecking | |
run: bun run typecheck | |
- name: 🗄️ Start InfluxDB containers | |
run: docker compose -f docker-compose.dev.yaml up -d influxdb1 influxdb2 | |
- name: ⏳ Wait for InfluxDB to be ready | |
run: | | |
timeout 30s bash -c 'until curl -s http://localhost:18086/ping > /dev/null; do sleep 1; done' | |
timeout 30s bash -c 'until curl -s http://localhost:18087/ping > /dev/null; do sleep 1; done' | |
- name: 🧪 Run tests | |
run: bun test | |
- name: 🧹 Cleanup InfluxDB containers | |
if: always() | |
run: docker compose -f docker-compose.dev.yaml down | |
build_docker: | |
name: 🐳 Build Docker Image | |
if: ${{ github.ref == 'refs/heads/main' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: 📥 Checkout code | |
uses: actions/checkout@v4 | |
- name: 🔑 Log in to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: 🏗️📦 Build and push Docker image (latest) | |
# Repository name must be lowercase | |
run: | | |
REPO=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]') | |
docker buildx create --use | |
docker buildx build --platform linux/amd64,linux/arm64 . \ | |
-t ghcr.io/${REPO}:latest \ | |
--push |