ci: Run the test suite for PRs and pushes (#3658)

Co-authored-by: Nicolas Giard <github@ngpixel.com>
This commit is contained in:
Lars Eggert 2022-03-19 12:09:15 +01:00 committed by GitHub
parent cfc301d2d0
commit 05c643964b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 58 additions and 0 deletions

55
.github/workflows/ci-run-tests.yml vendored Normal file
View file

@ -0,0 +1,55 @@
name: Run All Tests
on:
pull_request:
branches:
# TEMPORARY: Replace with main once bs5 is merged
- 'feat/bs5'
jobs:
tests:
name: Run Tests
runs-on: ubuntu-latest
container: ghcr.io/ietf-tools/datatracker-test-base:latest
services:
db:
image: ghcr.io/ietf-tools/datatracker-db:latest
volumes:
- mariadb-data:/var/lib/mysql
env:
MYSQL_ROOT_PASSWORD: ietf
MYSQL_DATABASE: ietf_utf8
MYSQL_USER: django
MYSQL_PASSWORD: RkTkDPFnKpko
steps:
- uses: actions/checkout@v3
- name: Prepare for tests
run: |
echo "Running containers:"
docker ps -a
echo "Fixing permissions..."
chmod -R 777 ./
echo "Copying docker config files..."
cp ./docker/configs/settings_local.py ./ietf/settings_local.py
cp ./docker/configs/settings_local_sqlitetest.py ./ietf/settings_local_sqlitetest.py
echo "Installing NPM packages..."
npm install --prefer-offline --no-audit
echo "Building static assets..."
npx parcel build
echo "Creating data directories..."
chmod +x ./docker/scripts/app-create-dirs.sh
./docker/scripts/app-create-dirs.sh
- name: Ensure DB is ready
run: |
/usr/local/bin/wait-for db:3306 -- echo "DB ready"
- name: Run all tests
run: |
echo "Running checks..."
./ietf/manage.py check --settings=settings_local
echo "Running tests..."
./ietf/manage.py test --settings=settings_local_sqlitetest --failfast

View file

@ -98,6 +98,7 @@ echo "Running initial checks..."
echo "Done!"
if [ -z "$EDITOR_VSCODE" ]; then
CODE=0
python -m smtpd -n -c DebuggingServer localhost:2025 &
if [ -z "$*" ]; then
echo
@ -112,6 +113,8 @@ if [ -z "$EDITOR_VSCODE" ]; then
echo "Executing \"$*\" and stopping container."
echo
bash -c "$*"
CODE=$?
fi
service rsyslog stop
exit $CODE
fi