Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: README Badges and Execexam Logo #19

Closed
wants to merge 70 commits into from
Closed
Show file tree
Hide file tree
Changes from 55 commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
4456609
Feat(main): Add the rebekah test - print statement in main
PCain02 Sep 5, 2024
d80fd42
test files made
Coltin2121 Sep 12, 2024
6537d30
Merge branch 'GatorEducator:main' into main
PCain02 Sep 15, 2024
6ece3f7
Merge branch 'GatorEducator:main' into PyPI-automation
PCain02 Sep 15, 2024
6be9815
feat: Create publish.yml and add content
PCain02 Sep 15, 2024
2fd4181
feat: optimize publish.yml with caching, version verification, error …
PCain02 Sep 15, 2024
f3f5595
feat: Create test-publish.yml to test automatic releases
PCain02 Sep 17, 2024
81b417c
Chore: Bump version to 0.3.2
PCain02 Sep 18, 2024
dfd0752
feat: Update publish.yml to realease on tag
PCain02 Sep 18, 2024
d73bdf8
Feat: Update test-publish.yml to release on t
PCain02 Sep 18, 2024
a925d66
Merge branch 'PyPI-automation' of https://github.com/PCain02/execexam…
PCain02 Sep 18, 2024
fc666e0
Chore: Bump version to 0.3.4 test
PCain02 Sep 19, 2024
8ac723f
Chore: Bump version to 0.3.5 test
PCain02 Sep 19, 2024
b2299f4
Chore: Bump version to 0.3.7 test
PCain02 Sep 19, 2024
d579734
Chore: Bump version to 0.3.8 test
PCain02 Sep 19, 2024
94c0464
Chore: Bump version to 0.3.8 test
PCain02 Sep 19, 2024
59e3c0c
Chore: Bump version to 0.3.9 test
PCain02 Sep 19, 2024
2370b03
Chore: Bump version to 0.3.10 test and fix version tag bug
PCain02 Sep 19, 2024
ce49937
Chore: Bump version to 0.3.10 test and fix version tag bug
PCain02 Sep 19, 2024
aaf3422
fix: delete problematic files and test tag 0.3.11
PCain02 Sep 19, 2024
f4f79c7
Chore: Bump version to 0.3.11 test and fix version tag bug
PCain02 Sep 19, 2024
e3e8aba
Chore: Bump version to 0.3.12 test and fix version tag bug
PCain02 Sep 19, 2024
124ad74
Chore: Bump version to 0.3.13 test and fix version tag bug
PCain02 Sep 19, 2024
8342a74
Chore: Bump version to 0.3.14 test and fix version tag bug
PCain02 Sep 19, 2024
a4d5063
Chore: Bump version to 0.3.15 test and fix version tag bug
PCain02 Sep 19, 2024
646582d
Chore: Bump version to 0.3.16 test and fix version tag bug
PCain02 Sep 19, 2024
f1bd6d9
Chore: Bump version to 0.3.17 test and fix version tag bug
PCain02 Sep 19, 2024
5a600c1
Chore: Bump version to 0.3.18 test and fix version tag bug
PCain02 Sep 19, 2024
382d0c8
Chore: Bump version to 0.3.19 test and fix version tag bug
PCain02 Sep 19, 2024
29e36d1
Chore: Bump version to 0.3.2 test and fix version tag bug
PCain02 Sep 19, 2024
fe76001
Chore: Bump version to 0.3.21 test and fix version tag bug
PCain02 Sep 19, 2024
2bee9fc
Chore: Bump version to 0.3.22 test and fix version tag bug
PCain02 Sep 19, 2024
add533a
Chore: Bump version to 0.3.23 test
PCain02 Sep 19, 2024
fb91b3b
Chore: Bump version to 0.3.24 test
PCain02 Sep 19, 2024
16fdb33
Chore: Bump version to 0.3.25 test simplify test-publish
PCain02 Sep 19, 2024
5283552
Chore: Bump version to 0.3.26 test simplify test-publish
PCain02 Sep 19, 2024
d08d75e
Chore: Bump version to 0.3.27 test simplify test-publish
PCain02 Sep 19, 2024
abc085b
Chore: Bump version to 0.3.28 test simplify test-publish
PCain02 Sep 19, 2024
5ba6235
feat: simplify publish.yml to work like test-publish.yml
PCain02 Sep 19, 2024
fa6bcae
chore: bump version to 0.3.29 test
PCain02 Sep 19, 2024
ba30bec
chore: bump version to 0.3.33 test
PCain02 Sep 20, 2024
de122ff
fix: Delete tests/__init__.py empty test file
PCain02 Sep 20, 2024
2093d05
fix: delete empty test case files and Rebekah Test
PCain02 Sep 20, 2024
5799e5a
Fix: Update pyproject.toml version number and return it to the original
PCain02 Sep 20, 2024
2cde7a2
Merge pull request #3 from PCain02/PyPI-automation
PCain02 Sep 22, 2024
859fbe2
Feat: add back init.py to tests
PCain02 Sep 22, 2024
ab79380
feat: add back __init__.py to tests
PCain02 Sep 22, 2024
38c8872
Merge branch 'main' of https://github.com/PCain02/execexam
PCain02 Sep 22, 2024
94043b0
Merge branch 'main' of https://github.com/PCain02/execexam
PCain02 Sep 22, 2024
723eeae
Fix: Update __init__.py to be empty file
PCain02 Sep 22, 2024
3e38ce7
feat(README): added dynamic coverage badge and maintenance badge
Chezka109 Sep 23, 2024
93e8a22
add(badges): added dynamic version badge
Chezka109 Sep 23, 2024
b4be2f6
add(badges): added a build status badge
Chezka109 Sep 23, 2024
16c09a7
fix(gitingnore): removed some stuff so that the version badge works
Chezka109 Sep 23, 2024
7a1f294
fix(README): removed build status badge
Chezka109 Sep 23, 2024
e2a110d
Chore: Bump version to 0.3.38
Chezka109 Sep 23, 2024
b73d6fa
Chore: Bump version to 0.3.39
Chezka109 Sep 23, 2024
c05df9e
fix: automated badges to use CI workflow
Chezka109 Sep 26, 2024
9983819
Chore: cleaned up the directory
Chezka109 Sep 26, 2024
4e293a4
chore: ixed exit codes in execexam/util.py
Chezka109 Sep 26, 2024
7e390f1
fix: moved ci.yml into build.yml and moved badges.py to a folder name…
Chezka109 Sep 26, 2024
3f6b923
fix: failing build
Chezka109 Oct 16, 2024
f6727bc
fix: failing build
Chezka109 Oct 16, 2024
b0061f3
fix
Chezka109 Oct 16, 2024
bcd655d
fix failing build
Chezka109 Oct 22, 2024
c2f4e5b
fix
Chezka109 Oct 22, 2024
9db3de7
check
Chezka109 Oct 22, 2024
947d5ed
fix: file locations
Chezka109 Oct 24, 2024
cb8de4d
fix: file locations
Chezka109 Oct 24, 2024
6c5a3ba
fix: trying to fix failing build
Chezka109 Oct 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Publish

