Skip to content

chore(deps): bump pydantic from 2.10.6 to 2.12.4 #1126

chore(deps): bump pydantic from 2.10.6 to 2.12.4

chore(deps): bump pydantic from 2.10.6 to 2.12.4 #1126

Workflow file for this run

name: Python check
on:
workflow_call:
inputs:
push_docker_image:
type: string # true or false
default: "false"
secrets:
CODECOV_TOKEN:
required: true
outputs:
docker_image_name:
description: "Only docker image name"
value: ${{ jobs.test.outputs.docker_image_name }}
docker_image_tag:
description: "Only docker image tag"
value: ${{ jobs.test.outputs.docker_image_tag }}
docker_image:
description: "docker image with tag"
value: ${{ jobs.test.outputs.docker_image }}
pull_request:
# NOTE: For other, they should be run through helm github action ./helm-publish.yml
env:
COMPOSE_FILE: docker-compose.yaml:.github/gh-docker-compose.yaml
SECRET_KEY: "ci-test-insecure-django-secret-key"
COMPOSE_BAKE: true
jobs:
pre_commit_checks:
name: Pre-Commit checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
with:
submodules: true
- uses: actions/setup-python@v5
with:
python-version-file: '.python-version'
- uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: gdal-bin libgdal-dev
- name: Setup uv python environment
run: uv venv
- name: uv lock check
run: uv lock --locked --offline
- name: uv sync
run: uv sync --all-groups --all-extras
- uses: pre-commit/action@main
test:
name: Test
runs-on: ubuntu-latest
needs: pre_commit_checks
outputs:
docker_image_name: ${{ steps.prep.outputs.tagged_image_name }}
docker_image_tag: ${{ steps.prep.outputs.tag }}
docker_image: ${{ steps.prep.outputs.tagged_image }}
steps:
- uses: actions/checkout@main
with:
submodules: true
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
if: ${{ inputs.push_docker_image }}
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 🐳 Prepare Docker
id: prep
env:
IMAGE_NAME: ghcr.io/${{ github.repository }}
run: |
BRANCH_NAME=$(echo $GITHUB_REF_NAME | sed 's|:|-|' | tr '[:upper:]' '[:lower:]' | sed 's/_/-/g' | cut -c1-100 | sed 's/-*$//')
# NOTE: `c` is to avoid error by helm if GITHUB_SHA[:7] has only numbers
GIT_HASH="c$(echo $GITHUB_SHA | head -c7)"
# XXX: Check if there is a slash in the BRANCH_NAME eg: project/add-docker
if [[ "$BRANCH_NAME" == *"/"* ]]; then
# XXX: Change the docker image package to -dev
IMAGE_NAME="$IMAGE_NAME-dev"
TAG="$(echo "$BRANCH_NAME" | sed 's|/|-|g').$(echo $GIT_HASH)"
else
TAG="$BRANCH_NAME.$(echo $GIT_HASH)"
fi
IMAGE_NAME=$(echo $IMAGE_NAME | tr '[:upper:]' '[:lower:]')
echo "tagged_image_name=${IMAGE_NAME}" >> $GITHUB_OUTPUT
echo "tag=${TAG}" >> $GITHUB_OUTPUT
echo "tagged_image=${IMAGE_NAME}:${TAG}" >> $GITHUB_OUTPUT
echo "::notice::Tagged docker image: ${IMAGE_NAME}:${TAG}"
- name: Start firebase emulator (in background)
env:
DOCKER_IMAGE: ${{ steps.prep.outputs.tagged_image }}
run: |
# TODO: Also move docker pull process in the background
docker compose up -d firebase-test
- name: 🐳 Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: 🐳 Build image
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
push: false
load: true
tags: ${{ steps.prep.outputs.tagged_image }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Start app resources
timeout-minutes: 1
env:
DOCKER_IMAGE: ${{ steps.prep.outputs.tagged_image }}
run: |
timeout 60s docker compose run --rm test ./manage.py wait_for_resources --all || {
echo 'Failed to wait for resources'
docker compose logs
exit 1
}
- name: Validate if there are no pending django migrations.
env:
DOCKER_IMAGE: ${{ steps.prep.outputs.tagged_image }}
run: |
docker compose run --rm test ./manage.py makemigrations --check --dry-run || {
echo 'There are some changes to be reflected in the migration. Make sure to run makemigrations';
exit 1;
}
- name: Validate latest graphQl schema.
env:
DOCKER_IMAGE: ${{ steps.prep.outputs.tagged_image }}
run: |
docker compose run --rm test ./manage.py graphql_schema --out /ci-share/schema-latest.graphql &&
cmp --silent schema.graphql ./ci-share/schema-latest.graphql || {
echo 'The schema.graphql is not up to date with the latest changes. Please update and push latest';
diff schema.graphql ./ci-share/schema-latest.graphql;
exit 1;
}
- name: 🤞 Run Test 🧪 & Publish coverage to code climate
env:
DOCKER_IMAGE: ${{ steps.prep.outputs.tagged_image }}
run: docker compose run --rm test /code/misc/run_tests.sh
- name: Upload test coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
- name: Upload test results to Codecov
uses: codecov/test-results-action@v1
if: ${{ !cancelled() }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
- name: 🐳 Docker push
if: ${{ inputs.push_docker_image }}
env:
IMAGE_TAG: ${{ steps.prep.outputs.tagged_image }}
run: docker push $IMAGE_TAG
validate_helm:
name: Validate Helm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- name: Install Helm
uses: azure/setup-helm@v4
- name: 🐳 Helm dependency
run: |
yq --indent 0 '.dependencies | map(select(.repository | test("^oci:") | not)) | map(["helm", "repo", "add", .name, .repository] | join(" ")) | .[]' ./helm/Chart.lock | sh --
helm dependency build ./helm/
- name: Helm lint
run: helm lint ./helm --values ./helm/linter_values.yaml
- name: Helm template
run: helm template ./helm --values ./helm/linter_values.yaml