diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..9648698 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,80 @@ +version: 2.1 +orbs: + semantic-release: trustedshops-public/semantic-release@6.0.0 +jobs: + lint: + docker: + - image: cimg/python:3.12.2 + steps: + - checkout + - restore_cache: + key: venv-dev-{{ checksum "poetry.lock" }} + - run: + name: set up venv + command: | + poetry config virtualenvs.create true --local + poetry config virtualenvs.in-project true --local + - run: + name: install dependencies + command: poetry install --with dev + - save_cache: + key: venv-dev-{{ checksum "poetry.lock" }} + paths: + - .venv + - run: + name: run linter + command: | + poetry run ruff check . + poetry run ruff format --check . + test: + docker: + - image: cimg/python:3.12.2 + - image: cimg/postgres:14.0 + environment: + POSTGRES_USER: moku + POSTGRES_DB: moku + steps: + - checkout + - restore_cache: + key: venv-test-{{ checksum "poetry.lock" }} + - run: + name: set up venv + command: | + poetry config virtualenvs.create true --local + poetry config virtualenvs.in-project true --local + - run: + name: install dependencies + command: poetry install --with test + - save_cache: + key: venv-test-{{ checksum "poetry.lock" }} + paths: + - .venv + - run: + name: wait for postgres + command: dockerize -wait tcp://localhost:5432 -timeout 1m + - run: + name: check migrations + command: poetry run python manage.py makemigrations --check + environment: + DATABASE_URL: postgres://moku@localhost:5432/moku + - run: + name: run tests + command: poetry run pytest + environment: + DATABASE_URL: postgres://moku@localhost:5432/moku +workflows: + version: 2 + main: + jobs: + - lint + - test + - semantic-release/with_existing_config: + name: semantic release + additional_packages: @google/semantic-release-replace-plugin + requires: + - lint + - test + filter: + branches: + only: + - main \ No newline at end of file diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml deleted file mode 100644 index 284f5ab..0000000 --- a/.github/workflows/lint.yaml +++ /dev/null @@ -1,36 +0,0 @@ -name: lint -on: - pull_request: - branches: - - '*' - push: - branches: - - 'main' -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: install python - uses: actions/setup-python@v5 - with: - python-version: '3.12' - - name: set up poetry - uses: abatilo/actions-poetry@v2 - with: - poetry-version: '1.8.2' - - name: set up virtual environment - run: | - poetry config virtualenvs.create true --local - poetry config virtualenvs.in-project true --local - - name: cache virtual environment - uses: actions/cache@v4 - with: - path: ./.venv - key: venv-${{ hashFiles('poetry.lock') }} - - name: install dependencies - run: poetry install --with dev - - name: check linter and formatter - run: | - poetry run ruff check . - poetry run ruff format --check . \ No newline at end of file diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml deleted file mode 100644 index 9f3c8a9..0000000 --- a/.github/workflows/test.yaml +++ /dev/null @@ -1,52 +0,0 @@ -name: test -on: - pull_request: - branches: - - '*' - push: - branches: - - 'main' -env: - DEBUG: true - DATABASE_URL: 'postgres://postgres:postgres@localhost:5432/postgres' - DJANGO_DEBUG_TOOLBAR: false -jobs: - test: - runs-on: ubuntu-latest - services: - postgres: - image: postgres - env: - POSTGRES_PASSWORD: postgres - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - - '5432:5432' - steps: - - uses: actions/checkout@v4 - - name: install python - uses: actions/setup-python@v5 - with: - python-version: '3.12' - - name: set up poetry - uses: abatilo/actions-poetry@v2 - with: - poetry-version: '1.8.2' - - name: set up virtual environment - run: | - poetry config virtualenvs.create true --local - poetry config virtualenvs.in-project true --local - - name: cache virtual environment - uses: actions/cache@v4 - with: - path: ./.venv - key: venv-${{ hashFiles('poetry.lock') }} - - name: install dependencies - run: poetry install --with test - - name: check migrations - run: poetry run python manage.py makemigrations --check - - name: run tests - run: poetry run pytest \ No newline at end of file diff --git a/.releaserc.json b/.releaserc.json new file mode 100644 index 0000000..537d761 --- /dev/null +++ b/.releaserc.json @@ -0,0 +1,63 @@ +{ + "branches": [ + "main" + ], + "plugins": [ + [ + "@semantic-release/commit-analyzer", + { + "preset": "conventionalcommits" + } + ], + [ + "@semantic-release/release-notes-generator", + { + "preset": "conventionalcommits" + } + ], + [ + "@semantic-release/changelog", + { + "changelogFile": "CHANGELOG.md" + } + ], + [ + "@google/semantic-release-replace-plugin", + { + "replacements": [ + { + "files": [ + "pyproject.toml" + ], + "from": "version = \"[0-9.]+\"", + "to": "version = \"${nextRelease.version}\"", + "results": [ + { + "file": "pyproject.toml", + "hasChanged": true + } + ] + } + ] + } + ], + [ + "@semantic-release/git", + { + "assets": [ + "CHANGELOG.md", + "pyproject.toml" + ], + "message": "chore(release): 🚀 bump version to ${nextRelease.version} [skip ci]\\n\\n${nextRelease.notes}" + } + ], + [ + "@semantic-release/github", + { + "path": "semantic-release", + "name": "m5ka/moku.blog" + } + ] + ], + "tagFormat": "${version}" +} \ No newline at end of file diff --git a/moku/__init__.py b/moku/__init__.py index b057dc5..69c9982 100644 --- a/moku/__init__.py +++ b/moku/__init__.py @@ -1 +1,4 @@ +from importlib.metadata import version + +__version__ = version(__name__) default_app_config = "moku.config.apps.MokuConfig" diff --git a/moku/static/css/moku.css b/moku/static/css/moku.css index 80e1245..14711fc 100644 --- a/moku/static/css/moku.css +++ b/moku/static/css/moku.css @@ -470,6 +470,11 @@ footer nav ul { column-gap: 1.2rem; } +footer nav ul li.version { + color: var(--charcoal); + font-size: 1.4rem; +} + footer nav ul li a { font-size: 1.4rem; color: var(--charcoal); diff --git a/moku/templates/moku/base.jinja b/moku/templates/moku/base.jinja index 72b09e7..86d3091 100644 --- a/moku/templates/moku/base.jinja +++ b/moku/templates/moku/base.jinja @@ -56,7 +56,8 @@ {% if request.user.is_authenticated %}