build(deps): update django requirement from ~=5.0.7 to ~=5.1.1 #539
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: CI | |
on: | |
- push | |
- pull_request | |
jobs: | |
lint: | |
name: Run linters | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.12" | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.21" | |
- name: Install dependencies | |
run: python -m pip install tox | |
- name: Run tox | |
run: tox -e pep8 | |
test: | |
name: Run unit tests | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# NOTE: If you add a version here, don't forget to update the | |
# '[gh-actions]' section in tox.ini | |
python: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
db: [postgres, mysql, sqlite3] | |
env: | |
DATABASE_TYPE: "${{ matrix.db }}" | |
DATABASE_HOST: "127.0.0.1" | |
DATABASE_NAME: ${{ matrix.db != 'sqlite3' && format('patchwork-db-{0}', github.run_id) || '/dev/shm/patchwork.test.db.sqlite3' }} | |
DATABASE_USER: patchwork-user-${{ github.run_id }} | |
DATABASE_PASSWORD: password-${{ github.run_id }} | |
MYSQL_ROOT_PASSWORD: root-${{ github.run_id }} | |
services: | |
postgres: | |
image: postgres:latest | |
env: | |
POSTGRES_DB: ${{ env.DATABASE_NAME }} | |
POSTGRES_PASSWORD: ${{ env.DATABASE_PASSWORD }} | |
POSTGRES_USER: ${{ env.DATABASE_USER }} | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
mysql: | |
image: mysql:latest | |
env: | |
MYSQL_DATABASE: ${{ env.DATABASE_NAME }} | |
MYSQL_USER: ${{ env.DATABASE_USER }} | |
MYSQL_PASSWORD: ${{ env.DATABASE_PASSWORD }} | |
MYSQL_ROOT_PASSWORD: ${{ env.MYSQL_ROOT_PASSWORD }} | |
ports: | |
- 3306:3306 | |
options: >- | |
--health-cmd="mysqladmin ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install Python dependencies | |
run: python -m pip install tox tox-gh-actions | |
- name: Log database configuration (mysql) | |
if: ${{ matrix.db == 'mysql' }} | |
run: | | |
mysql -h 127.0.0.1 -e "SELECT VERSION(), CURRENT_USER();" \ | |
-uroot -p${MYSQL_ROOT_PASSWORD} ${DATABASE_NAME} | |
- name: Log database configuration (postgres) | |
if: ${{ matrix.db == 'postgres' }} | |
run: | | |
psql -h 127.0.0.1 -c "SELECT VERSION(), CURRENT_USER, current_database()" \ | |
-U ${DATABASE_USER} -d ${DATABASE_NAME} | |
env: | |
PGPASSWORD: ${{ env.DATABASE_PASSWORD }} | |
- name: Modify database user permissions (mysql) | |
if: ${{ matrix.db == 'mysql' }} | |
run: | | |
mysql -h 127.0.0.1 -e "GRANT ALL ON \`test\\_${DATABASE_NAME}%\`.* to '${DATABASE_USER}'@'%';" \ | |
-uroot -p${MYSQL_ROOT_PASSWORD} | |
- name: Run unit tests (via tox) | |
run: tox | |
docs: | |
name: Build docs | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.12" | |
- name: Install dependencies | |
run: python -m pip install tox | |
- name: Build docs (via tox) | |
run: tox -e docs | |
- name: Archive build results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: html-docs-build | |
path: docs/_build/html | |
retention-days: 7 | |
docker-compose: | |
name: Docker Image tests | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
db: [postgres, mysql, sqlite3] | |
env: | |
COMPOSE_FILE: ${{ matrix.db == 'mysql' && 'docker-compose.yml' || (matrix.db == 'postgres' && 'docker-compose-pg.yml') || 'docker-compose-sqlite3.yml' }} | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.12" | |
- name: Build docker-compose service | |
run: | | |
docker-compose build --build-arg UID=$(id -u) --build-arg GID=$(id -g) | |
- name: Test createsuperuser/changepassword | |
run: | | |
docker-compose run -T --rm web \ | |
python manage.py createsuperuser \ | |
--username patchwork --no-input --email [email protected] | |
{ echo patchwork; echo patchwork; } | \ | |
docker-compose run -T --rm web \ | |
python manage.py changepassword patchwork | |
# FIXME(stephenfin): Re-enable this once dbbackup supports Django 4.0 | |
# - name: Test dbbackup/dbrestore | |
# run: | | |
# docker-compose run -T --rm web python manage.py dbbackup | |
# echo y | docker-compose run -T --rm web python manage.py dbrestore | |
- name: Modify database user permissions (mysql) | |
if: ${{ matrix.db == 'mysql' }} | |
run: | | |
docker-compose exec -T -- db \ | |
sh -c "exec mysql -uroot -p\"\${MYSQL_ROOT_PASSWORD}\" -e \"GRANT ALL ON \\\`test\\_\${MYSQL_DATABASE}%\\\`.* to '\${MYSQL_USER}'@'%'; FLUSH PRIVILEGES;\"" | |
- name: Run unittest | |
run: docker-compose run -T --rm web tox | |
- name: Test normal startup | |
run: | | |
docker-compose up --detach | |
for count in $(seq 50); do \ | |
if curl --fail --silent "http://localhost:8000"; then \ | |
break; \ | |
fi; \ | |
sleep 1; echo -n .; \ | |
done | |
echo | |
docker-compose ps | |
- name: Test client access (git-pw) | |
run: | | |
python -m pip install git-pw | |
git pw --debug \ | |
--server http://localhost:8000/api/1.2 --project patchwork \ | |
--username patchwork --password patchwork series list | |
- name: Dump container logs | |
if: ${{ always() }} | |
run: docker-compose logs --no-color --timestamps |