diff --git a/.github/workflows/compatibility_check.yml b/.github/workflows/compatibility_check.yml index f2a403b..eac5e0e 100644 --- a/.github/workflows/compatibility_check.yml +++ b/.github/workflows/compatibility_check.yml @@ -1,4 +1,4 @@ -name: Compatibility Check Workflow +name: Compatibility Check on: workflow_dispatch: @@ -27,12 +27,12 @@ jobs: run: sudo bash compatibility_matrix.sh 3 - name: Commit and Push if not on main branch + env: + MY_PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }} if: github.ref_name != 'main' run: | git config --global user.email "actions@github.com" git config --global user.name "GitHub Actions" git add . - git commit -m "Update compatibility matrix and badges" - git push - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + git commit -m "Update compatibility matrix and badges" -a || echo "No changes to commit" + git push https://${MY_PERSONAL_TOKEN}@github.com/${{ github.repository }} HEAD:${{ github.ref_name }} diff --git a/README.md b/README.md index 04591ac..f5f0903 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,12 @@ [![GitHub issues](https://img.shields.io/github/issues/adamspd/django-appointment)](https://github.com/adamspd/django-appointment/issues) [![GitHub pull requests](https://img.shields.io/github/issues-pr/adamspd/django-appointment)](https://github.com/adamspd/django-appointment/pulls) [![GitHub contributors](https://img.shields.io/github/contributors/adamspd/django-appointment)](https://github.com/adamspd/django-appointment/graphs/contributors) +[![GitHub forks](https://img.shields.io/github/forks/adamspd/django-appointment)](https://github.com/adamspd/django-appointment/forks) +[![GitHub stars](https://img.shields.io/github/stars/adamspd/django-appointment)](https://github.com/adamspd/django-appointment/stargazers) +[![GitHub license](https://img.shields.io/github/license/adamspd/django-appointment)](https://github.com/adamspd/django-appointment/blob/main/LICENSE) +[![Django compatible version](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/adamspd/django-appointment/main/django_compatible.json)](https://github.com/adamspd/django-appointment/blob/main/compatibility_matrix.md) +[![Python compatible version](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/adamspd/django-appointment/main/python_compatible.json)](https://github.com/adamspd/django-appointment/blob/main/compatibility_matrix.md) + ⚠️ **IMPORTANT**: If upgrading from a version before 2.x.x, please note significant database changes were introduced in version 2.0.0. Please read @@ -142,7 +148,8 @@ see their [release notes](https://github.com/adamspd/django-appointment/tree/mai } ``` -5. Next would be to run `python manage.py migrate` to create the appointment models. +5. Next would be to create the migrations and run them by doing `python manage.py makemigrations appointment` and right + after, run `python manage.py migrate` to create the appointment models. 6. Start the Django Q cluster with `python manage.py qcluster`. @@ -257,6 +264,13 @@ Here's how you can set it up: 2. Modify these values as needed for your application, and the app will adapt to the new settings. 3. For further customization, you can extend the provided models, views, and templates or create your own. +## Compatibility Matrix 📊 + +A compatibility matrix is available to help you determine which versions of Django and Python are compatible with the +package. +The matrix is updated regularly to reflect the latest compatibility test results. For more information, please +refer to the [compatibility matrix here](https://github.com/adamspd/django-appointment/blob/main/compatibility_matrix.md). + ## Support 💬 For support or inquiries regarding the Appointment Scheduler app, please refer to the documentation in the "docs" diff --git a/compatibility_matrix.sh b/compatibility_matrix.sh index 3350402..c4f240a 100755 --- a/compatibility_matrix.sh +++ b/compatibility_matrix.sh @@ -99,28 +99,37 @@ generate_badge_json() { local combined_key="${dj_ver}_${py_ver}" # shellcheck disable=SC2155 local result=$(jq -r --arg key "$combined_key" '.[$key]' "$result_file") - echo "Checking result for $combined_key: $result" if [[ "$result" == "PASS" ]]; then - python_compatible+=("$py_ver") - django_compatible+=("$dj_ver") + # shellcheck disable=SC2076 + if ! [[ " ${python_compatible[*]} " =~ " ${py_ver} " ]]; then + python_compatible+=("$py_ver") + fi + # shellcheck disable=SC2076 + if ! [[ " ${django_compatible[*]} " =~ " ${dj_ver} " ]]; then + django_compatible+=("$dj_ver") + fi fi done done - echo "Python compatible versions: ${python_compatible[*]}" - echo "Django compatible versions: ${django_compatible[*]}" + # Remove duplicates and sort versions + readarray -t unique_python_versions < <(printf '%s\n' "${python_compatible[@]}" | sort -uV) + readarray -t unique_django_versions < <(printf '%s\n' "${django_compatible[@]}" | sort -uV) + + echo "Python compatible versions: ${unique_python_versions[*]}" + echo "Django compatible versions: ${unique_django_versions[*]}" echo "{ \"schemaVersion\": 1, - \"label\": \"python\", - \"message\": \"$(IFS=, ; echo "${python_compatible[*]}")\", + \"label\": \"compatible python\", + \"message\": \"$(IFS=' | '; echo "${unique_python_versions[*]}")\", \"color\": \"blue\" }" > "python_compatible.json" echo "{ \"schemaVersion\": 1, - \"label\": \"django\", - \"message\": \"$(IFS=, ; echo "${django_compatible[*]}")\", + \"label\": \"compatible django\", + \"message\": \"$(IFS=' | '; echo "${unique_django_versions[*]}")\", \"color\": \"blue\" }" > "django_compatible.json" } @@ -131,16 +140,17 @@ post_cleanup() { echo "Removing docker images..." # shellcheck disable=SC2155 - local dangling_images=$(docker images -q --filter "dangling=true") - if [ -n "$dangling_images" ]; then - docker rmi "$dangling_images" - fi +# local dangling_images=$(docker images -q --filter "dangling=true") +# if [ -n "$dangling_images" ]; then +# docker rmi "$dangling_images" +# fi echo "Cleanup complete." } # Define directories and files result_dir="test_results" +post_cleanup # Clean up any previous test results result_file="${result_dir}/results.json" # Compatible Python versions for each Django version with prefixed keys @@ -184,5 +194,6 @@ generate_markdown_table echo "Compatibility matrix has been generated: compatibility_matrix.md" echo "Generating compatibility badges..." generate_badge_json +echo "Compatibility badges have been generated: python_compatible.json, django_compatible.json" echo "Cleaning up..." post_cleanup