Skip to content

Commit

Permalink
refactor Justfile commands a bit based on recent tests (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuadavidthomas committed May 22, 2024
1 parent dbedc76 commit d0cab69
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

- Added our Data Analytics GitHub Team to the `CODEOWNERS` file for automatic review assignment to any PRs involving migrations.

### Changed

- Adjusted various `Justfile` commands based on testing and feedback.

## [2024.24]

### Changed
Expand Down
1 change: 1 addition & 0 deletions src/django_twc_project/.env.example.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ DATABASE_URL={{ postgres_uri_scheme }}://postgres:postgres@db:5432/postgres
DEBUG=True
DJANGO_SETTINGS_MODULE={{ module_name }}.settings
EMAIL_RELAY_DATABASE_URL={{ postgres_uri_scheme }}://postgres:postgres@db:5432/email_relay
JUST_UNSTABLE=True
1 change: 0 additions & 1 deletion src/django_twc_project/.just/django.just
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ fmt:
manage *COMMAND:
@just docker command python -m manage {{ COMMAND }}

# Alias for makemigrations
alias mm := makemigrations

# Generate Django migrations
Expand Down
3 changes: 3 additions & 0 deletions src/django_twc_project/.just/docker.just
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ build-prod:
docker compose -f compose.yml -f compose.prod.yml build

# Stop and remove all containers, networks, images, and volumes
[no-cd]
clean:
#!/usr/bin/env bash
[[ ! -f .env ]] && just project envfile
@just docker down --volumes --rmi local

# Run a command within the 'app' container
Expand Down
2 changes: 1 addition & 1 deletion src/django_twc_project/.just/documentation.just
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ serve: cog
upgrade:
@just lock --upgrade

[private]
[no-cd]
[private]
cog:
cog -r docs/just.md
3 changes: 2 additions & 1 deletion src/django_twc_project/.just/project.just
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ envfile:
envfile = Path("{{ justfile_directory() }}/.env")
envfile_example = Path("{{ justfile_directory() }}/.env.example")

if not envfile.exists():
if not envfile.exists() or envfile.stat().st_size == 0:
envfile.write_text(envfile_example.read_text())

# Sync .env file back to .env.example
Expand Down Expand Up @@ -85,6 +85,7 @@ lint: install-precommit
@just project just-fmt

# Setup project scaffolding
[no-cd]
setup:
@just project envfile
@just py venv
Expand Down
2 changes: 1 addition & 1 deletion src/django_twc_project/.just/python.just.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ lock *ARGS:
# Run tests using pytest within the 'app' container, with optional arguments
test *ARGS:
{%- if include_vite %}
@just docker run app "-e DJANGO_VITE_DEV_SERVER_HOST=node" pytest {% raw %}{{ ARGS }}{% endraw %}
@just docker run app "-e DJANGO_VITE_DEV_SERVER_HOST=node" coverage run -m pytest {% raw %}{{ ARGS }}{% endraw %}
{%- else %}
@just docker command coverage run -m pytest {% raw %}{{ ARGS }}{% endraw %}
{%- endif %}
Expand Down

0 comments on commit d0cab69

Please sign in to comment.