Skip to content

Commit

Permalink
ci: Attemp to fix performance calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
cyb3rko committed Oct 19, 2024
1 parent 5bfe398 commit 1eda79a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
33 changes: 15 additions & 18 deletions .github/perf-impr-calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,21 @@
with open("performance-data.csv", "r") as file:
reader = csv.reader(file, delimiter=',')
next(reader)
base_value = next(reader)[1]
new_value = next(reader)[1]
base_value = int(next(reader)[1])
new_value = int(next(reader)[1])
percent = ((base_value - new_value) / base_value) * 100

print("Average performance enhancement:", percent)
# changelog = os.getenv("CHANGELOG")
# # changelog = open("changelog.txt", "r", encoding="utf-8").read()
# marker = "<<marker1>>"
# first_index = changelog.find(marker)
# if first_index == -1:
# raise Exception("Position marker not found")
#
# last_index = first_index + len(marker)
# print(f"Marker index at {first_index}")
#
# print("Writing changelog output")
# changelog = changelog[:first_index] + str(average_percentage) + "%" + changelog[last_index:]
# env_file = os.getenv('GITHUB_ENV')
# with open(env_file, "a") as file:
# file.write(f"NEW_CHANGELOG={changelog}")
rounded_percent = round(percent, 2)
print("Average performance enhancement:", rounded_percent)
changelog = os.getenv("CHANGELOG")
# changelog = open("changelog.txt", "r", encoding="utf-8").read()
marker = "<<marker1>>"
first_index = changelog.find(marker)
if first_index == -1:
raise Exception("Position marker not found")

print(f"Marker index at {first_index}")

print("Writing changelog output")
changelog = changelog.replace(marker, str(rounded_percent))
print(f"::set-output name=changelog::{changelog}")
7 changes: 6 additions & 1 deletion .github/workflows/release-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ jobs:
uses: actions/checkout@v4

- name: Calculate and insert performance calculation
id: github_release2
shell: sh
env:
CHANGELOG: ${{ steps.github_release.outputs.changelog }}
run: |
cd .github
python perf-impr-calc.py
Expand Down Expand Up @@ -122,7 +125,9 @@ jobs:
- name: Create Release
uses: softprops/action-gh-release@v2
env:
CHANGELOG: ${{ steps.github_release2.outputs.changelog }}
with:
name: "Version ${{ env.RELEASE_VERSION }}"
body: ${{steps.github_release.outputs.changelog}}
body: ${{env.CHANGELOG}}
files: app/build/outputs/apk/release/FlashDim-${{env.RELEASE_VERSION}}.apk

0 comments on commit 1eda79a

Please sign in to comment.