61 lines
1.3 KiB
YAML
61 lines
1.3 KiB
YAML
name: build
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
env:
|
|
REGISTRY: repo.rahamafresh.com
|
|
IMAGE_NAME: fleet-platform
|
|
|
|
jobs:
|
|
lint-test:
|
|
runs-on: docker
|
|
container:
|
|
image: python:3.12-slim
|
|
steps:
|
|
- 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
|