build(deps): bump astral-sh/setup-uv from 5 to 6 (#1569) #3159
This file contains hidden or 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: 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@v5 | |
with: | |
python-version: "3.10" | |
- name: Install system dependancies | |
run: | | |
sudo apt-get update | |
sudo apt-get install libcrack2-dev | |
- name: Install uv | |
uses: astral-sh/setup-uv@v6 | |
with: | |
version: "0.4.30" | |
enable-cache: true | |
cache-dependency-glob: "uv.lock" | |
- name: Install the project | |
run: uv sync --all-extras --dev --group docs | |
- name: Run tests | |
run: | | |
uv run make -C docs/admin html | |
uv run black --check karaage | |
uv run flake8 karaage | |
uv run ./manage.py makemigrations --settings=karaage.tests.settings --check --dry-run | |
test-mysql: | |
name: Mysql tests | |
runs-on: ubuntu-22.04 | |
if: ${{ github.repository_owner != 'Karaage-Cluster' || github.event_name != 'pull_request' }} | |
env: | |
DATABASE_URL: mysql://root:[email protected]/test | |
steps: | |
- name: Shutdown Ubuntu MySQL | |
run: sudo service mysql stop | |
- name: Install mysql | |
uses: mirromutth/[email protected] | |
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@v5 | |
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 uv | |
uses: astral-sh/setup-uv@v6 | |
with: | |
version: "0.4.30" | |
enable-cache: true | |
cache-dependency-glob: "uv.lock" | |
- name: Install the project | |
run: uv sync --all-extras --dev | |
- name: Run tests | |
run: | | |
uv run ./manage.py collectstatic --settings=karaage.tests.settings --noinput | |
uv run ./manage.py migrate --settings=karaage.tests.settings | |
mkdir test-reports | |
uv 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@v4 | |
with: | |
name: pytest-results-mysql | |
path: test-reports/junit.xml | |
test-postgresql: | |
name: Postgresql tests | |
runs-on: ubuntu-22.04 | |
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: '16' | |
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@v5 | |
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 uv | |
uses: astral-sh/setup-uv@v6 | |
with: | |
version: "0.4.30" | |
enable-cache: true | |
cache-dependency-glob: "uv.lock" | |
- name: Install the project | |
run: uv sync --all-extras --dev | |
- name: Run tests | |
run: | | |
uv run ./manage.py collectstatic --settings=karaage.tests.settings --noinput | |
uv run ./manage.py migrate --settings=karaage.tests.settings | |
mkdir test-reports | |
uv 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@v4 | |
with: | |
name: pytest-results-postgresql | |
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@902fa8ec7d6ecbf8d84d538b9b233a880e428804 | |
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/[email protected] | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: Login to DockerHub | |
uses: docker/[email protected] | |
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/[email protected] | |
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 }} |