Refactor how the initial .env is created #711
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
name: CI | |
on: | |
push: | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Just for running commands | |
uses: extractions/setup-just@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup NPM caching | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-lint-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-lint- | |
- name: Setup pip caching | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/dev_lock.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Setup Node version 16.17 | |
uses: actions/setup-node@v3 | |
- name: Setup Python 3.11 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Install Node requirements | |
run: npm ci | |
- name: Install Python requirements | |
run: | | |
python -m pip install --upgrade setuptools wheel pip | |
python -m pip install -r config/requirements/dev_lock.txt | |
- name: Run linting | |
run: | | |
PYTHON_CMD_PREFIX="" NODE_CMD_PREFIX="" just lint | |
env: | |
SECRET_KEY: secret-key-for-testing-only | |
DEBUG: on | |
PYTHON_CMD_PREFIX_WITH_DEPS: "" | |
PYTHON_CMD_PREFIX: "" | |
NODE_CMD_PREFIX: "" | |
test: | |
runs-on: ubuntu-latest | |
name: Tests install script | |
env: | |
BUILD_DIR: /home/runner/work/django-base-site/new_project/ | |
SECRET_KEY: secret-key-for-testing-only | |
READ_DOT_ENV_FILE: on | |
DOCKER_COMPOSE_PREFIX: docker compose run -u root --rm --no-deps web | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Just for running commands | |
uses: extractions/setup-just@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Test install script | |
run: | | |
./scripts/start_new_project "example" ${GITHUB_REF#refs/heads/} 1 ${{ env.BUILD_DIR }} | |
- name: Build docker images | |
working-directory: ${{ env.BUILD_DIR }} | |
run: docker compose build web node | |
- name: Build assets | |
working-directory: ${{ env.BUILD_DIR }} | |
run: just build_assets | |
- name: Collect static | |
working-directory: ${{ env.BUILD_DIR }} | |
run: ${{ env.DOCKER_COMPOSE_PREFIX }} ./manage.py collectstatic --no-input | |
- name: Run tests | |
working-directory: ${{ env.BUILD_DIR }} | |
run: ${{ env.DOCKER_COMPOSE_PREFIX }} pytest --cov --ds=config.settings.test_runner |