Skip to content

Commit 05c6439

Browse files
larseggertNGPixel
andauthored
ci: Run the test suite for PRs and pushes (ietf-tools#3658)
Co-authored-by: Nicolas Giard <github@ngpixel.com>
1 parent cfc301d commit 05c6439

2 files changed

Lines changed: 58 additions & 0 deletions

File tree

.github/workflows/ci-run-tests.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Run All Tests
2+
3+
on:
4+
pull_request:
5+
branches:
6+
# TEMPORARY: Replace with main once bs5 is merged
7+
- 'feat/bs5'
8+
9+
jobs:
10+
tests:
11+
name: Run Tests
12+
runs-on: ubuntu-latest
13+
container: ghcr.io/ietf-tools/datatracker-test-base:latest
14+
15+
services:
16+
db:
17+
image: ghcr.io/ietf-tools/datatracker-db:latest
18+
volumes:
19+
- mariadb-data:/var/lib/mysql
20+
env:
21+
MYSQL_ROOT_PASSWORD: ietf
22+
MYSQL_DATABASE: ietf_utf8
23+
MYSQL_USER: django
24+
MYSQL_PASSWORD: RkTkDPFnKpko
25+
26+
steps:
27+
- uses: actions/checkout@v3
28+
29+
- name: Prepare for tests
30+
run: |
31+
echo "Running containers:"
32+
docker ps -a
33+
echo "Fixing permissions..."
34+
chmod -R 777 ./
35+
echo "Copying docker config files..."
36+
cp ./docker/configs/settings_local.py ./ietf/settings_local.py
37+
cp ./docker/configs/settings_local_sqlitetest.py ./ietf/settings_local_sqlitetest.py
38+
echo "Installing NPM packages..."
39+
npm install --prefer-offline --no-audit
40+
echo "Building static assets..."
41+
npx parcel build
42+
echo "Creating data directories..."
43+
chmod +x ./docker/scripts/app-create-dirs.sh
44+
./docker/scripts/app-create-dirs.sh
45+
46+
- name: Ensure DB is ready
47+
run: |
48+
/usr/local/bin/wait-for db:3306 -- echo "DB ready"
49+
50+
- name: Run all tests
51+
run: |
52+
echo "Running checks..."
53+
./ietf/manage.py check --settings=settings_local
54+
echo "Running tests..."
55+
./ietf/manage.py test --settings=settings_local_sqlitetest --failfast

docker/scripts/app-init.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ echo "Running initial checks..."
9898
echo "Done!"
9999

100100
if [ -z "$EDITOR_VSCODE" ]; then
101+
CODE=0
101102
python -m smtpd -n -c DebuggingServer localhost:2025 &
102103
if [ -z "$*" ]; then
103104
echo
@@ -112,6 +113,8 @@ if [ -z "$EDITOR_VSCODE" ]; then
112113
echo "Executing \"$*\" and stopping container."
113114
echo
114115
bash -c "$*"
116+
CODE=$?
115117
fi
116118
service rsyslog stop
119+
exit $CODE
117120
fi

0 commit comments

Comments
 (0)