Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate aarch64 index #1

Merged
merged 1 commit into from
Jun 30, 2022
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
2 changes: 1 addition & 1 deletion .github/workflows/generate-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
run: |
cp -a _skeleton/ _generate/
pip3 install -U PyGithub
./generate.py _generate/pre/index.html
./generate.py _generate/

- name: Deploy 🚀
uses: peaceiris/actions-gh-pages@v3
Expand Down
Empty file added _skeleton/aarch64/.gitignore
Empty file.
78 changes: 61 additions & 17 deletions generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
<!doctype html>
<html>
<head>
<title>CuPy: Pre-Release Wheels</title>
<title>CuPy: {title}</title>
<meta name="robots" content="noindex,nofollow" />
</head>
<body>
<h1>CuPy: Pre-Release Wheels</h1>
<h1>CuPy: {title}</h1>
<pre style="color: #eeeeee; background-color: #333333; margin: 5px; padding: 10px; border-radius: 10px;">
<span style="user-select: none;">$ </span>pip install 'cupy-cudaXXX==X.Y.Z' -f https://pip.cupy.dev/pre
<span style="user-select: none;">$ </span>{command}
</pre>
'''

Expand All @@ -26,26 +26,70 @@
'''


def main(out_file):
token = os.environ['GITHUB_TOKEN']
repo = github.Github(token).get_repo('cupy/cupy')
class Generator:
def __init__(self):
self._lines = None

lines = [_header]
for release in repo.get_releases():
if not release.prerelease:
print(f'Skipping stable release: {release.title}')
continue
lines.append(f'<h2>{release.title}</h2>')
def process_release(self, release):
self._lines.append(f'<h2>{release.title}</h2>')
count = 0
for asset in release.get_assets():
self.process_asset(asset)
count += 1
url = asset.browser_download_url
lines.append(f'<a href="{url}">{os.path.basename(url)}</a><br>')
print(f'Processed: {release.title} ({count} assets)')
lines.append(_footer)

with open(out_file, 'w') as f:
f.write('\n'.join(lines))
def process_asset(self, asset):
url = asset.browser_download_url
self._lines.append(f'<a href="{url}">{os.path.basename(url)}</a><br>')

def generate(self, repo, out_file, *, title, command):
print(f'=== Generating {out_file}')
self._lines = [
_header.format(title=title, command=command)
]
for release in repo.get_releases():
self.process_release(release)
self._lines.append(_footer)
output = '\n'.join(self._lines)
with open(out_file, 'w') as f:
f.write(output)


class PreReleaseGenerator(Generator):
def process_release(self, release):
if not release.prerelease:
print(f'Skipping stable release: {release.title}')
return
super().process_release(release)


class AArch64Generator(Generator):
def process_asset(self, asset):
if not 'aarch64' in asset.name:
print(f'Skipping non-aarch64 asset: {asset.name}')
return
super().process_asset(asset)


def main(out_dir):
token = os.environ['GITHUB_TOKEN']
repo = github.Github(token).get_repo('cupy/cupy')

gen = PreReleaseGenerator()
output = gen.generate(
repo,
f'{out_dir}/pre/index.html',
title='Pre-Release Wheels',
command='pip install --pre cupy-cudaXXX -f https://pip.cupy.dev/pre',
)

gen = AArch64Generator()
output = gen.generate(
repo,
f'{out_dir}/aarch64/index.html',
title='Arm Wheels',
command='pip install cupy-cudaXXX -f https://pip.cupy.dev/aarch64',
)


if __name__ == '__main__':
Expand Down