diff --git a/.github/workflows/earthly_project_check.yml b/.github/workflows/earthly_project_check.yml index 91206bc..f4e7d54 100644 --- a/.github/workflows/earthly_project_check.yml +++ b/.github/workflows/earthly_project_check.yml @@ -1,6 +1,5 @@ name: run_earthly_checks - on: [push, pull_request] jobs: @@ -9,53 +8,52 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - python-version: ['3.12'] + python-version: ["3.12"] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v4 - -# In conflict with pyre-check -# - name: Set up Python ${{ matrix.python-version }} -# uses: actions/setup-python@v4 -# with: -# python-version: ${{ matrix.python-version }} -# -# - name: Cache burny_common .venv -# uses: actions/cache@v3 -# with: -# path: burny_common/.venv -# key: burny_common-${{ matrix.os }}-${{ steps.setup-python.outputs.python-version }}-poetry-${{ hashFiles('poetry.lock') }} -# -# - name: Cache discord_bot .venv -# uses: actions/cache@v3 -# with: -# path: discord_bot/.venv -# key: discord_bot-${{ matrix.os }}-${{ steps.setup-python.outputs.python-version }}-poetry-${{ hashFiles('poetry.lock') }} -# -# - name: Cache fastapi_server .venv -# uses: actions/cache@v3 -# with: -# path: fastapi_server/.venv -# key: fastapi_server-${{ matrix.os }}-${{ steps.setup-python.outputs.python-version }}-poetry-${{ hashFiles('poetry.lock') }} -# -# - name: Cache python_examples .venv -# uses: actions/cache@v3 -# with: -# path: python_examples/.venv -# key: python_examples-${{ matrix.os }}-${{ steps.setup-python.outputs.python-version }}-poetry-${{ hashFiles('poetry.lock') }} - - # https://earthly.dev/get-earthly - - name: Install Earthly - run: sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/latest/download/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly && /usr/local/bin/earthly bootstrap --with-autocomplete' - - - name: Install - run: | - touch discord_bot/SECRETS.toml - earthly +install-all --verbose true --PYTHONVERSION=${{ matrix.python-version }} - - - name: Run code checks and tests - run: earthly +all --verbose true --PYTHONVERSION=${{ matrix.python-version }} - + - uses: actions/checkout@v4 + + # In conflict with pyre-check + # - name: Set up Python ${{ matrix.python-version }} + # uses: actions/setup-python@v4 + # with: + # python-version: ${{ matrix.python-version }} + # + # - name: Cache burny_common .venv + # uses: actions/cache@v3 + # with: + # path: burny_common/.venv + # key: burny_common-${{ matrix.os }}-${{ steps.setup-python.outputs.python-version }}-poetry-${{ hashFiles('poetry.lock') }} + # + # - name: Cache discord_bot .venv + # uses: actions/cache@v3 + # with: + # path: discord_bot/.venv + # key: discord_bot-${{ matrix.os }}-${{ steps.setup-python.outputs.python-version }}-poetry-${{ hashFiles('poetry.lock') }} + # + # - name: Cache fastapi_server .venv + # uses: actions/cache@v3 + # with: + # path: fastapi_server/.venv + # key: fastapi_server-${{ matrix.os }}-${{ steps.setup-python.outputs.python-version }}-poetry-${{ hashFiles('poetry.lock') }} + # + # - name: Cache python_examples .venv + # uses: actions/cache@v3 + # with: + # path: python_examples/.venv + # key: python_examples-${{ matrix.os }}-${{ steps.setup-python.outputs.python-version }}-poetry-${{ hashFiles('poetry.lock') }} + + # https://earthly.dev/get-earthly + - name: Install Earthly + run: sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/latest/download/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly && /usr/local/bin/earthly bootstrap --with-autocomplete' + + - name: Install + run: | + touch discord_bot/SECRETS.toml + earthly +install-all --verbose true --PYTHONVERSION=${{ matrix.python-version }} + + - name: Run code checks and tests + run: earthly +all --verbose true --PYTHONVERSION=${{ matrix.python-version }} # - name: Save cache # run: earthly +export-cache-backend --verbose true --PYTHONVERSION=${{ matrix.python-version }} diff --git a/.github/workflows/publish_burny_common.yml b/.github/workflows/publish_burny_common.yml index 11ccf35..1641973 100644 --- a/.github/workflows/publish_burny_common.yml +++ b/.github/workflows/publish_burny_common.yml @@ -1,15 +1,14 @@ name: publish_burny_common - on: push: paths: - - burny_common/** - - .github/workflows/publish_burny_common.yml + - burny_common/** + - .github/workflows/publish_burny_common.yml pull_request: branches: - - master - - develop + - master + - develop env: SUBDIRECTORY: burny_common @@ -21,81 +20,81 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - python-version: ['3.9', '3.10', '3.11', '3.12'] + python-version: ["3.9", "3.10", "3.11", "3.12"] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v4 - -# In conflict with pyre-check -# - name: Set up Python ${{ matrix.python-version }} -# uses: actions/setup-python@v4 -# with: -# python-version: ${{ matrix.python-version }} -# -# - name: Cache .venv -# uses: actions/cache@v3 -# with: -# path: .venv -# key: ${{ env.SUBDIRECTORY }}-${{ matrix.os }}-${{ steps.setup-python.outputs.python-version }}-poetry-${{ hashFiles('poetry.lock') }} - - # https://earthly.dev/get-earthly - - name: Install Earthly - run: sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/latest/download/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly && /usr/local/bin/earthly bootstrap --with-autocomplete' - - - name: Install - working-directory: ${{ env.SUBDIRECTORY }} - run: earthly +install-dev --verbose true --PYTHONVERSION=${{ matrix.python-version }} - - - name: Run code checks and tests - working-directory: ${{ env.SUBDIRECTORY }} - run: earthly +all --verbose true --PYTHONVERSION=${{ matrix.python-version }} - -# - name: Save cache -# working-directory: ${{ env.SUBDIRECTORY }} -# run: earthly +export-cache --verbose true --PYTHONVERSION=${{ matrix.python-version }} + - uses: actions/checkout@v4 + + # In conflict with pyre-check + # - name: Set up Python ${{ matrix.python-version }} + # uses: actions/setup-python@v4 + # with: + # python-version: ${{ matrix.python-version }} + # + # - name: Cache .venv + # uses: actions/cache@v3 + # with: + # path: .venv + # key: ${{ env.SUBDIRECTORY }}-${{ matrix.os }}-${{ steps.setup-python.outputs.python-version }}-poetry-${{ hashFiles('poetry.lock') }} + + # https://earthly.dev/get-earthly + - name: Install Earthly + run: sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/latest/download/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly && /usr/local/bin/earthly bootstrap --with-autocomplete' + + - name: Install + working-directory: ${{ env.SUBDIRECTORY }} + run: earthly +install-dev --verbose true --PYTHONVERSION=${{ matrix.python-version }} + + - name: Run code checks and tests + working-directory: ${{ env.SUBDIRECTORY }} + run: earthly +all --verbose true --PYTHONVERSION=${{ matrix.python-version }} + + # - name: Save cache + # working-directory: ${{ env.SUBDIRECTORY }} + # run: earthly +export-cache --verbose true --PYTHONVERSION=${{ matrix.python-version }} build_and_publish: strategy: fail-fast: false matrix: os: [ubuntu-latest] - python-version: ['3.12'] + python-version: ["3.12"] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v4 - - - name: Set up Python ${{ matrix.python-version }} - id: setup-python - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - - name: Install uv - run: pip install uv - - - name: Install packages - working-directory: ${{ env.SUBDIRECTORY }} - run: uv sync --frozen --no-cache --no-install-project - - - name: Build project - working-directory: ${{ env.SUBDIRECTORY }} - run: uv build - - - id: wait-for-jobs - uses: yogeshlonkar/wait-for-jobs@v0 - with: - gh-token: ${{ secrets.GITHUB_TOKEN }} - jobs: | - run_code_check_py3.9 - run_code_check_py3.10 - run_code_check_py3.11 - run_code_check_py3.12 - - # Publish package on pypi - - name: Publish - if: github.ref == 'refs/heads/develop' && github.event_name == 'push' - working-directory: ${{ env.SUBDIRECTORY }} - continue-on-error: true - run: uv publish --token ${{ secrets.pypi_burny_common_token }} + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + id: setup-python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install uv + run: pip install uv + + - name: Install packages + working-directory: ${{ env.SUBDIRECTORY }} + run: uv sync --frozen --no-cache --no-install-project + + - name: Build project + working-directory: ${{ env.SUBDIRECTORY }} + run: uv build + + - id: wait-for-jobs + uses: yogeshlonkar/wait-for-jobs@v0 + with: + gh-token: ${{ secrets.GITHUB_TOKEN }} + jobs: | + run_code_check_py3.9 + run_code_check_py3.10 + run_code_check_py3.11 + run_code_check_py3.12 + + # Publish package on pypi + - name: Publish + if: github.ref == 'refs/heads/develop' && github.event_name == 'push' + working-directory: ${{ env.SUBDIRECTORY }} + continue-on-error: true + run: uv publish --token ${{ secrets.pypi_burny_common_token }} diff --git a/.github/workflows/python_examples.yml b/.github/workflows/python_examples.yml index cf945f8..7dc9799 100644 --- a/.github/workflows/python_examples.yml +++ b/.github/workflows/python_examples.yml @@ -1,16 +1,15 @@ name: run_python_examples - on: push: paths: - - python_examples/** - - poetry.lock - - .github/workflows/python_examples.yml + - python_examples/** + - poetry.lock + - .github/workflows/python_examples.yml pull_request: branches: - - master - - develop + - master + - develop env: SUBDIRECTORY: python_examples @@ -21,47 +20,47 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - python-version: ['3.12'] + python-version: ["3.12"] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v4 - -# In conflict with pyre-check -# - name: Set up Python ${{ matrix.python-version }} -# uses: actions/setup-python@v4 -# with: -# python-version: ${{ matrix.python-version }} -# -# - name: Cache .venv -# uses: actions/cache@v3 -# with: -# path: .venv -# key: ${{ env.SUBDIRECTORY }}-${{ matrix.os }}-${{ steps.setup-python.outputs.python-version }}-poetry-${{ hashFiles('poetry.lock') }} - - - name: Start MongoDB - uses: ankane/setup-mongodb@v1 - - - name: Start Postgres - uses: ankane/setup-postgres@v1 - with: - postgres-version: 14 - - # https://earthly.dev/get-earthly - - name: Install Earthly - run: sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/latest/download/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly && /usr/local/bin/earthly bootstrap --with-autocomplete' - - - name: Install - working-directory: ${{ env.SUBDIRECTORY }} - run: earthly +install-dev --verbose true --PYTHONVERSION=${{ matrix.python-version }} - - - name: Run code checks and tests - working-directory: ${{ env.SUBDIRECTORY }} - run: earthly +all --verbose true --PYTHONVERSION=${{ matrix.python-version }} - -# - name: Save cache -# working-directory: ${{ env.SUBDIRECTORY }} -# run: earthly +export-cache --verbose true --PYTHONVERSION=${{ matrix.python-version }} + - uses: actions/checkout@v4 + + # In conflict with pyre-check + # - name: Set up Python ${{ matrix.python-version }} + # uses: actions/setup-python@v4 + # with: + # python-version: ${{ matrix.python-version }} + # + # - name: Cache .venv + # uses: actions/cache@v3 + # with: + # path: .venv + # key: ${{ env.SUBDIRECTORY }}-${{ matrix.os }}-${{ steps.setup-python.outputs.python-version }}-poetry-${{ hashFiles('poetry.lock') }} + + - name: Start MongoDB + uses: ankane/setup-mongodb@v1 + + - name: Start Postgres + uses: ankane/setup-postgres@v1 + with: + postgres-version: 14 + + # https://earthly.dev/get-earthly + - name: Install Earthly + run: sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/latest/download/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly && /usr/local/bin/earthly bootstrap --with-autocomplete' + + - name: Install + working-directory: ${{ env.SUBDIRECTORY }} + run: earthly +install-dev --verbose true --PYTHONVERSION=${{ matrix.python-version }} + + - name: Run code checks and tests + working-directory: ${{ env.SUBDIRECTORY }} + run: earthly +all --verbose true --PYTHONVERSION=${{ matrix.python-version }} + + # - name: Save cache + # working-directory: ${{ env.SUBDIRECTORY }} + # run: earthly +export-cache --verbose true --PYTHONVERSION=${{ matrix.python-version }} run_python_examples: needs: [run_code_check] @@ -69,97 +68,97 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - python-version: ['3.11', '3.12'] + python-version: ["3.11", "3.12"] include: - - os: macos-latest - python-version: '3.12' - - os: windows-latest - python-version: '3.11' + - os: macos-latest + python-version: "3.12" + - os: windows-latest + python-version: "3.11" runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v4 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - - name: Install Poetry - run: pip install poetry --no-cache-dir - - - name: Make poetry use local .venv folder - run: poetry config virtualenvs.in-project true - - - name: Set up cache - if: matrix.os != 'windows-latest' - uses: actions/cache@v3 - with: - path: ${{ env.SUBDIRECTORY }}.venv - key: ${{ matrix.os }}-$(python --version)-poetry-${{ env.SUBDIRECTORY }}-${{ hashFiles('poetry.lock') }} - - - name: Start MongoDB - uses: ankane/setup-mongodb@v1 -# with: -# mongodb-version: 5.0 - -# - name: Start MongoDB in docker -# if: ${{ matrix.os != 'macos-latest'}} -# run: | -# docker run --rm -d -p 27017-27019:27017-27019 --name mongodb mongo:5.0 - - - name: Start Postgres - uses: ankane/setup-postgres@v1 - with: - postgres-version: 14 - -# - name: Start Postgres in docker -# if: ${{ matrix.os == 'ubuntu-latest'}} -# run: | -# docker run --rm -d --name postgresql-container -p 5432:5432 \ -# -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=changeme postgres:9.6.23-alpine3.14 - - - name: Print environment variables (linux) - run: | - printenv - - - name: Install Python dependencies - working-directory: ${{ env.SUBDIRECTORY }} - run: poetry install - - - name: Run Python tests - working-directory: ${{ env.SUBDIRECTORY }} - run: poetry run python -m pytest - - - name: Run main.py - working-directory: ${{ env.SUBDIRECTORY }} - run: poetry run python main.py - - - name: Run database readme example - dataset - working-directory: ${{ env.SUBDIRECTORY }} - run: poetry run python examples/databases/readme_dataset_example.py - - - name: Run database readme example - peewee - working-directory: ${{ env.SUBDIRECTORY }} - run: poetry run python examples/databases/readme_peewee_example.py - - - name: Set up prisma db - working-directory: ${{ env.SUBDIRECTORY }} - run: poetry run prisma db push --schema examples/databases/prisma/schema.prisma - - - name: Run database readme example - prisma - working-directory: ${{ env.SUBDIRECTORY }} - run: poetry run python examples/databases/readme_prisma_example.py - - - name: Run database readme example - sqlalchemy - working-directory: ${{ env.SUBDIRECTORY }} - run: poetry run python examples/databases/readme_sqlalchemy_example.py - - - name: Run database readme example - sqlite - working-directory: ${{ env.SUBDIRECTORY }} - run: poetry run python examples/databases/readme_sqlite_example.py - - - name: Run database readme example - tinydb - working-directory: ${{ env.SUBDIRECTORY }} - run: poetry run python examples/databases/readme_tinydb_example.py + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install Poetry + run: pip install poetry --no-cache-dir + + - name: Make poetry use local .venv folder + run: poetry config virtualenvs.in-project true + + - name: Set up cache + if: matrix.os != 'windows-latest' + uses: actions/cache@v3 + with: + path: ${{ env.SUBDIRECTORY }}.venv + key: ${{ matrix.os }}-$(python --version)-poetry-${{ env.SUBDIRECTORY }}-${{ hashFiles('poetry.lock') }} + + - name: Start MongoDB + uses: ankane/setup-mongodb@v1 + # with: + # mongodb-version: 5.0 + + # - name: Start MongoDB in docker + # if: ${{ matrix.os != 'macos-latest'}} + # run: | + # docker run --rm -d -p 27017-27019:27017-27019 --name mongodb mongo:5.0 + + - name: Start Postgres + uses: ankane/setup-postgres@v1 + with: + postgres-version: 14 + + # - name: Start Postgres in docker + # if: ${{ matrix.os == 'ubuntu-latest'}} + # run: | + # docker run --rm -d --name postgresql-container -p 5432:5432 \ + # -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=changeme postgres:9.6.23-alpine3.14 + + - name: Print environment variables (linux) + run: | + printenv + + - name: Install Python dependencies + working-directory: ${{ env.SUBDIRECTORY }} + run: poetry install + + - name: Run Python tests + working-directory: ${{ env.SUBDIRECTORY }} + run: poetry run python -m pytest + + - name: Run main.py + working-directory: ${{ env.SUBDIRECTORY }} + run: poetry run python main.py + + - name: Run database readme example - dataset + working-directory: ${{ env.SUBDIRECTORY }} + run: poetry run python examples/databases/readme_dataset_example.py + + - name: Run database readme example - peewee + working-directory: ${{ env.SUBDIRECTORY }} + run: poetry run python examples/databases/readme_peewee_example.py + + - name: Set up prisma db + working-directory: ${{ env.SUBDIRECTORY }} + run: poetry run prisma db push --schema examples/databases/prisma/schema.prisma + + - name: Run database readme example - prisma + working-directory: ${{ env.SUBDIRECTORY }} + run: poetry run python examples/databases/readme_prisma_example.py + + - name: Run database readme example - sqlalchemy + working-directory: ${{ env.SUBDIRECTORY }} + run: poetry run python examples/databases/readme_sqlalchemy_example.py + + - name: Run database readme example - sqlite + working-directory: ${{ env.SUBDIRECTORY }} + run: poetry run python examples/databases/readme_sqlite_example.py + + - name: Run database readme example - tinydb + working-directory: ${{ env.SUBDIRECTORY }} + run: poetry run python examples/databases/readme_tinydb_example.py diff --git a/.github/workflows/test_discord_bot.yml b/.github/workflows/test_discord_bot.yml index fa8d645..15d16b6 100644 --- a/.github/workflows/test_discord_bot.yml +++ b/.github/workflows/test_discord_bot.yml @@ -3,12 +3,12 @@ name: test_discord_bot on: push: paths: - - discord_bot/** - - .github/workflows/test_discord_bot.yml + - discord_bot/** + - .github/workflows/test_discord_bot.yml pull_request: branches: - - master - - develop + - master + - develop env: SUBDIRECTORY: discord_bot @@ -20,37 +20,37 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - python-version: ['3.10', '3.11', '3.12'] + python-version: ["3.10", "3.11", "3.12"] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v4 - - # In conflict with pyre-check - # - name: Set up Python ${{ matrix.python-version }} - # uses: actions/setup-python@v4 - # with: - # python-version: ${{ matrix.python-version }} - # - # - name: Cache .venv - # uses: actions/cache@v3 - # with: - # path: .venv - # key: ${{ env.SUBDIRECTORY }}-${{ matrix.os }}-${{ steps.setup-python.outputs.python-version }}-poetry-${{ hashFiles('poetry.lock') }} - - # https://earthly.dev/get-earthly - - name: Install Earthly - run: sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/latest/download/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly && /usr/local/bin/earthly bootstrap --with-autocomplete' - - - name: Install - working-directory: ${{ env.SUBDIRECTORY }} - run: | - touch SECRETS.toml - earthly +install-dev --verbose true --PYTHONVERSION=${{ matrix.python-version }} - - - name: Run code checks and tests - working-directory: ${{ env.SUBDIRECTORY }} - run: earthly +all --verbose true --PYTHONVERSION=${{ matrix.python-version }} + - uses: actions/checkout@v4 + + # In conflict with pyre-check + # - name: Set up Python ${{ matrix.python-version }} + # uses: actions/setup-python@v4 + # with: + # python-version: ${{ matrix.python-version }} + # + # - name: Cache .venv + # uses: actions/cache@v3 + # with: + # path: .venv + # key: ${{ env.SUBDIRECTORY }}-${{ matrix.os }}-${{ steps.setup-python.outputs.python-version }}-poetry-${{ hashFiles('poetry.lock') }} + + # https://earthly.dev/get-earthly + - name: Install Earthly + run: sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/latest/download/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly && /usr/local/bin/earthly bootstrap --with-autocomplete' + + - name: Install + working-directory: ${{ env.SUBDIRECTORY }} + run: | + touch SECRETS.toml + earthly +install-dev --verbose true --PYTHONVERSION=${{ matrix.python-version }} + + - name: Run code checks and tests + working-directory: ${{ env.SUBDIRECTORY }} + run: earthly +all --verbose true --PYTHONVERSION=${{ matrix.python-version }} # - name: Save cache # working-directory: ${{ env.SUBDIRECTORY }} diff --git a/.github/workflows/test_fastapi_server.yml b/.github/workflows/test_fastapi_server.yml index 7221b7a..3d12a03 100644 --- a/.github/workflows/test_fastapi_server.yml +++ b/.github/workflows/test_fastapi_server.yml @@ -1,15 +1,14 @@ name: test_fastapi_server - on: push: paths: - - fastapi_server/** - - .github/workflows/test_fastapi_server.yml + - fastapi_server/** + - .github/workflows/test_fastapi_server.yml pull_request: branches: - - master - - develop + - master + - develop env: SUBDIRECTORY: fastapi_server @@ -21,24 +20,24 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - python-version: ['3.10', '3.11', '3.12'] + python-version: ["3.10", "3.11", "3.12"] runs-on: ${{ matrix.os }} timeout-minutes: 5 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - # https://earthly.dev/get-earthly - - name: Install Earthly - run: sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/latest/download/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly && /usr/local/bin/earthly bootstrap --with-autocomplete' + # https://earthly.dev/get-earthly + - name: Install Earthly + run: sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/latest/download/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly && /usr/local/bin/earthly bootstrap --with-autocomplete' - - name: Install - working-directory: ${{ env.SUBDIRECTORY }} - run: earthly +install-dev --verbose true --PYTHONVERSION=${{ matrix.python-version }} + - name: Install + working-directory: ${{ env.SUBDIRECTORY }} + run: earthly +install-dev --verbose true --PYTHONVERSION=${{ matrix.python-version }} - - name: Run code checks - working-directory: ${{ env.SUBDIRECTORY }} - run: earthly +pre-commit --verbose true --PYTHONVERSION=${{ matrix.python-version }} + - name: Run code checks + working-directory: ${{ env.SUBDIRECTORY }} + run: earthly +pre-commit --verbose true --PYTHONVERSION=${{ matrix.python-version }} test_backend: name: test_backend_py${{ matrix.python-version }} @@ -46,39 +45,39 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - python-version: ['3.10', '3.11', '3.12'] + python-version: ["3.10", "3.11", "3.12"] runs-on: ${{ matrix.os }} timeout-minutes: 5 steps: - - uses: actions/checkout@v4 - - - name: Set up postgres and minio test instances - working-directory: ${{ env.SUBDIRECTORY }} - run: | - docker compose --profile test up -d - - - name: Set up npm for prisma - uses: actions/setup-node@v4 - with: - node-version: 18 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - - name: Install uv - run: pip install uv - - - name: Install packages - working-directory: ${{ env.SUBDIRECTORY }} - run: uv sync --frozen --no-cache --no-install-project - - - name: Generate prisma types - working-directory: ${{ env.SUBDIRECTORY }} - run: uv run --frozen prisma generate - - - name: Run pytest - working-directory: ${{ env.SUBDIRECTORY }} - run: uv run pytest test --random-order + - uses: actions/checkout@v4 + + - name: Set up postgres and minio test instances + working-directory: ${{ env.SUBDIRECTORY }} + run: | + docker compose --profile test up -d + + - name: Set up npm for prisma + uses: actions/setup-node@v4 + with: + node-version: 18 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install uv + run: pip install uv + + - name: Install packages + working-directory: ${{ env.SUBDIRECTORY }} + run: uv sync --frozen --no-cache --no-install-project + + - name: Generate prisma types + working-directory: ${{ env.SUBDIRECTORY }} + run: uv run --frozen prisma generate + + - name: Run pytest + working-directory: ${{ env.SUBDIRECTORY }} + run: uv run pytest test --random-order diff --git a/.github/workflows/test_stream_announcer.yml b/.github/workflows/test_stream_announcer.yml index 2d86f95..a9e6b97 100644 --- a/.github/workflows/test_stream_announcer.yml +++ b/.github/workflows/test_stream_announcer.yml @@ -1,14 +1,13 @@ name: test_stream_announcer - on: push: paths: - - twitch_stream_announcer/** - - .github/workflows/test_stream_announcer.yml + - twitch_stream_announcer/** + - .github/workflows/test_stream_announcer.yml pull_request: branches: - - develop + - develop env: SUBDIRECTORY: twitch_stream_announcer @@ -20,22 +19,22 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - python-version: ['3.9', '3.10', '3.11', '3.12'] + python-version: ["3.9", "3.10", "3.11", "3.12"] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - # https://earthly.dev/get-earthly - - name: Install Earthly - run: sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/latest/download/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly && /usr/local/bin/earthly bootstrap --with-autocomplete' + # https://earthly.dev/get-earthly + - name: Install Earthly + run: sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/latest/download/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly && /usr/local/bin/earthly bootstrap --with-autocomplete' - - name: Install - working-directory: ${{ env.SUBDIRECTORY }} - run: | - touch .env - earthly +install-dev --verbose true --PYTHONVERSION=${{ matrix.python-version }} + - name: Install + working-directory: ${{ env.SUBDIRECTORY }} + run: | + touch .env + earthly +install-dev --verbose true --PYTHONVERSION=${{ matrix.python-version }} - - name: Run code checks and tests - working-directory: ${{ env.SUBDIRECTORY }} - run: earthly +all --verbose true --PYTHONVERSION=${{ matrix.python-version }} + - name: Run code checks and tests + working-directory: ${{ env.SUBDIRECTORY }} + run: earthly +all --verbose true --PYTHONVERSION=${{ matrix.python-version }} diff --git a/.github/workflows/test_transcriber_backend.yml b/.github/workflows/test_transcriber_backend.yml index e5792df..b9aa6e3 100644 --- a/.github/workflows/test_transcriber_backend.yml +++ b/.github/workflows/test_transcriber_backend.yml @@ -1,14 +1,13 @@ name: test_transcriber_backend - on: push: paths: - - transcribe_website/transcriber_backend/** - - .github/workflows/test_transcriber_backend.yml + - transcribe_website/transcriber_backend/** + - .github/workflows/test_transcriber_backend.yml pull_request: branches: - - develop + - develop env: SUBDIRECTORY: transcribe_website/transcriber_backend @@ -22,39 +21,39 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - python-version: ['3.9', '3.10', '3.11', '3.12'] + python-version: ["3.9", "3.10", "3.11", "3.12"] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v4 - -# In conflict with pyre-check -# - name: Set up Python ${{ matrix.python-version }} -# uses: actions/setup-python@v4 -# with: -# python-version: ${{ matrix.python-version }} -# -# - name: Cache .venv -# uses: actions/cache@v3 -# with: -# path: .venv -# key: ${{ env.SUBDIRECTORY }}-${{ matrix.os }}-${{ steps.setup-python.outputs.python-version }}-poetry-${{ hashFiles('poetry.lock') }} - - # https://earthly.dev/get-earthly - - name: Install Earthly - run: sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/latest/download/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly && /usr/local/bin/earthly bootstrap --with-autocomplete' - - - name: Install - working-directory: ${{ env.SUBDIRECTORY }} - run: earthly +install-dev --verbose true --PYTHONVERSION=${{ matrix.python-version }} - - - name: Run code checks and tests - working-directory: ${{ env.SUBDIRECTORY }} - run: earthly +all --verbose true --PYTHONVERSION=${{ matrix.python-version }} - -# - name: Save cache -# working-directory: ${{ env.SUBDIRECTORY }} -# run: earthly +export-cache --verbose true --PYTHONVERSION=${{ matrix.python-version }} + - uses: actions/checkout@v4 + + # In conflict with pyre-check + # - name: Set up Python ${{ matrix.python-version }} + # uses: actions/setup-python@v4 + # with: + # python-version: ${{ matrix.python-version }} + # + # - name: Cache .venv + # uses: actions/cache@v3 + # with: + # path: .venv + # key: ${{ env.SUBDIRECTORY }}-${{ matrix.os }}-${{ steps.setup-python.outputs.python-version }}-poetry-${{ hashFiles('poetry.lock') }} + + # https://earthly.dev/get-earthly + - name: Install Earthly + run: sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/latest/download/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly && /usr/local/bin/earthly bootstrap --with-autocomplete' + + - name: Install + working-directory: ${{ env.SUBDIRECTORY }} + run: earthly +install-dev --verbose true --PYTHONVERSION=${{ matrix.python-version }} + + - name: Run code checks and tests + working-directory: ${{ env.SUBDIRECTORY }} + run: earthly +all --verbose true --PYTHONVERSION=${{ matrix.python-version }} + + # - name: Save cache + # working-directory: ${{ env.SUBDIRECTORY }} + # run: earthly +export-cache --verbose true --PYTHONVERSION=${{ matrix.python-version }} build_and_deploy_docker_image: strategy: @@ -64,35 +63,35 @@ jobs: runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v4 - - - name: Build docker image - working-directory: ${{ env.SUBDIRECTORY }} - run: | - docker build -t burnysc2/${{ env.IMAGENAME }}:latest . - docker build -t burnysc2/${{ env.IMAGENAME }}:${{ env.VERSION_NUMBER}} . - - - name: Login to DockerHub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - id: wait-for-jobs - uses: yogeshlonkar/wait-for-jobs@v0 - with: - gh-token: ${{ secrets.GITHUB_TOKEN }} - jobs: | - test_backend_py3.9 - test_backend_py3.10 - test_backend_py3.11 - test_backend_py3.12 - - - name: Upload docker image - if: github.ref == 'refs/heads/develop' && github.event_name == 'push' - run: | - docker push burnysc2/${{ env.IMAGENAME }}:latest - docker push burnysc2/${{ env.IMAGENAME }}:${{ env.VERSION_NUMBER}} + - uses: actions/checkout@v4 + + - name: Build docker image + working-directory: ${{ env.SUBDIRECTORY }} + run: | + docker build -t burnysc2/${{ env.IMAGENAME }}:latest . + docker build -t burnysc2/${{ env.IMAGENAME }}:${{ env.VERSION_NUMBER}} . + + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - id: wait-for-jobs + uses: yogeshlonkar/wait-for-jobs@v0 + with: + gh-token: ${{ secrets.GITHUB_TOKEN }} + jobs: | + test_backend_py3.9 + test_backend_py3.10 + test_backend_py3.11 + test_backend_py3.12 + + - name: Upload docker image + if: github.ref == 'refs/heads/develop' && github.event_name == 'push' + run: | + docker push burnysc2/${{ env.IMAGENAME }}:latest + docker push burnysc2/${{ env.IMAGENAME }}:${{ env.VERSION_NUMBER}} # deploy_transcribe_worker: # if: github.ref == 'refs/heads/develop' @@ -125,4 +124,3 @@ jobs: # docker image prune -af # docker pull burnysc2/${{ env.IMAGENAME }}:latest # sudo /bin/systemctl enable --now ${{ env.USERNAME }} - diff --git a/burny_common/uv.lock b/burny_common/uv.lock index 4d3fc2d..d1914e0 100644 --- a/burny_common/uv.lock +++ b/burny_common/uv.lock @@ -35,7 +35,7 @@ wheels = [ [[package]] name = "burny-common" -version = "0.0.13" +version = "0.0.14" source = { virtual = "." } dependencies = [ { name = "click" },