Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuwei Yan committed Jan 6, 2025
1 parent f145d6f commit 4a12bad
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 7 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,25 @@ jobs:
CIBW_ENVIRONMENT: ${{ secrets.CIBW_ENVIRONMENT }}
uses: pypa/[email protected]
# ATTENTION: this step is mandatory for PyPI trusted publishing
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
packages-dir: wheelhouse/
deploy-macos: # WITHOUT testing
name: Build wheels for macOS
runs-on: macos-latest
permissions:
# IMPORTANT: this permission is mandatory for PyPI trusted publishing
id-token: write
steps:
- uses: actions/checkout@v4
# ATTENTION: set CIBW_ENVIRONMENT=GITLAB_AUTH=username:token in your repository secrets
- name: Build wheels
env:
CIBW_ENVIRONMENT: ${{ secrets.CIBW_ENVIRONMENT }}
uses: pypa/[email protected]
# ATTENTION: this step is mandatory for PyPI trusted publishing
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down
8 changes: 6 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ readme = "README.md"
classifiers = [
"Programming Language :: Python :: 3",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS :: MacOS X",
]
requires-python = ">=3.9"
dependencies = [
Expand Down Expand Up @@ -65,8 +66,11 @@ where = ["."]
include = ["pycityagent*"]

[tool.cibuildwheel]
build = ["cp3*manylinux_x86_64"]
build = ["cp3*manylinux_x86_64", "cp3*macosx_arm64"]
skip = ["cp36-*", "cp37-*", "cp38-*"]

[tool.cibuildwheel.linux]
repair-wheel-command = ""
repair-wheel-command = "auditwheel repair -w {dest_dir} {wheel}"

[tool.cibuildwheel.macos]
repair-wheel-command = "delocate-wheel -w {dest_dir} {wheel}"
19 changes: 14 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@

BIN_SOURCES = {
"pycityagent-sim": {
"linux_x86_64": "https://git.fiblab.net/api/v4/projects/25/packages/generic/simulet-go/v1.3.0/simulet-go-noproj-linux-amd64",
"linux_x86_64": "https://git.fiblab.net/api/v4/projects/25/packages/generic/simulet-go/v1.3.1/simulet-go-noproj-linux-amd64",
"darwin_arm64": "https://git.fiblab.net/api/v4/projects/25/packages/generic/simulet-go/v1.3.1/simulet-go-noproj-darwin-arm64",
},
"pycityagent-ui": {
"linux_x86_64": "https://git.fiblab.net/api/v4/projects/188/packages/generic/socialcity-web/v0.2.3/socialcity-web-linux-amd64",
"darwin_arm64": "https://git.fiblab.net/api/v4/projects/188/packages/generic/socialcity-web/v0.2.3/socialcity-web-darwin-arm64",
},
}

Expand All @@ -35,12 +37,19 @@ def run(self):
if len(auth) != 2:
print("Invalid authentication provided for downloading binaries, please set GITLAB_AUTH=username:token")
raise Exception("Invalid authentication provided for downloading binaries, please set GITLAB_AUTH=username:token")
if system == "Linux" and machine == "x86_64":
if system == "Linux":
plat_dir = "linux"
arch = "x86_64"
if machine == "x86_64":
arch = "x86_64"
else:
print("Unsupported architecture on Linux")
raise Exception("Unsupported architecture on Linux")
elif system == "Darwin" and machine.startswith("arm"):
plat_dir = "darwin"
arch = "arm64"
else:
print("Only Linux x86_64 platform is supported")
raise Exception("Only Linux x86_64 platform is supported")
print("Unsupported platform")
raise Exception("Unsupported platform")
# build the extension
extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(PACKAGE_NAME)))
for ext in self.extensions:
Expand Down

0 comments on commit 4a12bad

Please sign in to comment.