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 37 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
7f921a9
Make EvaP pip-installable and publish to PyPI
niklasmohrin Nov 4, 2024
8de568b
publish to testing pypi for now
niklasmohrin Dec 2, 2024
4c4fc36
normal imports in __main__.py
niklasmohrin Dec 2, 2024
12b4189
bump version to test release
niklasmohrin Dec 2, 2024
acfb086
Revert "publish to testing pypi for now"
niklasmohrin Dec 9, 2024
8b1e748
Split BASE_DIR into MODULE and CWD
niklasmohrin Dec 9, 2024
e4ca5bd
Add `evap` script
niklasmohrin Dec 9, 2024
32aeb29
Run `pip install` in `deployment/update_production.sh`
niklasmohrin Dec 9, 2024
f7ba5e4
Don't store runtime data in evap/ directory
niklasmohrin Dec 9, 2024
818763c
Add `--noinput` to `reload_testdata`
niklasmohrin Dec 9, 2024
9320421
Fix test fixture
niklasmohrin Dec 9, 2024
bb888c0
format
niklasmohrin Dec 9, 2024
c98ad0a
more BASE_DIR
niklasmohrin Dec 9, 2024
adc5ab4
fix more tests
niklasmohrin Dec 9, 2024
ab479e5
bump version
niklasmohrin Dec 9, 2024
a9dcc6b
build ts and scss before publishing release
niklasmohrin Dec 9, 2024
29b735e
bump version
niklasmohrin Dec 9, 2024
5feadc2
create data dir?
niklasmohrin Dec 9, 2024
8460cf8
submodules
niklasmohrin Dec 9, 2024
a2db711
use build settings for every target
niklasmohrin Dec 9, 2024
1f5c358
include stuff, bump
niklasmohrin Dec 16, 2024
076c860
remove script
niklasmohrin Dec 16, 2024
1aae902
include correct files
niklasmohrin Dec 16, 2024
d1d596a
is this correct syntax?
niklasmohrin Dec 16, 2024
24d12c6
use skip-excluded-dirs option to speed up build
niklasmohrin Dec 16, 2024
4cf93ff
build wheel in nix script
niklasmohrin Dec 16, 2024
47dd540
bump version
niklasmohrin Dec 16, 2024
0281e63
actually correct build config, this time surely
niklasmohrin Dec 16, 2024
cd629cf
don't run compilation steps in update_production, the artifacts are i…
niklasmohrin Dec 16, 2024
973032d
bump version
niklasmohrin Dec 16, 2024
e27dfc9
play around with apache a bit
niklasmohrin Dec 16, 2024
2e24d3d
fix ci, bump version
niklasmohrin Jan 6, 2025
9adb9b4
Move `localsettings.template.py` and `manage_autocompletion.sh` to `e…
niklasmohrin Jan 13, 2025
93879f4
Delete remaining files from deployment; moved to evap-deployment repo
niklasmohrin Jan 13, 2025
f9422b0
yeah
niklasmohrin Jan 13, 2025
0cbe22d
check if permission thingy is still needed
niklasmohrin Jan 13, 2025
29ce739
add workflow_dispatch trigger in case we want to test changes in othe…
niklasmohrin Jan 13, 2025
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 @@ -23,17 +26,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 }}
25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: EvaP Release

on:
pull_request:
# release:
# types: [published]

jobs:
pypi-publish:
name: upload release to PyPI
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- run: nix run .#build-dist
- 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
50 changes: 37 additions & 13 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 @@ -98,30 +99,53 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/setup_evap
path: main
- uses: ./main/.github/setup_evap
with:
shell: .#evap # no dev-dependencies
shell: ""
start-db: true
working-directory: main

- name: Install additional dependencies
run: sudo apt-get update && sudo apt-get install gettext
- name: Build wheel
run: nix run .#build-dist
working-directory: main

- name: GitHub actions has wrong file ownership here, the checkout actions has a problem here (see their 1049)
run: |
git config --global --add safe.directory '*'
sudo -H -u root git config --global --add safe.directory '*'
- uses: actions/checkout@v4
with:
repository: e-valuation/evap-deployment
ref: work # todo: remove
path: deployment

- uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install wheel
run: pip install main/dist/*.whl

- name: Load test data
run: |
python manage.py migrate
python manage.py loaddata test_data
ln -s ../main/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
working-directory: deployment
env:
DJANGO_SETTINGS_MODULE: deployment_settings
- name: Backup database
run: deployment/update_production.sh backup.json
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
working-directory: deployment
- name: Reload backup
run: echo "yy" | deployment/load_production_backup.sh backup.json
run: echo "yy" | ./load_production_backup.sh backup.json
env:
EVAP_SKIP_APACHE_STEPS: true
DJANGO_SETTINGS_MODULE: deployment_settings
working-directory: deployment

compile_scss:
runs-on: ubuntu-22.04
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ TAGS

# python files
*.py[cod]
dist/

# gettext binaries
*.mo
Expand All @@ -26,10 +27,8 @@ evap/localsettings.py
evap/static/css/evap.css
evap/static/css/evap.css.map
evap/static/ts/rendered
evap/static_collected
evap/media
evap/database.sqlite3
evap/upload

evap/evaluation/templates/legal_notice_text.html

Expand Down
24 changes: 0 additions & 24 deletions deployment/apache.maintenance-template.conf

This file was deleted.

33 changes: 0 additions & 33 deletions deployment/apache.template.conf

This file was deleted.

13 changes: 0 additions & 13 deletions deployment/disable_maintenance_mode.sh

This file was deleted.

13 changes: 0 additions & 13 deletions deployment/enable_maintenance_mode.sh

This file was deleted.

61 changes: 0 additions & 61 deletions deployment/load_production_backup.sh

This file was deleted.

58 changes: 0 additions & 58 deletions deployment/update_production.sh

This file was deleted.

18 changes: 18 additions & 0 deletions evap/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env python3

import os
import sys

from django.conf import settings
from django.core.management import execute_from_command_line


def main():
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "evap.settings")
if getattr(settings, "DATADIR", None) is not None:
settings.DATADIR.mkdir(exist_ok=True)
execute_from_command_line(sys.argv)


if __name__ == "__main__":
sys.exit(main())

Check warning on line 18 in evap/__main__.py

View check run for this annotation

Codecov / codecov/patch

evap/__main__.py#L18

Added line #L18 was not covered by tests
Loading
Loading