hostr/.forgejo/workflows/ci.yml

58 lines
1.8 KiB
YAML
Raw Normal View History

2025-06-13 09:32:37 +01:00
name: ci
on:
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened]
jobs:
build-image:
runs-on: self-hosted
steps:
- name: Set current date as env variable
run: echo "NOW=$(date +'%Y%m%d-%H%M%S')" >> $GITHUB_ENV
- name: Fix for bad os check
run: echo "RUNNER_OS=Linux" >> $GITHUB_ENV
2025-06-15 19:03:03 +01:00
- name: Login to Docker Hub
uses: https://cremin.dev/actions/docker-login@v3
2025-06-13 09:32:37 +01:00
with:
registry: cremin.dev
username: ${{ github.actor }}
password: ${{ secrets.FORGEJO_REGISTRY_TOKEN }}
- name: Check out repository
uses: https://cremin.dev/actions/checkout@v4
2025-06-15 19:03:03 +01:00
- name: Set up Docker Buildx
uses: https://cremin.dev/actions/docker-setup-buildx@v3
- name: Build and push
uses: https://cremin.dev/actions/docker-build-push@v6
2025-06-13 09:32:37 +01:00
with:
2025-06-15 19:03:03 +01:00
file: ./Containerfile
2025-06-13 09:32:37 +01:00
context: ./
2025-06-15 19:03:03 +01:00
tags: cremin.dev/jonathan/hostr:latest,cremin.dev/jonathan/hostr:${{ github.sha }}
push: true
2025-06-13 09:32:37 +01:00
test-image:
2025-06-15 19:03:03 +01:00
runs-on: node22
2025-06-13 09:32:37 +01:00
needs: build-image
2025-06-13 09:41:37 +01:00
services:
database:
image: postgres:14-alpine
env:
POSTGRES_PASSWORD: hostr
POSTGRES_USER: hostr
POSTGRES_DB: hostr
redis:
image: redis:4.0.2-alpine
minio:
image: minio/minio
env:
MINIO_ACCESS_KEY: 7HYV3KPRGQ8Z5YCDNWC6
MINIO_SECRET_KEY: 0kWP/ZkgIwQzgL9t4SGv9Uc93rO//OdyqMH329b/
cmd: ["server", "/export"]
2025-06-13 09:32:37 +01:00
steps:
- name: Check out repository
uses: https://cremin.dev/actions/checkout@v4
- name: Test image
run: |
2025-06-15 19:03:03 +01:00
docker run --env-file ./.forgejo/workflows/.env --rm -it cremin.dev/jonathan/hostr:${{ github.sha }} yarn test