Add Image Format #1070
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: [ '3.10', '3.11', '3.12', '3.13' ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Display Python version | |
run: python --version | |
- name: Install poetry | |
uses: abatilo/actions-poetry@v2 | |
with: | |
poetry-version: '1.8.4' | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'videohashes/go.mod' | |
cache-dependency-path: 'videohashes/go.sum' | |
- name: Install ffmpeg | |
run: | | |
if [ "$RUNNER_OS" == "Linux" ]; then | |
sudo apt-get update && sudo apt-get install -y --no-install-recommends ffmpeg | |
elif [ "$RUNNER_OS" == "Windows" ]; then | |
choco install -q -y ffmpeg | |
elif [ "$RUNNER_OS" == "macOS" ]; then | |
env HOMEBREW_NO_AUTO_UPDATE=1 brew install ffmpeg | |
fi | |
shell: bash | |
- uses: pnpm/action-setup@v3 | |
with: | |
version: 9 | |
- name: Install Node | |
uses: actions/setup-node@v4 | |
with: | |
cache: 'pnpm' | |
node-version: '20' | |
- name: Install Poetry Dependencies | |
run: poetry install | |
- name: Build All | |
run: poetry run poe build_all | |
coverage: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.13' | |
- name: Display Python version | |
run: python --version | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'videohashes/go.mod' | |
cache-dependency-path: 'videohashes/go.sum' | |
- name: Install ffmpeg | |
run: | | |
if [ "$RUNNER_OS" == "Linux" ]; then | |
sudo apt-get update && sudo apt-get install -y --no-install-recommends ffmpeg | |
elif [ "$RUNNER_OS" == "Windows" ]; then | |
choco install -q -y ffmpeg | |
elif [ "$RUNNER_OS" == "macOS" ]; then | |
env HOMEBREW_NO_AUTO_UPDATE=1 brew install ffmpeg | |
fi | |
shell: bash | |
- name: Install poetry | |
uses: abatilo/actions-poetry@v2 | |
with: | |
poetry-version: '1.8.4' | |
- uses: pnpm/action-setup@v3 | |
with: | |
version: 9 | |
- name: Install Node | |
uses: actions/setup-node@v4 | |
with: | |
cache: 'pnpm' | |
node-version: '20' | |
- name: Install Poetry Dependencies | |
run: poetry install | |
- name: Build All | |
run: poetry run poe build_all | |
- name: Run tests | |
run: poetry run pytest --cov | |
- name: Run coverage | |
run: poetry run coverage xml | |
- uses: codecov/codecov-action@v4 | |
with: | |
files: ./coverage.xml | |
name: unittest | |
fail_ci_if_error: true | |
verbose: true | |
token: ${{ secrets.CODECOV_TOKEN }} | |
dockerbuild: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- run: ./docker_build.sh | |
auto-tag: | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main'}} | |
needs: | |
- dockerbuild | |
- build | |
outputs: | |
created-tag: ${{ steps.auto-tag.outputs.tag }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.13' | |
- name: Display Python version | |
run: python --version | |
- name: install poetry | |
uses: abatilo/actions-poetry@v2 | |
with: | |
poetry-version: '1.8.4' | |
- name: create tag from pyproject version on change. | |
id: auto-tag | |
uses: salsify/action-detect-and-tag-new-version@v2 | |
with: | |
version-command: | | |
poetry version -s | |
project-release: | |
needs: | |
- auto-tag | |
if: ${{ needs.auto-tag.outputs.created-tag != '' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Create GitHub release | |
uses: Roang-zero1/github-create-release-action@master | |
with: | |
created_tag: ${{ needs.auto-tag.outputs.created-tag }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
pip-publish: | |
needs: | |
- auto-tag | |
if: ${{ needs.auto-tag.outputs.created-tag != '' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.13' | |
- name: Display Python version | |
run: python --version | |
- name: Install poetry | |
uses: abatilo/actions-poetry@v2 | |
with: | |
poetry-version: '1.8.4' | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'videohashes/go.mod' | |
cache-dependency-path: 'videohashes/go.sum' | |
- name: Install ffmpeg | |
run: | | |
if [ "$RUNNER_OS" == "Linux" ]; then | |
sudo apt-get update && sudo apt-get install -y --no-install-recommends ffmpeg | |
elif [ "$RUNNER_OS" == "Windows" ]; then | |
choco install -q -y ffmpeg | |
elif [ "$RUNNER_OS" == "macOS" ]; then | |
env HOMEBREW_NO_AUTO_UPDATE=1 brew install ffmpeg | |
fi | |
shell: bash | |
- uses: pnpm/action-setup@v3 | |
with: | |
version: 9 | |
- uses: actions/setup-node@v4 | |
with: | |
cache: 'pnpm' | |
node-version: '20' | |
- name: Intall Poetry Dependencies | |
run: poetry install | |
- name: Build All | |
run: poetry run poe build_all | |
- name: Prepare to publish python pips. | |
if: "${{ env.PYPI_TOKEN != '' }}" | |
run: poetry config pypi-token.pypi "$PYPI_TOKEN" | |
env: | |
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | |
- name: publish pip | |
run: poetry publish | |
if: "${{ env.PYPI_TOKEN != '' }}" | |
env: | |
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | |
docker-release: | |
needs: | |
- auto-tag | |
if: ${{ needs.auto-tag.outputs.created-tag != '' }} | |
permissions: | |
packages: write | |
contents: read | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: build and tag | |
run: | | |
export BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') | |
export GIT_HASH=$(git rev-parse --verify HEAD) | |
export repo=theporndatabase | |
export version=$( echo "${{ needs.auto-tag.outputs.created-tag }}" | grep -e '[0-9.]*') | |
docker build . --build-arg "BUILD_DATE=${BUILD_DATE}" --build-arg "GIT_HASH=${GIT_HASH}" --build-arg "PROJECT_VERSION=${version}" -t "ghcr.io/${repo}/namer:${version}" -t "ghcr.io/${repo}/namer:latest" | |
docker push "ghcr.io/${repo}/namer:${version}" | |
docker push "ghcr.io/${repo}/namer:latest" |