11name : Django CI
22
33on :
4- workflow_run :
5- workflows : ["Build and Push CI Base Image"]
6- types : [completed]
74 push :
85 branches : [ main ]
96 pull_request :
@@ -20,25 +17,12 @@ jobs:
2017 run : |
2118 sudo service postgresql start
2219
23- - name : Test Postgres
24- env :
25- PGPASSWORD : postgres
26- PGHOSTADDR : 127.0.0.1
27-
28- run : |
29- # Test postgres user
30- psql -h localhost -U postgres -d django -c "SELECT version();"
31- psql -h localhost -U postgres -d django_test -c "SELECT 1;"
32- # Test PostGIS extension
33- psql -h localhost -U postgres -d django -c "SELECT PostGIS_version();"
34- psql -h localhost -U postgres -d django_test -c "SELECT PostGIS_version();"
35-
36-
3720 - name : Set up Python ${{ matrix.python-version }}
3821 id : setup-python
3922 uses : actions/setup-python@v5
4023 with :
4124 python-version : ' 3.12'
25+
4226 - name : Cache node packages
4327 uses : actions/cache@v4
4428 env :
@@ -50,18 +34,19 @@ jobs:
5034 ${{ runner.os }}-build-${{ env.cache-name }}-
5135 ${{ runner.os }}-build-
5236 ${{ runner.os }}-
53- - name : Cache node_modules
37+ - name : " "
5438 id : cache-node-modules
5539 uses : actions/cache@v4
5640 with :
5741 path : node_modules
5842 key : ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
5943 restore-keys : |
6044 ${{ runner.os }}-node_modules-
61- - name : Show node_modules cache status
45+ - name : " "
6246 run : |
6347 echo "node_modules cache hit: ${{ steps.cache-node-modules.outputs.cache-hit }}"
6448 ls -la node_modules 2>/dev/null || echo "node_modules directory does not exist"
49+
6550 - name : Cache uv packages
6651 uses : actions/cache@v4
6752 env :
7358 ${{ runner.os }}-build-${{ env.cache-name }}-
7459 ${{ runner.os }}-build-
7560 ${{ runner.os }}-
61+
7662 - name : Cache testmon data
7763 id : cache-testmon
7864 uses : actions/cache@v4
@@ -81,11 +67,10 @@ jobs:
8167 key : ${{ runner.os }}-testmon-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/requirements/dev.txt', 'adhocracy-plus/config/settings/*.py', 'pytest.ini') }}
8268 restore-keys : |
8369 ${{ runner.os }}-testmon-${{ steps.setup-python.outputs.python-version }}-
84-
85- - name : Show testmon cache status
86- run : |
70+ - run : |
8771 echo "testmon cache hit: ${{ steps.cache-testmon.outputs.cache-hit }}"
8872 ls -la .testmondata || true
73+
8974 - name : check a4 hashes equal
9075 run : |
9176 ./scripts/a4-check.sh
@@ -102,22 +87,28 @@ jobs:
10287 run : |
10388 python manage.py collectstatic > /dev/null
10489 # Einmalig Cache löschen, um Settings-Mismatch auszuschließen
105- py.test --ds=adhocracy-plus.config.settings.travis --testmon --cov
10690 isort --diff -c adhocracy-plus tests
10791 python manage.py makemigrations --dry-run --check --noinput
10892 flake8 adhocracy-plus tests --exclude migrations,settings
109-
110- - name : Configure Git for Coveralls
93+
94+ - name : " "
95+ if : github.ref == 'refs/heads/main' && github.event_name == 'push'
11196 run : |
112- git config --global --add safe.directory /__w/adhocracy-plus/adhocracy-plus
113- git config --global user.name "GitHub Actions"
114- git config --global user.email "[email protected] " 115-
97+ py.test --ds=adhocracy-plus.config.settings.travis --cov
98+
99+ - name : " "
100+ if : github.event_name == 'pull_request'
101+ run : |
102+ py.test --ds=adhocracy-plus.config.settings.travis --testmon --cov
103+
116104 - name : Coveralls
117- env :
105+ - env :
118106 COVERALLS_SERVICE_NAME : github-actions
119107 GITHUB_TOKEN : ${{ secrets.COV }}
120108 run : |
109+ git config --global --add safe.directory /__w/adhocracy-plus/adhocracy-plus
110+ git config --global user.name "GitHub Actions"
111+ git config --global user.email "[email protected] " 121112 coveralls
122113
123114 - name : Install NPM Dependencies
@@ -137,6 +128,7 @@ jobs:
137128 run : |
138129 npm test
139130 npm run lint
131+
140132 - name : Deploy
141133 if : github.ref == 'refs/heads/main'
142134 env :
0 commit comments