on:
push:
tags:
- 'v*' # Triggers on tags starting with 'v'

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11' # Use the Python version compatible with your project

- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Install dependencies
run: |
poetry install

- name: Configure Poetry for PyPI
run: |
poetry config repositories.pypi https://upload.pypi.org/legacy/
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}

- name: Publish package to PyPI
run: |
poetry publish --repository pypi --build

- name: Check for Successful Publication
run: |
version=$(poetry version --short)
echo "Checking if package execexam version $version is available on PyPI..."
response=$(curl -s "https://pypi.org/pypi/execexam/$version/json")
if echo "$response" | grep -q "$version"; then
echo "Package execexam version $version is successfully published on PyPI."
else
echo "Package execexam version $version was not found on PyPI."
exit 1
fi

48 changes: 48 additions & 0 deletions .github/workflows/test-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Test Publish

on:
push:
tags:
- 't*' # Triggers on tags starting with 't'

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '^3.11' # Use the Python version compatible with your project

- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Install dependencies
run: |
poetry install

- name: Configure Poetry for TestPyPI
run: |
poetry config repositories.testpypi https://test.pypi.org/legacy/
poetry config pypi-token.testpypi ${{ secrets.TEST_PYPI_TOKEN }}

- name: Publish package to TestPyPI
run: |
poetry publish --repository testpypi --build

