Skip to content

Commit

Permalink
Fix tz and locale compatibility checks (#906)
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreyNikiforov authored Jul 11, 2024
1 parent 7df2311 commit 7f70ca3
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 9 deletions.
46 changes: 42 additions & 4 deletions .github/workflows/build-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
path: |
dist/icloud*.whl
get_expected_version:
get_expected_version_linux:
runs-on: ubuntu-22.04
defaults:
run:
Expand Down Expand Up @@ -85,6 +85,43 @@ jobs:
outputs:
expected_version: ${{steps.get_version.outputs.expected_version}}

get_expected_version_macos:
runs-on: macos-14
defaults:
run:
shell: bash

steps:
- uses: actions/checkout@v4

- name: Download version info
uses: actions/download-artifact@v4
with:
name: icloudpd-${{github.sha}}-version-info
path: |
src/foundation
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install Dev dependencies
run: |
pip3 install --disable-pip-version-check -e .
- name: Get Version
id: get_version
run: |
echo expected_version=$(TZ=America/Los_Angeles LC_ALL=ru_RU.UTF-8 icloudpd --use-os-locale --version) >> $GITHUB_OUTPUT
- name: Log version
run: |
echo "expected_version=${{steps.get_version.outputs.expected_version}}"
outputs:
expected_version: ${{steps.get_version.outputs.expected_version}}

build_linux_apt:
runs-on: ubuntu-22.04
strategy:
Expand Down Expand Up @@ -3322,7 +3359,8 @@ jobs:
- compatibility_macos_npx
- compatibility_windows_npm
- compatibility_windows_npx
- get_expected_version
- get_expected_version_linux
- get_expected_version_macos
defaults:
run:
shell: bash
Expand Down Expand Up @@ -3375,9 +3413,9 @@ jobs:
- name: Compile tzlc Report
run: |
echo "debugging report..."
scripts/compile_tzlc.py tzlc "${{needs.get_expected_version.outputs.expected_version}}"
scripts/compile_tzlc.py tzlc "${{needs.get_expected_version_linux.outputs.expected_version}}" "${{needs.get_expected_version_macos.outputs.expected_version}}"
echo "save report..."
scripts/compile_tzlc.py tzlc "${{needs.get_expected_version.outputs.expected_version}}" > dist/tzlc-${{inputs.icloudpd_version}}.md
scripts/compile_tzlc.py tzlc "${{needs.get_expected_version_linux.outputs.expected_version}}" "${{needs.get_expected_version_macos.outputs.expected_version}}"> dist/tzlc-${{inputs.icloudpd_version}}.md
- name: Upload tzlc report
uses: actions/upload-artifact@v4
Expand Down
10 changes: 5 additions & 5 deletions scripts/compile_tzlc.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ def special_content_checker(expected_content):
# content is special when it exists, but is invalid
def _intern(filepath):
with open(filepath, encoding="UTF-8") as file:
content = file.read()
return content != expected_content
content = file.read().strip()
return content not in expected_content

return _intern


if __name__ == "__main__":
if len(sys.argv) != 3:
print("Params: <folder> <expected content>")
if len(sys.argv) < 3:
print("Params: <folder> <expected content> [<expected content>...]")
sys.exit(1)
print("## Timezone and Locale Compatibility")
print(
"Checks if `icloudpd` can be installed using minimal effort and ran bare minimum functionality of displaying version and commit timestamp in local timezone and RU locale. Minimal effort may require installing default version of package manager, timezone data, and locales using OS tools"
)
print("")
folder = sys.argv[1]
expected_content = sys.argv[2]
expected_content = [c.strip() for c in sys.argv[2:]]
# content is special when it exists, but is invalid
print_breakdowns(
folder,
Expand Down

0 comments on commit 7f70ca3

Please sign in to comment.