-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (115 loc) · 4.28 KB
/
Copy pathdjango.yml
File metadata and controls
130 lines (115 loc) · 4.28 KB
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Django CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-24.04
# Use your self-built image as container for the entire job
container: ghcr.io/${{ github.repository }}/ci-base:latest
steps:
- uses: actions/checkout@v4
- name: Start PostgreSQL
run: |
sudo service postgresql start
- name: Set up Python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Cache node packages
uses: actions/cache@v4
env:
cache-name: cache-node-packages
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cache node Modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node_modules-
- name: Cache uv packages
uses: actions/cache@v4
env:
cache-name: cache-uv-packages
with:
path: ~/.cache/uv
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/requirements/dev.txt') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cache testmon data
id: cache-testmon
uses: actions/cache@v4
with:
path: .testmondata
key: ${{ runner.os }}-testmon-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/requirements/dev.txt', 'adhocracy-plus/config/settings/*.py', 'pytest.ini') }}
restore-keys: |
${{ runner.os }}-testmon-${{ steps.setup-python.outputs.python-version }}-
- name: Checks
run: |
echo "node_modules cache hit: ${{ steps.cache-node-modules.outputs.cache-hit }}"
ls -la node_modules 2>/dev/null || echo "node_modules directory does not exist"
echo "testmon cache hit: ${{ steps.cache-testmon.outputs.cache-hit }}"
ls -la .testmondata || true
./scripts/a4-check.sh
- name: Install Python Dependencies
run: |
uv pip install -r requirements/dev.txt --system
uv pip install coveralls --system
- name: Run Tests
env:
PGPASSWORD: postgres
PGHOSTADDR: 127.0.0.1
run: |
python manage.py collectstatic > /dev/null
isort --diff -c adhocracy-plus tests
python manage.py makemigrations --dry-run --check --noinput
flake8 adhocracy-plus tests --exclude migrations,settings
if [ "${{ github.ref }}" = "refs/heads/main" ] && [ "${{ github.event_name }}" = "push" ]; then
py.test --ds=adhocracy-plus.config.settings.travis --cov
elif [ "${{ github.event_name }}" = "pull_request" ]; then
py.test --ds=adhocracy-plus.config.settings.travis --testmon --cov
fi
- name: Coveralls
continue-on-error: true
env:
COVERALLS_SERVICE_NAME: github-actions
GITHUB_TOKEN: ${{ secrets.COV }}
run: |
git config --global --add safe.directory /__w/a4-roots/a4-roots
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
coveralls
- name: Install NPM Dependencies
run: |
if [ -d node_modules ] && [ -f package-lock.json ]; then
echo "node_modules cache hit - skipping npm ci"
else
echo "node_modules cache miss - running npm ci"
npm ci --prefer-offline --no-audit --no-fund
fi
- name: Build NPM
run: |
npm run build
- name: Run Frontend Tests
run: |
npm test
npm run lint
- name: Deploy
if: github.ref == 'refs/heads/main'
env:
TRAVIS_SSH_SECRET: ${{ secrets.DEPLOY }}
run: |
./scripts/deploy.sh