60 lines
1.8 KiB
YAML
60 lines
1.8 KiB
YAML
name: Test, build and push image to registry
|
|
on:
|
|
push:
|
|
|
|
|
|
jobs:
|
|
phpunit-tests:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
RUNNER_TOOL_CACHE: /toolcache
|
|
LLM_API_HOST_URL: "https://chat.matthiasg.dev/ollama"
|
|
LLM_API_TOKEN: "${{ secrets.LLM_API_TOKEN }}"
|
|
LLM_CHAT_MODEL: "deepseek-r1:8b"
|
|
LLM_CHAT_MODEL_THINK: true
|
|
LLM_VISION_MODEL: "llava:7b-v1.6-mistral-q4_1"
|
|
LLM_VISION_MODEL_THINK: false
|
|
steps:
|
|
- name: Check out repository code
|
|
uses: actions/checkout@v4
|
|
- name: Set up PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: '8.3.0'
|
|
- name: Cache Composer
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.composer/cache
|
|
key: composer-${{ hashFiles('**/composer.lock') }}
|
|
restore-keys: |
|
|
composer-
|
|
- name: Install dependencies
|
|
run: composer install --prefer-dist --no-progress --no-suggest --no-interaction
|
|
- name: Run PHPUnit tests
|
|
run: vendor/bin/phpunit --configuration phpunit.xml
|
|
|
|
build-image:
|
|
needs: phpunit-tests
|
|
if: success() && github.ref == 'refs/heads/main'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out repository code
|
|
uses: actions/checkout@v4
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: git.matthiasg.dev
|
|
username: ninluc
|
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
- name: Cache Docker layers (registry-backed)
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: /tmp/.buildx-cache
|
|
key: buildx-cache-${{ github.sha }}
|
|
restore-keys: |
|
|
buildx-cache-
|
|
- name: Build and push
|
|
run: |
|
|
docker build -t git.matthiasg.dev/ninluc/datbrowser:latest .
|
|
docker push git.matthiasg.dev/ninluc/datbrowser:latest
|