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

Provide development environment via nix #2274

Merged
merged 77 commits into from
Oct 13, 2024
Merged
Show file tree
Hide file tree
Changes from 69 commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
6b6b199
Refactor to `poetry2nix`
niklasmohrin Apr 17, 2024
192ec03
Lock files
niklasmohrin Apr 17, 2024
e1062c3
Possible setup with services
niklasmohrin Apr 17, 2024
87c261c
possible instructions for readme
niklasmohrin Apr 22, 2024
1d775b3
x
niklasmohrin Jun 16, 2024
045c569
make node inputs available in shell
niklasmohrin Jul 15, 2024
b8369ff
Remove npm stuff for now, use more flake-parts niceties
niklasmohrin Jul 29, 2024
80b7fc7
Add initialize-setup and clean-setup scripts
niklasmohrin Jul 30, 2024
90eb21c
add overrides
niklasmohrin Aug 12, 2024
928b8d1
use packages maybe
niklasmohrin Aug 12, 2024
3ad546b
Add instructions for custom shells
niklasmohrin Aug 12, 2024
17ba4b8
Don't track .envrc
niklasmohrin Aug 12, 2024
f9985ec
Simplify, I guess people should just edit `flake.nix` for extra packages
niklasmohrin Aug 23, 2024
b4743a9
document more
niklasmohrin Aug 23, 2024
b55c3b9
Split `nix-setup.md` into `README.md` and `nix/tricks.md`
niklasmohrin Aug 24, 2024
0da43c2
Work on podman example
niklasmohrin Aug 24, 2024
7f2552b
Update dependency versions
niklasmohrin Aug 26, 2024
da4893c
Remove traces of vagrant
niklasmohrin Aug 26, 2024
b8080c8
`nix flake update`
niklasmohrin Aug 26, 2024
7185804
Add multiple flake outputs for evap with or without dev dependencies
niklasmohrin Aug 26, 2024
6dce78a
github actions that will just work first try for sure
niklasmohrin Aug 26, 2024
89b8a06
Revert unneeded changes
niklasmohrin Aug 26, 2024
d53d6af
It is `--detached`, not `--detach`
niklasmohrin Aug 26, 2024
7eb4735
Use TCP connection to postgres everywhere
niklasmohrin Aug 26, 2024
b79bd0c
lots of github action code
niklasmohrin Aug 26, 2024
b834e22
all fixed up now
niklasmohrin Aug 26, 2024
2487d44
add descriptions
niklasmohrin Aug 26, 2024
ab88953
Add explicit `shell`
niklasmohrin Aug 26, 2024
f43da9c
Install chromium for CI like we did in vagrant
niklasmohrin Aug 26, 2024
4c9d660
Use `./#evap` to make nix-develop-action work?
niklasmohrin Aug 26, 2024
2a9cee4
Update lockfile
niklasmohrin Aug 26, 2024
f273d39
install chrome with sudo
niklasmohrin Aug 26, 2024
b529b26
shells without quotes?
niklasmohrin Aug 26, 2024
6de8808
use `~` over `^` in dependencies
niklasmohrin Aug 26, 2024
7af9c0a
remove mentions of ENVDIR
niklasmohrin Aug 26, 2024
0787642
install browser via suggested command
niklasmohrin Aug 29, 2024
e359113
preserve env (such as PATH to binaries from nix) with sudo
niklasmohrin Aug 29, 2024
0a8682a
also include forbidden PYTHONPATH
niklasmohrin Aug 29, 2024
197c109
nope, I guess this is nicer anyways?
niklasmohrin Aug 29, 2024
64173d4
Remove `sudo` from deployment scripts
niklasmohrin Sep 2, 2024
01aa3c2
`rm -rf .github/setup_nodejs/`
niklasmohrin Sep 2, 2024
f827895
update dependabot config for actions
niklasmohrin Sep 2, 2024
24659f4
Use `mkPoetryEnv` over `mkPoetryApplication`
niklasmohrin Sep 2, 2024
cbf7ac9
add `typing-extensions` to dependencies, because it is needed
niklasmohrin Sep 2, 2024
b26976a
don't infer redis locale from environment - it didn't work on Ubuntu
niklasmohrin Sep 2, 2024
9366a78
Add `nix run .#install-services-unit`
niklasmohrin Sep 16, 2024
7aa5904
Add `extraPythonPackages`
niklasmohrin Sep 17, 2024
ad87c96
make podman setup nicer
niklasmohrin Sep 23, 2024
86974e5
Move podman description to README
niklasmohrin Sep 23, 2024
683f3b0
remove containerfile, .envrc
niklasmohrin Sep 30, 2024
3a45849
Add `nix/setup` script
niklasmohrin Sep 30, 2024
9ee2a7d
Merge branch 'main' into poetry2nix
niklasmohrin Sep 30, 2024
546da78
sync dependency versions with main
niklasmohrin Sep 30, 2024
497f004
fix python interpreter version
niklasmohrin Sep 30, 2024
eef59ad
rename nix/setup to nix/setup-nix yet again
niklasmohrin Sep 30, 2024
b280b77
Add bash completion in development shells
niklasmohrin Oct 7, 2024
f304d4d
Use unix domain sockets instead of TCP for postgres and redis
niklasmohrin Oct 7, 2024
e90c865
Move `npm ci` to process compose
niklasmohrin Oct 8, 2024
6a35f15
Move service config to own file, add second config with only databses
niklasmohrin Oct 8, 2024
0e0d77f
move rest of initialize-setup to process compose
niklasmohrin Oct 8, 2024
802693d
Don't use `projectDir`
niklasmohrin Oct 8, 2024
84836f4
Remove `version` in pyproject.toml
niklasmohrin Oct 8, 2024
acae890
rm requirements*
niklasmohrin Oct 8, 2024
f7c4b62
lint
niklasmohrin Oct 8, 2024
8547c81
Merge branch 'main' into poetry2nix
niklasmohrin Oct 8, 2024
c1841e8
add back apache steps to deployment scripts
niklasmohrin Oct 8, 2024
ba91cda
Check for existing nix installation in setup-nix
niklasmohrin Oct 8, 2024
6fb6ec0
add wait-for-pc to wait for process-compose
niklasmohrin Oct 8, 2024
359f4d2
Update README.md
niklasmohrin Oct 8, 2024
0fc21c6
Remove `poetry` from packages
niklasmohrin Oct 12, 2024
b41ee31
also add gettext to npm-ci pc process
niklasmohrin Oct 12, 2024
50facce
don't use process substitution for npm-ci hash check
niklasmohrin Oct 12, 2024
7c66ecd
remove flake-parts
niklasmohrin Oct 12, 2024
5deb2b2
Update README.md
niklasmohrin Oct 12, 2024
335b8cc
be more assertive to people without package managers
niklasmohrin Oct 12, 2024
90c0a46
remove tricks.md in favor of wiki for now
niklasmohrin Oct 13, 2024
be17e29
add note about broken `update_production.sh`
niklasmohrin Oct 13, 2024
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
11 changes: 1 addition & 10 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,7 @@ updates:
labels:
- "[T] Dependencies"
- package-ecosystem: "github-actions"
directory: "/.github/setup_nodejs"
schedule:
interval: "weekly"
groups:
actions:
patterns: ["*"]
labels:
- "[T] Dependencies"
- package-ecosystem: "github-actions"
directory: "/.github/setup_python"
directory: "/.github/setup_evap"
schedule:
interval: "weekly"
groups:
Expand Down
39 changes: 39 additions & 0 deletions .github/setup_evap/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: "Setup EvaP Testing Environment"
description: "Sets up the nix environment with caching and copy localsettings"

