-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from 9dogs/minor-refactoring-release
Minor refactoring release
- Loading branch information
Showing
18 changed files
with
1,064 additions
and
1,215 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
name: Lint and test | ||
|
||
on: | ||
pull_request: | ||
branches: ['master'] | ||
push: | ||
branches: ['master'] | ||
tags: [ '*' ] | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Python 3.11 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.11 | ||
|
||
- name: Install poetry | ||
run: pip install poetry | ||
|
||
- name: Install dependencies | ||
run: poetry install --with main,dev | ||
|
||
- name: Run linters | ||
run: make lint | ||
|
||
test: | ||
name: Test | ||
strategy: | ||
matrix: | ||
python-version: ['3.10', '3.11'] | ||
fail-fast: false | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install poetry | ||
run: pip install poetry | ||
|
||
- name: Install dependencies | ||
run: poetry install --with main,dev | ||
|
||
- name: Run tests | ||
run: make test | ||
|
||
publish: | ||
runs-on: ubuntu-latest | ||
if: github.ref_type == 'tag' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Python 3.11 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.11 | ||
|
||
- name: Install poetry | ||
run: pip install poetry | ||
|
||
- name: Publish to PyPI | ||
run: poetry publish --build | ||
env: | ||
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }} | ||
|
||
- name: Login to DockerHub | ||
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin | ||
|
||
- name: Build and push Docker image | ||
run: | | ||
docker build -t ${{ secrets.DOCKER_USERNAME }}/tg-odesli-bot:${{ github.ref }} . | ||
docker push ${{ secrets.DOCKER_USERNAME }}/tg-odesli-bot:${{ github.ref }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
FROM python:3.10.5-bullseye AS builder | ||
FROM python:3.11.7-bookworm AS builder | ||
|
||
LABEL maintainer="[email protected]" | ||
LABEL description="Telegram Bot to share music with Odesli (former Songlink) service." | ||
|
||
ENV PYTHONDONTWRITEBYTECODE 1 | ||
ENV PYTHONUNBUFFERED 1 | ||
|
||
ARG poetry_args='--no-dev' | ||
ARG poetry_args='--without dev' | ||
|
||
# Install & config poetry | ||
RUN pip install poetry \ | ||
|
@@ -22,7 +22,7 @@ COPY . /opt/tg-odesli-bot | |
ENV PYTHONPATH "${PYTHONPATH}:/opt/tg-odesli-bot" | ||
|
||
|
||
FROM python:3.10.5-slim-bullseye | ||
FROM python:3.11.7-slim-bookworm | ||
|
||
ARG UID=997 | ||
ARG GID=997 | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
services: | ||
bot: | ||
build: | ||
context: . | ||
target: builder | ||
args: | ||
poetry_args: "--with main,dev" | ||
command: ["/opt/tg-odesli-bot/.venv/bin/python", "-m", "tg_odesli_bot.bot"] | ||
volumes: | ||
- /opt/tg-odesli-bot/.venv | ||
- .:/opt/tg-odesli-bot |
Oops, something went wrong.