Skip to content

Commit

Permalink
feat: Update ci to support Mac and Linux
Browse files Browse the repository at this point in the history
Signed-off-by: loonghao <hal.long@outlook.com>
  • Loading branch information
loonghao committed Aug 10, 2024
1 parent 07d521f commit f57652c
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 24 deletions.
19 changes: 16 additions & 3 deletions .github/workflows/mr-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,26 @@ on: [ pull_request ]

jobs:
python-check:
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 3
matrix:
os: [ 'windows-2019' ]
target:
- os: 'ubuntu-22.04'
triple: 'aarch64-unknown-linux-musl'
cross: true
- os: 'ubuntu-22.04'
triple: 'x86_64-unknown-linux-musl'
- os: 'macos-12'
triple: 'aarch64-apple-darwin'
- os: 'macos-12'
triple: 'x86_64-apple-darwin'
- os: 'windows-2022'
triple: 'i686-pc-windows-msvc'
- os: 'windows-2022'
triple: 'x86_64-pc-windows-msvc'
python-version: ["3.10"]
fail-fast: false
runs-on: ${{ matrix.target.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -27,4 +40,4 @@ jobs:
- name: test build
run: |
nox -s build-exe
build\x86_64-pc-windows-msvc\release\install\rez.exe env --help
build\${{ matrix.target.triple }}\release\install\rez env --help
17 changes: 15 additions & 2 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,26 @@ on:

jobs:
deploy:
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 3
matrix:
os: [ 'windows-2019' ]
target:
- os: 'ubuntu-22.04'
triple: 'aarch64-unknown-linux-musl'
cross: true
- os: 'ubuntu-22.04'
triple: 'x86_64-unknown-linux-musl'
- os: 'macos-12'
triple: 'aarch64-apple-darwin'
- os: 'macos-12'
triple: 'x86_64-apple-darwin'
- os: 'windows-2022'
triple: 'i686-pc-windows-msvc'
- os: 'windows-2022'
triple: 'x86_64-pc-windows-msvc'
python-version: ["3.10"]
fail-fast: false
runs-on: ${{ matrix.target.os }}
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
Expand Down
42 changes: 23 additions & 19 deletions nox_actions/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,27 @@ def build_exe(session: nox.Session) -> None:
parser.add_argument("--release", action="store_true")
parser.add_argument("--version", default="0.5.0", help="Version to use for the zip file")
args = parser.parse_args(session.posargs)
build_root = THIS_ROOT / "build" / "x86_64-pc-windows-msvc" / "release" / "install"
session.install("pyoxidizer")
session.run("pyoxidizer", "build", "install", "--path", THIS_ROOT, "--release")
rez_exe = build_root / "portable_rez.exe"
rez_exe.rename(build_root / "rez.exe")
build_root = THIS_ROOT / "build"
for platform_name in os.listdir(build_root):

if args.release:
temp_dir = os.path.join(THIS_ROOT, ".zip")
shutil.rmtree(temp_dir, ignore_errors=True)
version = str(args.version)
print(f"make zip to current version: {version}")
os.makedirs(temp_dir, exist_ok=True)
zip_file = os.path.join(temp_dir, f"{PACKAGE_NAME}-{version}.zip")
with zipfile.ZipFile(zip_file, "w") as zip_obj:
for root, _, files in os.walk(build_root):
for file in files:
zip_obj.write(os.path.join(root, file),
os.path.relpath(os.path.join(root, file),
os.path.join(build_root, ".")))
print("Saving to {zipfile}".format(zipfile=zip_file))
platform_dir = build_root / platform_name / "release" / "install"

session.install("pyoxidizer")
session.run("pyoxidizer", "build", "install", "--path", THIS_ROOT, "--release")
rez_exe = platform_dir / "portable_rez.exe"
rez_exe.rename(platform_dir / "rez.exe")

if args.release:
temp_dir = os.path.join(THIS_ROOT, ".zip")
shutil.rmtree(temp_dir, ignore_errors=True)
version = str(args.version)
print(f"make zip to current version: {version}")
os.makedirs(temp_dir, exist_ok=True)
zip_file = os.path.join(temp_dir, f"{PACKAGE_NAME}-{platform_name}-{version}.zip")
with zipfile.ZipFile(zip_file, "w") as zip_obj:
for root, _, files in os.walk(platform_dir):
for file in files:
zip_obj.write(os.path.join(root, file),
os.path.relpath(os.path.join(root, file),
os.path.join(platform_dir, ".")))
print("Saving to {zipfile}".format(zipfile=zip_file))

0 comments on commit f57652c

Please sign in to comment.