inputs:
shell:
description: "name of development shell to use"
required: false
default: .#evap-dev
start-db:
description: "whether or not to run the database in the background"
required: false
default: false
npm-ci:
description: "whether or not to run `npm ci`"
required: false
default: false
richardebeling marked this conversation as resolved.
Show resolved Hide resolved

runs:
using: "composite"
steps:
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
richardebeling marked this conversation as resolved.
Show resolved Hide resolved
- uses: nicknovitski/nix-develop@v1
with:
arguments: "${{ inputs.shell }}"

- name: Add localsettings
run: cp evap/settings_test.py evap/localsettings.py
shell: bash

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

- name: Start database
run: nix run .#services -- --detached && nix run .#wait-for-pc
shell: bash
if: ${{ inputs.start-db }}
14 changes: 0 additions & 14 deletions .github/setup_nodejs/action.yml

This file was deleted.

46 changes: 0 additions & 46 deletions .github/setup_python/action.yml

This file was deleted.

145 changes: 33 additions & 112 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,11 @@ jobs:

runs-on: ubuntu-22.04

services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: evap
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Setup python
uses: ./.github/setup_python
- uses: actions/checkout@v4
- uses: ./.github/setup_evap
with:
start-db: true

- name: Run tests
run: coverage run manage.py test
Expand All @@ -42,23 +30,11 @@ jobs:

