Skip to content

Commit 1478f26

Browse files
committed
ci: move from TeamCity to GitHub actions
1 parent 525391a commit 1478f26

19 files changed

+95
-67
lines changed

.github/workflows/linters.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Linters
2+
3+
on:
4+
pull_request:
5+
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.ref }}
8+
cancel-in-progress: true
9+
10+
jobs:
11+
flake8:
12+
name: flake8
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
- name: Set up Python
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: '3.8'
21+
- run: python -m pip install flake8
22+
- name: flake8
23+
uses: liskin/gh-problem-matcher-wrap@v2
24+
with:
25+
linters: flake8
26+
run: flake8
27+
28+
isort:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v4
33+
- name: Set up Python
34+
uses: actions/setup-python@v4
35+
with:
36+
python-version: '3.8'
37+
- run: python -m pip install isort
38+
- name: isort
39+
uses: liskin/gh-problem-matcher-wrap@v2
40+
with:
41+
linters: isort
42+
run: isort --check --diff .

.github/workflows/tests.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Django test suite
2+
3+
on:
4+
pull_request:
5+
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.ref }}
8+
cancel-in-progress: true
9+
10+
jobs:
11+
python38:
12+
runs-on: ubuntu-22.04
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
include:
17+
- crdb-version: v22.1.18
18+
use_psycopg2: psycopg2
19+
- crdb-version: v22.2.7
20+
- crdb-version: v22.2.7
21+
use_psycopg2: psycopg2
22+
- crdb-version: v22.2.7
23+
use_server_side_binding: server_side_binding
24+
# Uncomment to enable testing of CockroachDB nightly.
25+
#- crdb-version: LATEST
26+
#- crdb-version: LATEST
27+
# use_psycopg2: psycopg2
28+
#- crdb-version: LATEST
29+
# use_server_side_binding: server_side_binding
30+
steps:
31+
- uses: actions/checkout@v4
32+
- uses: actions/setup-python@v4
33+
with:
34+
python-version: '3.8'
35+
- name: Install system packages for Django's Python test dependencies
36+
run: |
37+
sudo apt-get update
38+
sudo apt-get install binutils gdal-bin
39+
- name: Run build.sh
40+
run: bash django-test-suite/build.sh ${{ matrix.crdb-version }}
41+
env:
42+
USE_PSYCOPG2: ${{ matrix.use_psycopg2 }}
43+
USE_SERVER_SIDE_BINDING: ${{ matrix.use_server_side_binding }}

teamcity-build/build-teamcity.sh renamed to django-test-suite/build.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/usr/bin/env bash
22
set -x
33

4-
# this script is meant to be invoked by one of the build-teamcity-$VERSION.sh scripts
5-
6-
VERSION="${1:-v19.2.5}"
4+
# This script expects the first argument to be a CockroachDB version like
5+
# "v22.1.18" or "LATEST" to test with the nightly CockroachDB build.
6+
VERSION=$1
77

88
# clone django into the repo.
99
rm -rf _django_repo
@@ -13,10 +13,10 @@ git clone --depth 1 --single-branch --branch cockroach-4.2.x https://github.com/
1313
cd _django_repo/tests/
1414
pip3 install -e ..
1515
pip3 install -r requirements/py3.txt
16-
if [[ -z "${USE_PSYCOPG2}" ]]; then
17-
pip3 install -r requirements/postgres.txt
18-
else
16+
if [ "${USE_PSYCOPG2}" == "psycopg2" ]; then
1917
pip3 install psycopg2
18+
else
19+
pip3 install -r requirements/postgres.txt
2020
fi
2121
cd ../..
2222

@@ -43,8 +43,8 @@ fi
4343
cd _django_repo/tests/
4444

4545
# Bring in the settings needed to run the tests with cockroach.
46-
cp ../../teamcity-build/cockroach_settings.py .
47-
cp ../../teamcity-build/cockroach_gis_settings.py .
46+
cp ../../django-test-suite/cockroach_settings.py .
47+
cp ../../django-test-suite/cockroach_gis_settings.py .
4848

4949
# Run the tests!
50-
python3 ../../teamcity-build/runtests.py
50+
python3 ../../django-test-suite/runtests.py

teamcity-build/cockroach_settings.py renamed to django-test-suite/cockroach_settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
'OPTIONS': {},
2121
},
2222
}
23-
if os.environ.get('USE_SERVER_SIDE_BINDING'):
23+
if os.environ.get('USE_SERVER_SIDE_BINDING') == 'server_side_binding':
2424
DATABASES['default']['OPTIONS']['server_side_binding'] = True
2525
DATABASES['other']['OPTIONS']['server_side_binding'] = True
2626

File renamed without changes.

teamcity-build/build-flake8.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

teamcity-build/build-isort.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

teamcity-build/build-teamcity-20.2.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

teamcity-build/build-teamcity-21.1.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)