Skip to content

Commit 4cf07ec

Browse files
authored
Merge pull request #134 from adamspd/testing-compatibility-check-workflow
Updated script and readme
2 parents df822c8 + 729d34f commit 4cf07ec

File tree

3 files changed

+44
-19
lines changed

3 files changed

+44
-19
lines changed

.github/workflows/compatibility_check.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Compatibility Check Workflow
1+
name: Compatibility Check
22

33
on:
44
workflow_dispatch:
@@ -27,12 +27,12 @@ jobs:
2727
run: sudo bash compatibility_matrix.sh 3
2828

2929
- name: Commit and Push if not on main branch
30+
env:
31+
MY_PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
3032
if: github.ref_name != 'main'
3133
run: |
3234
git config --global user.email "[email protected]"
3335
git config --global user.name "GitHub Actions"
3436
git add .
35-
git commit -m "Update compatibility matrix and badges"
36-
git push
37-
env:
38-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
git commit -m "Update compatibility matrix and badges" -a || echo "No changes to commit"
38+
git push https://${MY_PERSONAL_TOKEN}@github.com/${{ github.repository }} HEAD:${{ github.ref_name }}

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
[![GitHub issues](https://img.shields.io/github/issues/adamspd/django-appointment)](https://github.com/adamspd/django-appointment/issues)
1313
[![GitHub pull requests](https://img.shields.io/github/issues-pr/adamspd/django-appointment)](https://github.com/adamspd/django-appointment/pulls)
1414
[![GitHub contributors](https://img.shields.io/github/contributors/adamspd/django-appointment)](https://github.com/adamspd/django-appointment/graphs/contributors)
15+
[![GitHub forks](https://img.shields.io/github/forks/adamspd/django-appointment)](https://github.com/adamspd/django-appointment/forks)
16+
[![GitHub stars](https://img.shields.io/github/stars/adamspd/django-appointment)](https://github.com/adamspd/django-appointment/stargazers)
17+
[![GitHub license](https://img.shields.io/github/license/adamspd/django-appointment)](https://github.com/adamspd/django-appointment/blob/main/LICENSE)
18+
[![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)
19+
[![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)
20+
1521

1622
⚠️ **IMPORTANT**: If upgrading from a version before 2.x.x, please note significant database changes were introduced in
1723
version 2.0.0. Please read
@@ -142,7 +148,8 @@ see their [release notes](https://github.com/adamspd/django-appointment/tree/mai
142148
}
143149
```
144150

145-
5. Next would be to run `python manage.py migrate` to create the appointment models.
151+
5. Next would be to create the migrations and run them by doing `python manage.py makemigrations appointment` and right
152+
after, run `python manage.py migrate` to create the appointment models.
146153

147154
6. Start the Django Q cluster with `python manage.py qcluster`.
148155

@@ -257,6 +264,13 @@ Here's how you can set it up:
257264
2. Modify these values as needed for your application, and the app will adapt to the new settings.
258265
3. For further customization, you can extend the provided models, views, and templates or create your own.
259266

267+
## Compatibility Matrix 📊
268+
269+
A compatibility matrix is available to help you determine which versions of Django and Python are compatible with the
270+
package.
271+
The matrix is updated regularly to reflect the latest compatibility test results. For more information, please
272+
refer to the [compatibility matrix here](https://github.com/adamspd/django-appointment/blob/main/compatibility_matrix.md).
273+
260274
## Support 💬
261275

262276
For support or inquiries regarding the Appointment Scheduler app, please refer to the documentation in the "docs"

compatibility_matrix.sh

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -99,28 +99,37 @@ generate_badge_json() {
9999
local combined_key="${dj_ver}_${py_ver}"
100100
# shellcheck disable=SC2155
101101
local result=$(jq -r --arg key "$combined_key" '.[$key]' "$result_file")
102-
echo "Checking result for $combined_key: $result"
103102
if [[ "$result" == "PASS" ]]; then
104-
python_compatible+=("$py_ver")
105-
django_compatible+=("$dj_ver")
103+
# shellcheck disable=SC2076
104+
if ! [[ " ${python_compatible[*]} " =~ " ${py_ver} " ]]; then
105+
python_compatible+=("$py_ver")
106+
fi
107+
# shellcheck disable=SC2076
108+
if ! [[ " ${django_compatible[*]} " =~ " ${dj_ver} " ]]; then
109+
django_compatible+=("$dj_ver")
110+
fi
106111
fi
107112
done
108113
done
109114

110-
echo "Python compatible versions: ${python_compatible[*]}"
111-
echo "Django compatible versions: ${django_compatible[*]}"
115+
# Remove duplicates and sort versions
116+
readarray -t unique_python_versions < <(printf '%s\n' "${python_compatible[@]}" | sort -uV)
117+
readarray -t unique_django_versions < <(printf '%s\n' "${django_compatible[@]}" | sort -uV)
118+
119+
echo "Python compatible versions: ${unique_python_versions[*]}"
120+
echo "Django compatible versions: ${unique_django_versions[*]}"
112121

113122
echo "{
114123
\"schemaVersion\": 1,
115-
\"label\": \"python\",
116-
\"message\": \"$(IFS=, ; echo "${python_compatible[*]}")\",
124+
\"label\": \"compatible python\",
125+
\"message\": \"$(IFS=' | '; echo "${unique_python_versions[*]}")\",
117126
\"color\": \"blue\"
118127
}" > "python_compatible.json"
119128

120129
echo "{
121130
\"schemaVersion\": 1,
122-
\"label\": \"django\",
123-
\"message\": \"$(IFS=, ; echo "${django_compatible[*]}")\",
131+
\"label\": \"compatible django\",
132+
\"message\": \"$(IFS=' | '; echo "${unique_django_versions[*]}")\",
124133
\"color\": \"blue\"
125134
}" > "django_compatible.json"
126135
}
@@ -131,16 +140,17 @@ post_cleanup() {
131140

132141
echo "Removing docker images..."
133142
# shellcheck disable=SC2155
134-
local dangling_images=$(docker images -q --filter "dangling=true")
135-
if [ -n "$dangling_images" ]; then
136-
docker rmi "$dangling_images"
137-
fi
143+
# local dangling_images=$(docker images -q --filter "dangling=true")
144+
# if [ -n "$dangling_images" ]; then
145+
# docker rmi "$dangling_images"
146+
# fi
138147

139148
echo "Cleanup complete."
140149
}
141150

142151
# Define directories and files
143152
result_dir="test_results"
153+
post_cleanup # Clean up any previous test results
144154
result_file="${result_dir}/results.json"
145155

146156
# Compatible Python versions for each Django version with prefixed keys
@@ -184,5 +194,6 @@ generate_markdown_table
184194
echo "Compatibility matrix has been generated: compatibility_matrix.md"
185195
echo "Generating compatibility badges..."
186196
generate_badge_json
197+
echo "Compatibility badges have been generated: python_compatible.json, django_compatible.json"
187198
echo "Cleaning up..."
188199
post_cleanup

0 commit comments

Comments
 (0)