Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
requirements_lint.txt
.travis.yml
docker-compose.yml
Dockerfile
Dockerfile
.venv
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
version: 2
updates:
# Enable version updates for python
- package-ecosystem: "pip"
directory: "/requirements"
- package-ecosystem: "uv"
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 16
Expand Down
47 changes: 12 additions & 35 deletions .github/workflows/build-and-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,56 +20,37 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12.3'
architecture: 'x64'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --no-deps -r requirements/requirements-lint.txt
- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Black
run: black --check .
run: uv run black --check .

- name: Ruff
run: ruff check --no-cache --output-format github .

- name: Install production requirements (for Mypy)
run: |
# Mypy needs production packages for typechecking
pip install --no-deps -r requirements/requirements-prod.txt
run: uv run ruff check --no-cache --output-format github .

- name: Mypy
run: mypy
run: uv run mypy

check-compiled-requirements:
check-locked-requirements:
runs-on: ubuntu-24.04
if: ${{ !contains(github.event.head_commit.message, '#notests') }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
- uses: actions/setup-python@v5
with:
python-version: '3.12.3'

- name: Prepare environment
run: |
pip install --no-deps -r requirements/requirements-pip.txt
pip install $(grep -rwoh requirements -e 'pip-tools==.*[^\]' | head -n 1)
- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Compile Requirements Files
run: |
./scripts/pip-compile-all.sh
- name: Update lockfile
run: uv sync

- name: Check If Output Matches Committed
run: |
DIFF="$(git diff)"
if [ "$DIFF" ]; then
echo "Compiled requirements differ from committed requirements!"
echo "Lockfile differs from committed lockfile!"
echo "$DIFF"
exit 1
fi
Expand Down Expand Up @@ -134,11 +115,7 @@ jobs:
run: |
docker tag ${{ env.DOCKER_IMAGE_TAG }} ${{ env.PROJECT }}_app
if [[ -z $SKIP_TESTS ]]; then
docker compose run app bash -ec '
bin/wait-for-it.sh mysql:3306 \
&& NYLAS_ENV=test pytest --cov-report= --cov=inbox tests/ \
&& coverage html -d pythoncov
'
docker compose run test uv run pytest --cov-report=html:pythoncov --cov=inbox
else
echo Skipping tests
fi
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ htmlcov
/config.json
inbox/test/.cache

# location for editable pip installs
/src

# virtualenv
venv
.venv
Expand Down
1 change: 0 additions & 1 deletion .python-version

This file was deleted.

19 changes: 11 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ ENV \
LANG="en_US.UTF-8" \
LC_ALL="en_US.UTF-8" \
DEBIAN_FRONTEND=noninteractive \
PATH="/opt/venv/bin:$PATH"
PATH="/opt/venv/bin:$PATH" \
UV_PROJECT_ENVIRONMENT="/opt/venv"

ARG BUILD_WEEK=0
RUN echo $BUILD_WEEK && apt-get update \
Expand Down Expand Up @@ -55,15 +56,13 @@ RUN apt-get update \
git \
pkg-config \
python3.12-dev \
python3.12-venv \
python3-pip \
libmysqlclient-dev \
&& rm -rf /var/lib/apt/lists/*

COPY /requirements/ /requirements/
RUN python3.12 -m venv /opt/venv && \
/opt/venv/bin/python3.12 -m pip install --no-cache --no-deps -r /requirements/requirements-prod.txt -r /requirements/requirements-test.txt && \
/opt/venv/bin/python3.12 -m pip check
COPY --from=ghcr.io/astral-sh/uv:0.6.6 /uv /uvx /bin/
COPY ./pyproject.toml ./uv.lock ./src /opt/app/
WORKDIR /opt/app
RUN uv sync --no-editable --frozen


# --- Stage 2 --- #
Expand All @@ -77,4 +76,8 @@ WORKDIR /opt/app

COPY --from=stage_1 --chown=sync-engine:sync-engine /opt/venv /opt/venv
RUN ln -s /opt/app/bin/wait-for-it.sh /opt/venv/bin/
COPY --chown=sync-engine:sync-engine ./ /opt/app/
COPY --chown=sync-engine:sync-engine ./alembic.ini /opt/app/
COPY --chown=sync-engine:sync-engine ./bin /opt/app/bin
COPY --chown=sync-engine:sync-engine ./etc /opt/app/etc
COPY --chown=sync-engine:sync-engine ./migrations /opt/app/migrations
COPY --chown=sync-engine:sync-engine ./scripts /opt/app/scripts
14 changes: 14 additions & 0 deletions Dockerfile-dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM ghcr.io/astral-sh/uv:debian-slim

RUN apt-get update
RUN apt-get install --no-install-recommends -y \
python3-dev \
default-libmysqlclient-dev \
mariadb-client \
build-essential \
pkg-config \
gcc \
git \
vim

WORKDIR /opt/app
Loading