-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #244 from WordPress/improv_just
Organise and document `justfile`
- Loading branch information
Showing
11 changed files
with
59 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,77 @@ | ||
set dotenv-load := false | ||
|
||
DOCKER_FILE := "-f docker-compose.yml" | ||
|
||
# Show all available recipes | ||
default: | ||
@just --list --unsorted | ||
|
||
install: | ||
#! /usr/bin/env sh | ||
cd openverse_api | ||
pipenv install --dev | ||
pipenv run pre-commit install | ||
|
||
########## | ||
# Docker # | ||
########## | ||
|
||
lint: | ||
#! /usr/bin/env sh | ||
cd openverse_api | ||
pipenv run pre-commit run --all-files | ||
|
||
|
||
env: | ||
#! /usr/bin/env sh | ||
cp openverse_api/.env.stencil openverse_api/.env | ||
cp ingestion_server/.env.stencil ingestion_server/.env | ||
|
||
DOCKER_FILE := "-f docker-compose.yml" | ||
|
||
# Bring all Docker services up | ||
up: | ||
docker-compose {{ DOCKER_FILE }} up -d | ||
|
||
|
||
# Take all Docker services down | ||
down args="": | ||
docker-compose {{ DOCKER_FILE }} down {{ args }} | ||
|
||
# Show logs of all, or named, Docker services | ||
logs services="": | ||
docker-compose {{ DOCKER_FILE }} logs -f {{ services }} | ||
|
||
|
||
######## | ||
# Init # | ||
######## | ||
|
||
# Create .env files from stencils | ||
env: | ||
cp openverse_api/env.template openverse_api/.env | ||
cp ingestion_server/env.template ingestion_server/.env | ||
|
||
# Load sample data into the Docker Compose services | ||
init: up | ||
./load_sample_data.sh | ||
|
||
|
||
# Make a test cURL request to the API | ||
healthcheck: | ||
curl "http://localhost:8000/v1/images/stats/" | ||
|
||
|
||
test: up | ||
docker-compose exec web ./test/run_test.sh | ||
####### | ||
# Dev # | ||
####### | ||
|
||
# Install Python dependencies in Pipenv environments | ||
install: | ||
cd openverse_api && pipenv install --dev | ||
cd ingestion_server && pipenv install --dev | ||
|
||
testlocal: | ||
#! /usr/bin/env sh | ||
cd openverse_api | ||
pipenv run ./test/run_test.sh | ||
# Setup pre-commit as a Git hook | ||
precommit: | ||
cd openverse_api && pipenv run pre-commit install | ||
|
||
# Run pre-commit to lint and reformat all files | ||
lint: | ||
cd openverse_api && pipenv run pre-commit run --all-files | ||
|
||
|
||
####### | ||
# API # | ||
####### | ||
|
||
logs service="": | ||
docker-compose {{ DOCKER_FILE }} logs -f {{ service }} | ||
# Run API tests inside Docker | ||
test: up | ||
docker-compose exec web ./test/run_test.sh | ||
|
||
# Run API tests locally | ||
testlocal: | ||
cd openverse_api && pipenv run ./test/run_test.sh | ||
|
||
# Run Django administrative commands | ||
dj args="": | ||
#! /usr/bin/env sh | ||
cd openverse_api | ||
pipenv run python manage.py {{ args }} | ||
cd openverse_api && pipenv run python manage.py {{ args }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.