@@ -0,0 +1,78 @@
|
||||
---
|
||||
name: Setup Action
|
||||
description: Install requested pipx dependencies, configure the system python, and install poetry and the package dependencies
|
||||
|
||||
inputs:
|
||||
os:
|
||||
default: ubuntu-latest
|
||||
pipx-packages:
|
||||
default: ""
|
||||
poetry-version:
|
||||
default: 2.5
|
||||
python-version:
|
||||
required: true
|
||||
|
||||
env:
|
||||
POETRY_VIRTUALENVS_IN_PROJECT: true
|
||||
POETRY_NO_INTERACTION: 1
|
||||
PIPX_HOME: ~/.local/share/pipx
|
||||
PIPX_BIN_DIR: ~/.local/bin
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Setup Local Variables
|
||||
id: variable-setup
|
||||
run: |
|
||||
echo "pipx-home=$PIPX_HOME" >> $GITHUB_OUTPUT
|
||||
echo "pipx-bin-dir=$PIPX_BIN_DIR" >> $GITHUB_OUTPUT
|
||||
|
||||
export BASE64_PIPX_ID=$(echo -n 'poetry==${{ inputs.poetry-version }} ${{ inputs.pipx-packages }}' | base64)
|
||||
echo "cache-key-pipx=pipx-${{ inputs.os }}-${{ inputs.python-version }}-$BASE64_PIPX_ID" >> $GITHUB_OUTPUT
|
||||
shell: bash
|
||||
|
||||
- name: Cache pipx
|
||||
id: cache-pipx
|
||||
uses: actions/cache@v6
|
||||
with:
|
||||
# https://pypa.github.io/pipx/how-pipx-works
|
||||
path: |
|
||||
~/.local/share/pipx
|
||||
~/.local/bin
|
||||
#path: |
|
||||
# ${{ steps.variable-setup.outputs.pipx-home }}
|
||||
# ${{ steps.variable-setup.outputs.pipx-bin-dir }}
|
||||
key: ${{ steps.variable-setup.outputs.cache-key-pipx }}
|
||||
|
||||
- name: Install Poetry ${{ inputs.poetry-version }} and '${{ inputs.pipx-packages }}'
|
||||
if: ${{ steps.cache-pipx.outputs.cache-hit != 'true' }}
|
||||
run: |
|
||||
for tool in "poetry==${{ inputs.poetry-version }}" ${{ inputs.pipx-packages }}; do
|
||||
pipx install $tool
|
||||
done
|
||||
shell: bash
|
||||
|
||||
- name: Debug pipx
|
||||
run: |
|
||||
pipx ensurepath
|
||||
pipx list
|
||||
shell: bash
|
||||
|
||||
- name: Setup Python ${{ inputs.python-version }}
|
||||
uses: actions/setup-python@v7
|
||||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
cache: poetry
|
||||
|
||||
- name: Poetry Debug Info
|
||||
run: |
|
||||
pipx ensurepath
|
||||
poetry debug info
|
||||
poetry config --list
|
||||
shell: bash
|
||||
|
||||
- name: Install Project and Minimum Subset of Dependencies
|
||||
run: |
|
||||
pipx ensurepath
|
||||
poetry install
|
||||
shell: bash
|
||||
@@ -0,0 +1,42 @@
|
||||
name: test
|
||||
|
||||
on:
|
||||
push:
|
||||
tags: ["*"]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# repo
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v7
|
||||
# python
|
||||
- name: Set up python
|
||||
id: setup-python
|
||||
uses: actions/setup-python@v7
|
||||
with:
|
||||
python-version: "3.14"
|
||||
cache: "pip"
|
||||
# project-manager
|
||||
- name: Install Project Manager
|
||||
run: |
|
||||
pip install project-manager \
|
||||
--index-url https://git.shmyga.ru/api/packages/InfernalGames/pypi/simple/ \
|
||||
--extra-index-url https://pypi.org/simple
|
||||
# setup
|
||||
- name: Setup config
|
||||
run: pm setup:config -vv
|
||||
# build
|
||||
- name: Build docker
|
||||
run: pm build:docker -vv
|
||||
# login docker
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v4
|
||||
with:
|
||||
registry: git.shmyga.ru
|
||||
username: ${{ vars.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
# pubish
|
||||
- name: Publish docker
|
||||
run: pm publish:docker -vv
|
||||
@@ -0,0 +1,17 @@
|
||||
name: test
|
||||
|
||||
on: push
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: ./.gitea/actions/setup
|
||||
with:
|
||||
python-version: "3.14"
|
||||
- name: Run tests
|
||||
run: |
|
||||
source .venv/bin/activate
|
||||
coverage run -m pytest tests/
|
||||
coverage report
|
||||
@@ -1,63 +0,0 @@
|
||||
name: test
|
||||
|
||||
on: push
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
#----------------------------------------------
|
||||
# check-out repo and set-up python
|
||||
#----------------------------------------------
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v7
|
||||
- name: Set up python
|
||||
id: setup-python
|
||||
uses: actions/setup-python@v7
|
||||
with:
|
||||
python-version: "3.14"
|
||||
#----------------------------------------------
|
||||
# install & configure poetry
|
||||
#----------------------------------------------
|
||||
- name: Load cached Poetry installation
|
||||
id: cached-poetry
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: ~/.local # the path depends on the OS
|
||||
key: poetry-1 # increment to reset cache
|
||||
- name: Install Poetry
|
||||
if: steps.cached-poetry.outputs.cache-hit != 'true'
|
||||
uses: snok/install-poetry@v1
|
||||
with:
|
||||
virtualenvs-create: true
|
||||
virtualenvs-in-project: true
|
||||
virtualenvs-path: .venv
|
||||
installer-parallel: true
|
||||
#----------------------------------------------
|
||||
# load cached venv if cache exists
|
||||
#----------------------------------------------
|
||||
- name: Load cached venv
|
||||
id: cached-poetry-dependencies
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: .venv
|
||||
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
|
||||
#----------------------------------------------
|
||||
# install dependencies if cache does not exist
|
||||
#----------------------------------------------
|
||||
- name: Install dependencies
|
||||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
|
||||
run: ~/.local/bin/poetry install --no-interaction --no-root
|
||||
#----------------------------------------------
|
||||
# install your root project, if required
|
||||
#----------------------------------------------
|
||||
- name: Install project
|
||||
run: ~/.local/bin/poetry install --no-interaction
|
||||
#----------------------------------------------
|
||||
# run test suite
|
||||
#----------------------------------------------
|
||||
- name: Run tests
|
||||
run: |
|
||||
source .venv/bin/activate
|
||||
coverage run -m pytest tests/
|
||||
coverage report
|
||||
+2
-1
@@ -39,6 +39,7 @@ COPY --from=builder /app ./
|
||||
COPY --from=node-builder /app/dist ./static/dist
|
||||
|
||||
COPY gallery gallery/
|
||||
COPY --from=builder --parents locales/**/*.mo ./
|
||||
# COPY --from=builder --parents locales/**/*.mo ./
|
||||
COPY --from=builder /app/locales ./locales
|
||||
|
||||
CMD ["uvicorn", "gallery.main:app", "--host", "0.0.0.0", "--port", "80", "--log-config", "gallery/logging.yaml"]
|
||||
|
||||
Reference in New Issue
Block a user