Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make EvaP pip-installable and publish to PyPI #2328

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
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
7 changes: 7 additions & 0 deletions .github/setup_evap/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ inputs:
description: "whether or not to run `npm ci`"
required: false
default: false
working-directory:
required: false
default: "."

runs:
using: "composite"
Expand All @@ -22,17 +25,21 @@ runs:
- uses: nicknovitski/nix-develop@v1
with:
arguments: "${{ inputs.shell }}"
if: ${{ inputs.shell != '' }}

- name: Add localsettings
run: cp evap/settings_test.py evap/localsettings.py
shell: bash
working-directory: ${{ inputs.working-directory }}

- name: Install Node dependencies
run: npm ci
shell: bash
if: ${{ inputs.npm-ci }}
working-directory: ${{ inputs.working-directory }}

- name: Start database
run: nix run .#services -- --detached && nix run .#wait-for-pc
shell: bash
if: ${{ inputs.start-db }}
working-directory: ${{ inputs.working-directory }}
26 changes: 26 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: EvaP Release

on:
workflow_dispatch:

jobs:
pypi-publish:
name: upload release to PyPI
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
steps:
- run: |
RUN_ID=$(gh run --repo ${{ github.repository }} list --commit ${{ github.sha }} --status success --workflow "EvaP Test Suite" --json databaseId --jq '.[].databaseId')
if [ -z "$RUN_ID" ]; then
echo "No run found"
exit 1
fi
gh run --repo ${{ github.repository }} download "$RUN_ID" --name wheel --dir dist
env:
GH_TOKEN: ${{ github.token }}
- run: tar tvf dist/*.tar.gz
- run: unzip -l dist/*.whl
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
53 changes: 39 additions & 14 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- main
pull_request:
workflow_dispatch:

jobs:
test:
Expand Down Expand Up @@ -184,35 +185,59 @@ jobs:
runs-on: ubuntu-22.04

name: Backup process
needs: build_wheel

steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/setup_evap
path: main

- uses: actions/checkout@v4
with:
shell: .#evap # no dev-dependencies
start-db: true
repository: e-valuation/evap-deployment
ref: work # todo: remove
path: deployment

- name: Install additional dependencies
run: sudo apt-get update && sudo apt-get install gettext
- uses: DeterminateSystems/nix-installer-action@main
- name: Start database
working-directory: deployment
run: nix run ../main#services -- --detached

- name: GitHub actions has wrong file ownership here, the checkout actions has a problem here (see their 1049)
- uses: actions/setup-python@v5
with:
python-version: '3.10'

- uses: actions/download-artifact@v4
with:
name: wheel

- name: Install wheel
run: |
git config --global --add safe.directory '*'
sudo -H -u root git config --global --add safe.directory '*'
WHEEL=$(echo *.whl)
pip install $WHEEL[psycopg-binary]

- name: Load test data
working-directory: deployment
run: |
python manage.py migrate
python manage.py loaddata test_data
cat <(echo 'from evap.settings import *') ../main/evap/settings_test.py | tee deployment_settings.py
python -m evap migrate
python -m evap loaddata test_data
env:
DJANGO_SETTINGS_MODULE: deployment_settings
- name: Backup database
run: deployment/update_production.sh backup.json
working-directory: deployment
run: ./update_production.sh backup.json
env:
EVAP_OVERRIDE_BACKUP_FILENAME: true
EVAP_SKIP_CHECKOUT: true
EVAP_SKIP_UPDATE: true
EVAP_SKIP_APACHE_STEPS: true
DJANGO_SETTINGS_MODULE: deployment_settings
- name: Reload backup
run: echo "yy" | deployment/load_production_backup.sh backup.json
working-directory: deployment
run: echo "yy" | ./load_production_backup.sh backup.json
env:
EVAP_SKIP_APACHE_STEPS: true
DJANGO_SETTINGS_MODULE: deployment_settings

macos-nix-build:
runs-on: macos-14
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "evap"
description = "EvaP"
version = "0.0.0"
version = "2025.03.0"
readme = "README.md"
requires-python = "~=3.10.0"
dependencies = [
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.