Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
32 changes: 32 additions & 0 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build

runs:
using: composite
steps:
- uses: actions/checkout@v4

- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1.0.2

- name: Build toast-win7
shell: powershell
working-directory: ${{github.workspace}}\win7
run: msbuild /m /p:Configuration=Release Win7Notify.sln

- name: Build toast-win10
shell: powershell
working-directory: ${{github.workspace}}\win10
run: cargo build --verbose --release

- name: Gather artifacts
shell: bash
run: |
mkdir -p gathered_artifacts
mv win7/x64/Release/toast-win7.exe gathered_artifacts/
mv win10/target/release/toast-win10.exe gathered_artifacts/

- name: Summarize
shell: bash
run: |
chmod +x .github/workflows/scripts/summarize.py
python3 .github/workflows/scripts/summarize.py gathered_artifacts
28 changes: 0 additions & 28 deletions .github/workflows/build.yml

This file was deleted.

19 changes: 19 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: CI

on: [ push, pull_request ]

jobs:
build-and-summarize:
runs-on: windows-latest

steps:
- uses: actions/checkout@v4

- name: Build & Summarize
uses: ./.github/actions/build/

- name: Upload
uses: actions/upload-artifact@v4
with:
name: ChatToolsAddon
path: gathered_artifacts/
40 changes: 40 additions & 0 deletions .github/workflows/scripts/summarize.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env python3
import sys
import os
import hashlib

def compute_md5(filepath, chunk_size=8192):
md5 = hashlib.md5()
with open(filepath, 'rb') as f:
for chunk in iter(lambda: f.read(chunk_size), b''):
md5.update(chunk)
return md5.hexdigest()

def main():
if len(sys.argv) != 2:
print(f"Usage: {sys.argv[0]} <dir>")
sys.exit(1)

target_dir = sys.argv[1]
summary_path = os.environ.get('GITHUB_STEP_SUMMARY')
if not summary_path:
print("No GITHUB_STEP_SUMMARY!")
sys.exit(1)

entries = sorted(os.listdir(target_dir))
with open(summary_path, 'a', encoding='utf-8') as s:
s.write("## MD5 Checksums:\n\n")
s.write('| File | Size | MD5 |\n')
s.write('| --- | --- | --- |\n')

for name in entries:
full = os.path.join(target_dir, name)
if os.path.isfile(full):
file_size = f'{os.path.getsize(full)} B'
checksum = compute_md5(full)
with open(full + '.md5', 'w', encoding='utf-8') as mf:
mf.write(f"{checksum}")
s.write(f"| {name} | {file_size} | {checksum} |\n")

if __name__ == '__main__':
main()
Loading