Skip to content

Commit e740aa6

Browse files
JacobCoffeehugovk
andauthored
Deduplicate CI spam (#2852)
Co-authored-by: Hugo van Kemenade <[email protected]>
1 parent 7419bdc commit e740aa6

File tree

2 files changed

+68
-35
lines changed

2 files changed

+68
-35
lines changed

.github/workflows/ci.yml

Lines changed: 63 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,46 @@
11
name: CI
2-
on: [push, pull_request]
2+
3+
on: [push, pull_request, workflow_dispatch]
4+
35
jobs:
6+
migrations:
7+
if: github.event_name != 'push' || github.event.repository.fork == true
8+
runs-on: ubuntu-latest
9+
services:
10+
postgres:
11+
image: postgres:15.3
12+
env:
13+
POSTGRES_USER: postgres
14+
POSTGRES_PASSWORD: postgres
15+
POSTGRES_DB: pythonorg
16+
ports:
17+
- 5432:5432
18+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
19+
20+
steps:
21+
- uses: actions/checkout@v6
22+
23+
- uses: actions/setup-python@v6
24+
with:
25+
python-version-file: '.python-version'
26+
27+
- name: Cache pip
28+
uses: actions/cache@v5
29+
with:
30+
path: ~/.cache/pip
31+
key: ${{ runner.os }}-pip-${{ hashFiles('*-requirements.txt') }}
32+
restore-keys: ${{ runner.os }}-pip-
33+
34+
- name: Install dependencies
35+
run: pip install -r dev-requirements.txt
36+
37+
- name: Check for ungenerated migrations
38+
run: python manage.py makemigrations --check --dry-run
39+
env:
40+
DATABASE_URL: postgres://postgres:postgres@localhost:5432/pythonorg
41+
442
test:
5-
# Avoid running CI more than once on pushes to main repo open PRs
6-
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
43+
if: github.event_name != 'push' || github.event.repository.fork == true
744
runs-on: ubuntu-latest
845
services:
946
postgres:
@@ -13,52 +50,46 @@ jobs:
1350
POSTGRES_PASSWORD: postgres
1451
POSTGRES_DB: pythonorg
1552
ports:
16-
- 5432:5432
17-
# needed because the postgres container does not provide a healthcheck
53+
- 5432:5432
1854
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
55+
1956
steps:
20-
- name: Check out repository
21-
uses: actions/checkout@v6
57+
- uses: actions/checkout@v6
58+
2259
- name: Install platform dependencies
2360
run: |
2461
sudo apt -y update
2562
sudo apt -y install --no-install-recommends \
26-
texlive-latex-base \
27-
texlive-latex-recommended \
28-
texlive-plain-generic \
29-
lmodern
63+
texlive-latex-base \
64+
texlive-latex-recommended \
65+
texlive-plain-generic \
66+
lmodern
67+
3068
- name: Install pandoc
3169
run: |
3270
wget https://github.com/jgm/pandoc/releases/download/2.17.1.1/pandoc-2.17.1.1-1-amd64.deb
3371
sudo dpkg -i pandoc-2.17.1.1-1-amd64.deb
72+
3473
- uses: actions/setup-python@v6
3574
with:
36-
python-version-file: '.python-version'
37-
- name: Cache Python dependencies
75+
python-version-file: '.python-version'
76+
77+
- name: Cache pip
3878
uses: actions/cache@v5
39-
env:
40-
cache-name: pythondotorg-cache-pip
4179
with:
4280
path: ~/.cache/pip
43-
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('requirements.txt', '*-requirements.txt') }}
44-
restore-keys: |
45-
${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-
46-
${{ runner.os }}-${{ github.job }}-
47-
${{ runner.os }}-
48-
- name: Install Python dependencies
81+
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt', '*-requirements.txt') }}
82+
restore-keys: ${{ runner.os }}-pip-
83+
84+
- name: Install dependencies
4985
run: |
5086
pip install -U pip setuptools wheel
5187
pip install -r dev-requirements.txt
52-
- name: Check for ungenerated database migrations
53-
run: |
54-
python manage.py makemigrations --check --dry-run
55-
env:
56-
DATABASE_URL: postgres://postgres:postgres@localhost:5432/pythonorg
57-
- name: Run Tests
58-
run: |
59-
python -Wd -m coverage run manage.py test -v2
88+
89+
- name: Run tests
90+
run: python -Wd -m coverage run manage.py test -v2
6091
env:
6192
DATABASE_URL: postgres://postgres:postgres@localhost:5432/pythonorg
62-
- name: Coverage
63-
run: |
64-
coverage report -m --fail-under=75
93+
94+
- name: Check coverage
95+
run: coverage report -m --fail-under=75

.github/workflows/static.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
name: Check collectstatic
2-
on: [push, pull_request]
2+
3+
on: [push, pull_request, workflow_dispatch]
4+
35
jobs:
46
collectstatic:
5-
# Avoid running CI more than once on pushes to main repo open PRs
6-
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
7+
if: github.event_name != 'push' || github.event.repository.fork == true
78
runs-on: ubuntu-latest
89
steps:
910
- name: Check out repository
1011
uses: actions/checkout@v6
12+
1113
- uses: actions/setup-python@v6
1214
with:
1315
python-version-file: '.python-version'

0 commit comments

Comments
 (0)