-
Notifications
You must be signed in to change notification settings - Fork 43
85 lines (83 loc) · 2.79 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: CI
on:
push:
pull_request:
branches:
- main
- task/upgrade-python-packages
- task/upgrade-python-packages
workflow_dispatch:
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Just for running commands
run: curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /usr/local/bin
- name: Setup NPM caching
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-lint-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-lint-
- name: Setup pip caching
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/dev_lock.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Setup uv caching
uses: actions/cache@v4
with:
path: ~/.cache/uv
key: ${{ runner.os }}-uv-${{ hashFiles('**/dev_lock.txt') }}
restore-keys: |
${{ runner.os }}-uv-
- name: Setup Node
uses: actions/setup-node@v4
- name: Setup Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Node requirements
run: npm ci
- name: Install Python requirements
run: |
pip install --upgrade uv
uv pip install --system -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@v4
- name: Use Just for running commands
run: curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /usr/local/bin
- 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_frontend
- name: Run tests
working-directory: ${{ env.BUILD_DIR }}
run: ${{ env.DOCKER_COMPOSE_PREFIX }} pytest --cov --ds=config.settings.test_runner