Skip to content

Commit

Permalink
Merge 172949c into 728925c
Browse files Browse the repository at this point in the history
  • Loading branch information
hluk committed Feb 23, 2024
2 parents 728925c + 172949c commit 18084fc
Show file tree
Hide file tree
Showing 11 changed files with 1,221 additions and 2,930 deletions.
30 changes: 12 additions & 18 deletions .github/workflows/gating.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
python-version: "3.12"

- name: Install system dependencies
uses: nick-invision/retry@v2
Expand All @@ -35,11 +35,12 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry tox tox-gh-actions
curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv
uv pip install tox tox-uv
- name: Test with tox
run: tox -e py
run: .venv/bin/tox run -e py

- name: Run coveralls-python
env:
Expand All @@ -58,7 +59,7 @@ jobs:
python-version: "3.8"

- name: Test building documentation with tox
run: tox -e docs
run: .venv/bin/tox run -e docs

coveralls-finish:
name: Finish coveralls-python
Expand Down Expand Up @@ -90,15 +91,16 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
python-version: "3.12"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv
uv pip install tox tox-uv
- name: Test '${{ matrix.tox_env }}' with tox
run: tox -e ${{ matrix.tox_env }}
run: .venv/bin/tox run -e ${{ matrix.tox_env }}

hadolint:
name: Hadolint
Expand Down Expand Up @@ -134,15 +136,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry tox tox-gh-actions podman-compose
- name: Update the Application Version
run: poetry version "$(./get-version.sh)"
python-version: "3.12"

- name: Get image tag from git branch
id: get-image-tag
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ docs-on-pagure
/rpmbuild-output/
*.src.rpm
.tox
.venv
dist
.ropeproject
.pytest_cache/
docker/home/
.idea
.coverage
# __version__.py generated via hatch-vcs
/waiverdb/__version__.py
24 changes: 10 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM registry.fedoraproject.org/fedora:38 as builder
FROM registry.fedoraproject.org/fedora:39 as builder

# hadolint ignore=DL3033,DL4006,SC2039,SC3040
RUN set -exo pipefail \
Expand All @@ -10,14 +10,15 @@ RUN set -exo pipefail \
--disablerepo=* \
--enablerepo=fedora,updates \
gcc \
git-core \
krb5-devel \
openldap-devel \
python3 \
python3-devel \
which \
# install runtime dependencies
&& yum install -y \
--installroot=/mnt/rootfs \
--releasever=38 \
--releasever=39 \
--setopt install_weak_deps=false \
--nodocs \
--disablerepo=* \
Expand All @@ -27,30 +28,25 @@ RUN set -exo pipefail \
python3 \
&& yum --installroot=/mnt/rootfs clean all \
&& rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* \
# https://python-poetry.org/docs/master/#installing-with-the-official-installer
&& curl -sSL https://install.python-poetry.org | python3 - \
&& python3 -m venv /venv
# https://github.com/astral-sh/uv?tab=readme-ov-file#getting-started
&& curl -LsSf https://astral.sh/uv/install.sh | sh

ENV \
PIP_DEFAULT_TIMEOUT=100 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_NO_CACHE_DIR=1 \
PYTHONFAULTHANDLER=1 \
PYTHONHASHSEED=random \
PYTHONUNBUFFERED=1

WORKDIR /build
COPY . .

# hadolint ignore=SC1091
RUN set -ex \
&& export PATH=/root/.local/bin:$PATH \
&& . /venv/bin/activate \
&& pip install --no-cache-dir -r requirements.txt \
&& poetry build --format=wheel \
&& version=$(poetry version --short) \
&& pip install --no-cache-dir dist/waiverdb-"$version"-py3*.whl \
&& deactivate \
&& export PATH=/root/.cargo/bin:$PATH \
&& export VIRTUAL_ENV=/venv \
&& uv venv /venv \
&& uv pip install --strict "waiverdb @ ." \
&& mv /venv /mnt/rootfs \
&& mkdir -p /mnt/rootfs/app /etc/waiverdb \
&& cp -v docker/docker-entrypoint.sh /mnt/rootfs/app/entrypoint.sh \
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,6 @@ exec:

sudo:
$(PODMAN) exec -u root waiverdb_$(SERVICE)_1 bash -c '$(CMD)'

update-requirements:
uv pip compile --generate-hashes requirements.in -o requirements.txt
18 changes: 14 additions & 4 deletions docs/developer-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,28 @@ Install packages required by pip to compile some python packages::

$ sudo dnf install swig openssl-devel cpp gcc

Install ``uv`` Python package installer and resolver::

$ curl -LsSf https://astral.sh/uv/install.sh | sh
$ export PATH=$HOME/.cargo/bin:$PATH

Install dependencies in a virtual environment::

$ poetry install
$ uv venv
$ uv pip install -r requirements.txt "waiverdb @ ."

Run the server::
Run the development server::

$ cp conf/settings.py.example conf/settings.py
$ DEV=true poetry run waiverdb run -h localhost -p 5004 --debugger
$ PYTHONPATH=. DEV=true .venv/bin/python waiverdb/manage.py run -h localhost -p 5004 --debugger

Run the installed version::

$ .venv/bin/waiverdb run -h localhost -p 5004

Migrate the db::

$ DEV=true poetry run waiverdb db upgrade
$ DEV=true .venv/bin/waiverdb db upgrade

The server is now running at on `localhost port 5004`_. Consult the
:ref:`rest-api` for available API calls. All data is stored inside
Expand Down
44 changes: 0 additions & 44 deletions get-version.sh

This file was deleted.

Loading

0 comments on commit 18084fc

Please sign in to comment.