Skip to content

Bump django from 4.2.5 to 4.2.6 #2000

Bump django from 4.2.5 to 4.2.6

Bump django from 4.2.5 to 4.2.6 #2000

Workflow file for this run

name: Python application
on: [push, pull_request, merge_group]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
test:
name: Databaseless tests
runs-on: ubuntu-latest
if: ${{ github.repository_owner != 'Karaage-Cluster' || github.event_name != 'pull_request' }}
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install system dependancies
run: |
sudo apt-get update
sudo apt-get install libcrack2-dev
- name: Install poetry
uses: abatilo/actions-poetry@v2.3.0
with:
poetry-version: 1.3.0
- name: Install python dependancies
run: |
poetry install --extras=docs
- name: Run tests
run: |
poetry run make -C docs/admin html
poetry run black --check karaage
poetry run flake8 karaage
poetry run ./manage.py makemigrations --settings=karaage.tests.settings --check --dry-run
test-mysql:
name: Mysql tests
runs-on: ubuntu-latest
if: ${{ github.repository_owner != 'Karaage-Cluster' || github.event_name != 'pull_request' }}
env:
DATABASE_URL: mysql://root:z9Pm29jg9EfJ6m@127.0.0.1/test
steps:
- name: Shutdown Ubuntu MySQL
run: sudo service mysql stop
- name: Install mysql
uses: mirromutth/mysql-action@v1.1
with:
mysql version: '8.0'
mysql database: 'test'
mysql user: 'test'
mysql password: 'z9Pm29jg9EfJ6m'
mysql root password: 'z9Pm29jg9EfJ6m'
- name: Checkout source code
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install system dependancies
run: |
sudo apt-get update
sudo apt-get install libcrack2-dev slapd ldap-utils
- name: Remove apparmor restrictions on slapd
run: |
sudo apt-get install apparmor-utils
sudo aa-complain /usr/sbin/slapd
- name: Install poetry
uses: abatilo/actions-poetry@v2.3.0
with:
poetry-version: 1.3.0
- name: Install python dependancies
run: |
poetry install
- name: Run tests
run: |
poetry run ./manage.py collectstatic --settings=karaage.tests.settings --noinput
poetry run ./manage.py migrate --settings=karaage.tests.settings
mkdir test-reports
poetry run python -m tldap.test.slapd python -m pytest --cov=karaage --junitxml=test-reports/junit.xml
- name: Upload pytest test results
uses: actions/upload-artifact@v3
with:
name: pytest-results
path: test-reports/junit.xml
test-postgresql:
name: Postgresql tests
runs-on: ubuntu-latest
if: ${{ github.repository_owner != 'Karaage-Cluster' || github.event_name != 'pull_request' }}
env:
DATABASE_URL: postgresql://test:z9Pm29jg9EfJ6m@localhost/test?sslmode=disable
steps:
- name: Install postgresql
uses: harmon758/postgresql-action@v1
with:
postgresql version: '12'
postgresql db: 'test'
postgresql user: 'test'
postgresql password: 'z9Pm29jg9EfJ6m'
- name: Checkout source code
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install system dependancies
run: |
sudo apt-get update
sudo apt-get install libcrack2-dev slapd ldap-utils
- name: Remove apparmor restrictions on slapd
run: |
sudo apt-get install apparmor-utils
sudo aa-complain /usr/sbin/slapd
- name: Install poetry
uses: abatilo/actions-poetry@v2.3.0
with:
poetry-version: 1.3.0
- name: Install python dependancies
run: |
poetry install
- name: Run tests
run: |
poetry run ./manage.py collectstatic --settings=karaage.tests.settings --noinput
poetry run ./manage.py migrate --settings=karaage.tests.settings
mkdir test-reports
poetry run python -m tldap.test.slapd python -m pytest --cov=karaage --junitxml=test-reports/junit.xml
- name: Upload pytest test results
uses: actions/upload-artifact@v3
with:
name: pytest-results
path: test-reports/junit.xml
setup-build-publish-deploy:
name: Setup, Build, Publish, and Deploy
runs-on: ubuntu-latest
needs: [test, test-mysql, test-postgresql]
if: ${{ github.repository_owner != 'Karaage-Cluster' || github.event_name == 'push' }}
steps:
- name: downcase IMAGE_NAME
run: |
echo "IMAGE_NAME_LC=${IMAGE_NAME,,}" >>${GITHUB_ENV}
- name: Checkout
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LC }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=sha, format=long
- name: Docker meta
id: brianmay_meta
uses: brianmay/docker-meta@main
- name: Set up QEMU
uses: docker/setup-qemu-action@v3.0.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.0.0
- name: Login to DockerHub
uses: docker/login-action@v3.0.0
if: ${{ github.repository_owner == 'Karaage-Cluster' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags')) && github.event_name == 'push' }}
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v5.0.0
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
push: ${{ github.repository_owner == 'Karaage-Cluster' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags')) && github.event_name == 'push' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LC }}:main
cache-to: type=inline
build-args: ${{ steps.brianmay_meta.outputs.build-args }}
publish-pypi-prod:
name: Publish Pypi Prod
runs-on: ubuntu-latest
needs: [test, test-mysql, test-postgresql]
if: github.repository_owner == 'Karaage-Cluster' && startsWith(github.ref, 'refs/tags') && github.event_name == 'push'
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install poetry
uses: abatilo/actions-poetry@v2.3.0
with:
poetry-version: 1.3.0
- name: Install system dependancies
run: |
sudo apt-get update
sudo apt-get install libcrack2-dev
- name: Install python dependancies
run: |
poetry install
- name: Verify git tag vs. version
run: |
VERSION=${GITHUB_REF#refs/tags/}
test "$(poetry version)" = "karaage ${VERSION}"
- name: Create packages
run: |
poetry build
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_PASSWORD }}