Skip to content

Commit

Permalink
corret ci pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
NimVek committed Jan 29, 2024
1 parent 7f573a6 commit 786316e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 61 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ jobs:
- name: Collect Environment
run: |
python dev/github_env.py $GITHUB_ENV
python dev/github_env.py
- name: Test
run: |
Expand Down
55 changes: 31 additions & 24 deletions dev/github_env.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""Helper to determine to correct Python and OS version."""

import os
import platform
import sys


def os():
def get_os():
if platform.system() == "Linux":
try:
import subprocess
Expand All @@ -13,40 +13,47 @@ def os():
["/usr/bin/lsb_release", "--description", "--short"],
capture_output=True,
shell=False,
check=False,
text=True,
).stdout.splitlines()[0]
except Exception:
pass

if platform.system() == "Windows":
versions = {
10240: 1507,
10586: 1511,
14393: 1607,
15063: 1703,
16299: 1709,
17134: 1803,
17763: 1809,
18362: 1903,
18363: 1909,
19041: 2004,
19042: "20H2",
19043: "21H1",
19044: "21H2",
19045: "22H2",
22000: "21H2",
22621: "22H2",
22631: "23H2",
14393: "Windows Server 2016 (1607)",
16299: "Windows Server 2016 (1709)",
17134: "Windows Server 2016 (1803)",
17763: "Windows Server 2019 (1809)",
18362: "Windows Server 2019 (1903)",
18363: "Windows Server 2019 (1909)",
19041: "Windows Server 2019 (2004)",
19042: "Windows Server 2019 (20H2)",
20348: "Windows Server 2022 (21H2)",
}
try:
version = int(platform.version().split(".")[-1])
return f"Windows-{platform.release()} ({versions[version]})"
build = int(platform.version().split(".")[-1])
return versions[build]
except Exception:
pass

return platform.platform(terse=True)
if platform.system() == "Darwin":
versions = {
20: "macOS Big Sur",
21: "macOS Monterey",
22: "macOS Ventura",
23: "macOS Sonoma",
}
try:
darwin = int(platform.release().split(".")[0])
version = platform.platform().split("-")[1]
return f"{versions[darwin]} ({version})"
except Exception:
pass

return platform.platform()


with open(sys.argv[1], "a") as f:
with open(os.environ["GITHUB_ENV"], "a") as f:
f.write(f"PYTHON={platform.python_version()}\n")
f.write(f"OS={os()}\n")
f.write(f"OS={get_os()}\n")
36 changes: 0 additions & 36 deletions dev/os_version.py

This file was deleted.

0 comments on commit 786316e

Please sign in to comment.