ci: update actions to v7/v6, add pip caching, optimize Dockerfile layer order

This commit is contained in:
Artem Akymenko
2026-07-08 16:22:52 +03:00
parent 50fa2e5b9e
commit 29681a5fbb
3 changed files with 98 additions and 98 deletions
+33 -33
View File
@@ -1,33 +1,33 @@
name: pip install name: pip install
run-name: pip install run-name: pip install
on: on:
push: push:
paths: paths:
- '**.py' - '**.py'
- 'pyproject.toml' - 'pyproject.toml'
pull_request: pull_request:
paths: paths:
- '**.py' - '**.py'
- 'pyproject.toml' - 'pyproject.toml'
- '.github/workflows/**' - '.github/workflows/**'
workflow_dispatch: workflow_dispatch:
jobs: jobs:
install-and-run: install-and-run:
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest, macos-latest, windows-latest] os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.12'] python-version: ['3.12']
fail-fast: false fail-fast: false
continue-on-error: true runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.os }} steps:
steps: - name: Checkout repository
- name: Checkout repository uses: actions/checkout@v7
uses: actions/checkout@v4 - name: Set up Python
- name: Set up Python uses: actions/setup-python@v6
uses: actions/setup-python@v5 with:
with: python-version: ${{ matrix.python-version }}
python-version: ${{ matrix.python-version }} cache: pip
- name: Install from repository - name: Install from repository
run: python -m pip install . run: python -m pip install .
#- name: Run abogen #- name: Run abogen
# run: abogen # run: abogen
+63 -63
View File
@@ -1,63 +1,63 @@
name: Build multi-arch Docker Image name: Build multi-arch Docker Image
on: on:
# Build and push # Build and push
#release: #release:
# types: [published] # types: [published]
# Build only # Build only
#push: it #push: it
# branches: [main] # branches: [main]
# TODO - enable build on pull requests if build times can be reduced # TODO - enable build on pull requests if build times can be reduced
# pull_request: # pull_request:
workflow_dispatch: workflow_dispatch:
env: env:
IMAGE_REPOSITORY: ghcr.io/denizsafak/abogen IMAGE_REPOSITORY: ghcr.io/denizsafak/abogen
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v7
- name: Login to Github Container Registry - name: Login to Github Container Registry
# Only if we need to push an image # Only if we need to push an image
# if: ${{ github.event_name == 'release' && github.event.action == 'published' }} # if: ${{ github.event_name == 'release' && github.event.action == 'published' }}
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
# Setup for buildx # Setup for buildx
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v3 uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx - name: Set up Docker Buildx
id: buildx id: buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
# Debugging information # Debugging information
- name: Docker info - name: Docker info
run: docker info run: docker info
- name: Buildx inspect - name: Buildx inspect
run: docker buildx inspect run: docker buildx inspect
# Build and (optionally) push the image # Build and (optionally) push the image
- name: Build image - name: Build image
uses: docker/build-push-action@v6 uses: docker/build-push-action@v6
with: with:
context: ./abogen context: ./abogen
file: ./abogen/Dockerfile file: ./abogen/Dockerfile
# platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x # platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x
# platforms: linux/amd64,linux/arm64 # platforms: linux/amd64,linux/arm64
platforms: linux/amd64 # using the solution mentioned in https://github.com/denizsafak/abogen/issues/46 platforms: linux/amd64 # using the solution mentioned in https://github.com/denizsafak/abogen/issues/46
# Only push if we are publishing a release # Only push if we are publishing a release
# push: ${{ github.event_name == 'release' && github.event.action == 'published' }} # push: ${{ github.event_name == 'release' && github.event.action == 'published' }}
push: true push: true
# Use a 'temp' tag, that won't be pushed, for non-release builds # Use a 'temp' tag, that won't be pushed, for non-release builds
tags: ${{ env.IMAGE_REPOSITORY }}:${{ github.event.release.tag_name || 'latest' }} tags: ${{ env.IMAGE_REPOSITORY }}:${{ github.event.release.tag_name || 'latest' }}
# Use a cache to reduce build times # Use a cache to reduce build times
cache-to: type=gha,mode=max cache-to: type=gha,mode=max
cache-from: type=gha cache-from: type=gha
+2 -2
View File
@@ -27,8 +27,6 @@ RUN python3 -m venv "$VIRTUAL_ENV"
WORKDIR /app WORKDIR /app
COPY pyproject.toml README.md ./ COPY pyproject.toml README.md ./
COPY abogen ./abogen
RUN pip install --upgrade pip \ RUN pip install --upgrade pip \
&& if [ -n "$TORCH_VERSION" ]; then \ && if [ -n "$TORCH_VERSION" ]; then \
pip install torch=="$TORCH_VERSION" torchvision=="$TORCH_VERSION" torchaudio=="$TORCH_VERSION" --index-url "$TORCH_INDEX_URL"; \ pip install torch=="$TORCH_VERSION" torchvision=="$TORCH_VERSION" torchaudio=="$TORCH_VERSION" --index-url "$TORCH_INDEX_URL"; \
@@ -39,6 +37,8 @@ RUN pip install --upgrade pip \
https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.8.0/en_core_web_sm-3.8.0-py3-none-any.whl \ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.8.0/en_core_web_sm-3.8.0-py3-none-any.whl \
&& pip install --no-cache-dir "mutagen>=1.47.0" && pip install --no-cache-dir "mutagen>=1.47.0"
COPY abogen ./abogen
# Install onnxruntime-gpu for CUDA acceleration (supertonic uses ONNX Runtime) # Install onnxruntime-gpu for CUDA acceleration (supertonic uses ONNX Runtime)
# Set USE_GPU=false to skip this for CPU-only deployments # Set USE_GPU=false to skip this for CPU-only deployments
RUN if [ "$USE_GPU" = "true" ]; then \ RUN if [ "$USE_GPU" = "true" ]; then \