runs-on: ubuntu-22.04

services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: evap
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Setup python
uses: ./.github/setup_python
- uses: actions/checkout@v4
- uses: ./.github/setup_evap
with:
start-db: true

- name: Run tests
run: python manage.py test --shuffle
Expand All @@ -69,12 +45,8 @@ jobs:
name: MyPy

steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Setup python
uses: ./.github/setup_python

- uses: actions/checkout@v4
- uses: ./.github/setup_evap
- name: Run MyPy
run: mypy

Expand All @@ -84,33 +56,23 @@ jobs:
name: Linter

steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Setup python
uses: ./.github/setup_python

- uses: actions/checkout@v4
- uses: ./.github/setup_evap
- name: Run ruff
run: ruff check .

- name: Run pylint
run: pylint evap tools


formatter:
runs-on: ubuntu-22.04

name: Formatting

steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Setup python
uses: ./.github/setup_python

- name: Setup nodejs
uses: ./.github/setup_nodejs
- uses: actions/checkout@v4
- uses: ./.github/setup_evap
with:
npm-ci: true

- name: Check code formatting
run: black --check .
Expand All @@ -120,41 +82,19 @@ jobs:
- name: Check TypeScript formatting
run: npx prettier --list-different --loglevel debug 'evap/static/ts/**/*.ts'


backup-process:
runs-on: ubuntu-22.04

services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: evap
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
redis:
image: redis
options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
ports:
- 6379:6379

name: Backup process

steps:
- name: Check out repository code
uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
submodules: true

- name: Setup python
uses: ./.github/setup_python
- uses: ./.github/setup_evap
with:
requirements-file: requirements.txt

- name: Setup nodejs
uses: ./.github/setup_nodejs
shell: .#evap # no dev-dependencies
start-db: true

- name: Install additional dependencies
run: sudo apt-get update && sudo apt-get install gettext
Expand Down Expand Up @@ -182,13 +122,12 @@ jobs:
name: Compile Scss

steps:
- name: Check out repository code
uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
submodules: true

- name: Setup nodejs
uses: ./.github/setup_nodejs
- uses: ./.github/setup_evap
with:
npm-ci: true

- name: Compile Scss
run: npx sass evap/static/scss/evap.scss evap/static/css/evap.css
Expand All @@ -198,34 +137,16 @@ jobs:
name: css
path: evap/static/css/evap.css


render_pages:
runs-on: ubuntu-22.04

name: Render Html pages

services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: evap
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
redis:
image: redis
options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
ports:
- 6379:6379

steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Setup python
uses: ./.github/setup_python
- uses: actions/checkout@v4
- uses: ./.github/setup_evap
with:
start-db: true

- name: Render pages
run: coverage run manage.py ts render_pages
Expand All @@ -240,7 +161,6 @@ jobs:
name: rendered-pages
path: evap/static/ts/rendered


typescript:
runs-on: ubuntu-22.04

Expand All @@ -249,13 +169,14 @@ jobs:
name: Test Typescript

steps:
- name: Check out repository code
uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/setup_evap
with:
npm-ci: true

- name: Setup nodejs
uses: ./.github/setup_nodejs
- run: npx puppeteer browsers install chrome

- name: Compile Typescript
run: npx tsc --project evap/static/ts/tsconfig.compile.json
Expand Down
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,6 @@ todo
# flake8 configuration
setup.cfg

# User specific vagrant overrides (needs extra config)
.Vagrantfile.local
/data/
/result
.envrc
Loading
Loading