2026-05-22 21:53:42 +00:00
|
|
|
name: build
|
|
|
|
|
|
|
|
|
|
on:
|
|
|
|
|
push:
|
|
|
|
|
branches: [main]
|
|
|
|
|
pull_request:
|
|
|
|
|
branches: [main]
|
2026-05-22 22:06:18 +00:00
|
|
|
workflow_dispatch:
|
2026-05-22 21:53:42 +00:00
|
|
|
|
|
|
|
|
env:
|
|
|
|
|
REGISTRY: repo.rahamafresh.com
|
|
|
|
|
IMAGE_NAME: fleet-platform
|
|
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
lint-test:
|
|
|
|
|
runs-on: docker
|
|
|
|
|
container:
|
|
|
|
|
image: python:3.12-slim
|
|
|
|
|
steps:
|
2026-05-28 22:25:37 +00:00
|
|
|
# python:3.12-slim ships no node/git, but actions/checkout@v4 is a
|
|
|
|
|
# Node action — without this the job dies at checkout with
|
|
|
|
|
# `exec: "node": executable file not found`. Runs before checkout via
|
|
|
|
|
# the container shell (no node needed for a `run` step).
|
|
|
|
|
- name: Provide node + git for JS actions
|
|
|
|
|
run: |
|
|
|
|
|
apt-get update
|
|
|
|
|
apt-get install -y --no-install-recommends git nodejs
|
|
|
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
2026-05-22 21:53:42 +00:00
|
|
|
- uses: actions/checkout@v4
|
|
|
|
|
|
|
|
|
|
- name: Install deps
|
|
|
|
|
run: |
|
|
|
|
|
pip install --upgrade pip
|
|
|
|
|
pip install .[dev]
|
|
|
|
|
|
|
|
|
|
- name: ruff
|
|
|
|
|
run: ruff check .
|
|
|
|
|
|
|
|
|
|
- name: mypy
|
|
|
|
|
run: mypy app
|
|
|
|
|
|
|
|
|
|
- name: pytest
|
|
|
|
|
run: pytest
|
|
|
|
|
|
|
|
|
|
build-push:
|
|
|
|
|
needs: lint-test
|
|
|
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
|
|
|
runs-on: docker
|
|
|
|
|
steps:
|
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
|
|
|
|
|
|
- name: Log in to Forgejo registry
|
|
|
|
|
uses: docker/login-action@v3
|
|
|
|
|
with:
|
|
|
|
|
registry: ${{ env.REGISTRY }}
|
|
|
|
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
|
|
|
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
|
|
|
|
|
|
- name: Build and push
|
|
|
|
|
uses: docker/build-push-action@v6
|
|
|
|
|
with:
|
|
|
|
|
context: .
|
|
|
|
|
push: true
|
|
|
|
|
build-args: |
|
|
|
|
|
GIT_SHA=${{ github.sha }}
|
|
|
|
|
tags: |
|
|
|
|
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
|
|
|
|
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|