- name: Check for Successful Publication
run: |
version=$(poetry version --short)
echo "Checking if package execexam version $version is available on TestPyPI..."
response=$(curl -s "https://test.pypi.org/pypi/execexam/$version/json")
if echo "$response" | grep -q "$version"; then
echo "Package execexam version $version is successfully published on TestPyPI."
else
echo "Package execexam version $version was not found on TestPyPI."
exit 1
fi
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -375,3 +375,4 @@ credentials.json

# poetry.toml file
poetry.toml

6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# 🚀 ExecExam

<img src="https://i.ibb.co/vzjX7p2/exe.png" alt="logo" height="500">

[![Coverage](https://img.shields.io/badge/coverage-71%25-orange)](https://github.com/GatorEducator/execexam/actions)
[![Static Badge](https://img.shields.io/badge/Maintained%3F-yes-orange)](https://github.com/GatorEducator/execexam/commits/main/)
![Version Badge](version-badge.svg)

ExecExam is a powerful tool that runs executable examinations in which a
student provides solutions to programming problems that are checked by Pytest
test suites. If you are a computer science or software engineering instructor
Expand Down
96 changes: 96 additions & 0 deletions badges.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import json
import re
import requests


def update_coverage_badge():
# Load the coverage.json file
try:
with open("coverage.json") as f:
data = json.load(f)
print("Loaded coverage.json successfully.")
except FileNotFoundError:
print("Error: coverage.json file not found. Run your tests first.")
return

# Extract total coverage percentage
try:
total_coverage = data["totals"]["percent_covered_display"]
print(f"Total coverage found: {total_coverage}%")
except KeyError:
print("Error: Unable to find the total coverage in the report.")
return

# Ensure coverage is formatted properly as an integer
total_coverage = int(float(total_coverage))

# Determine the color based on the coverage percentage
if total_coverage >= 90:
color = "brightgreen"
elif total_coverage >= 75:
color = "yellow"
elif total_coverage >= 50:
color = "orange"
else:
color = "red"

print(f"Coverage color set to: {color}")

# Generate the badge markdown with dynamic color
badge = f"![Coverage](https://img.shields.io/badge/coverage-{total_coverage}%25-{color})"
print(f"Generated badge: {badge}")

# Read the README.md and update the badge
try:
with open("README.md", "r+") as f:
content = f.read()
if re.search(
r"!\[Coverage\]\(https://img.shields.io/badge/coverage-[0-9]+%25-[a-z]+\)",
content,
):
print("Existing badge found, updating...")
new_content = re.sub(
r"!\[Coverage\]\(https://img.shields.io/badge/coverage-[0-9]+%25-[a-z]+\)",
badge,
content,
)
f.seek(0)
f.write(new_content)
f.truncate()
print("README.md updated successfully.")
else:
print(
"No existing badge found, please ensure it's in the correct format."
)
except FileNotFoundError:
print("Error: README.md file not found.")
return


if __name__ == "__main__":
update_coverage_badge()


# Path to your local JSON file from Open Source Insights
json_file_path = "version.json"

# Load the JSON data from the file
with open(json_file_path, "r") as f:
data = json.load(f)

# Extract the latest version from the JSON data
# Adjust this depending on the structure of your JSON file
latest_version = data["info"]["version"] # Modify this if necessary
print(f"Latest version: {latest_version}")

# Now create/update the badge using Shields.io
badge_url = f"https://img.shields.io/badge/version-{latest_version}-blue.svg"

# Download the badge and save it locally (optional)
badge_response = requests.get(badge_url)
if badge_response.status_code == 200:
with open("version-badge.svg", "wb") as f:
f.write(badge_response.content)
print("Badge updated successfully!")
else:
print("Error fetching badge from Shields.io.")
1 change: 1 addition & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions version-badge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading