Skip to content

Commit 8c8f274

Browse files
committed
Add GitHub Action to test bundle installation
1 parent dfe09a0 commit 8c8f274

File tree

3 files changed

+95
-3
lines changed

3 files changed

+95
-3
lines changed

.github/workflows/run-bundle-test.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Run bundle test
2+
3+
on:
4+
push:
5+
pull_request:
6+
branches-ignore: [ master ]
7+
8+
jobs:
9+
test-bundle:
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
python-version: ["3.9", "3.10", "3.11", "3.12"]
15+
os: [ubuntu-latest, macOS-latest]
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Set up Python ${{ matrix.python-version }}
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: ${{ matrix.python-version }}
22+
- name: Install dependencies
23+
run: python scripts/ci/install
24+
- name: Install additional dependencies
25+
run: pip install virtualenv==16.3.0 setuptools-scm==3.3.3 # same as internal generate-bundle.ts
26+
- name: Test the bundle
27+
run: python scripts/ci/test-bundle

scripts/ci/test-bundle

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/usr/bin/env python
2+
# Don't run tests from the root repo dir.
3+
# We want to ensure we're importing from the installed
4+
# binary package not from the CWD.
5+
6+
import os
7+
import re
8+
from contextlib import contextmanager
9+
from subprocess import check_output
10+
11+
_dname = os.path.dirname
12+
13+
REPO_ROOT = _dname(_dname(_dname(os.path.abspath(__file__))))
14+
15+
16+
@contextmanager
17+
def cd(path):
18+
"""Change directory while inside context manager."""
19+
cwd = os.getcwd()
20+
try:
21+
os.chdir(path)
22+
yield
23+
finally:
24+
os.chdir(cwd)
25+
26+
27+
def run(command):
28+
print(f'Running {command}')
29+
return check_output(command, shell=True)
30+
31+
32+
def run_make_bundle():
33+
"""
34+
Builds the bundled installer, and returns its path
35+
"""
36+
output = run(f'{REPO_ROOT}/scripts/make-bundle')
37+
match = re.search(
38+
r'Zipped bundle installer is at: (.+?\.zip)', output.decode('utf-8')
39+
)
40+
if not match:
41+
raise RuntimeError("Could not find bundle path in make-bundle output")
42+
43+
return match.group(1)
44+
45+
46+
def install_from_bundle(zip_path):
47+
run(f'unzip -o {bundle_path}')
48+
path_without_zip = bundle_path[:-4]
49+
run(
50+
f'sudo {path_without_zip}/install -i /usr/local/aws -b /usr/local/bin/aws'
51+
)
52+
53+
54+
def verify_installation():
55+
version_output = run("aws --version")
56+
print(f"Installed AWS CLI version: {version_output}")
57+
58+
59+
if __name__ == "__main__":
60+
with cd(os.path.join(REPO_ROOT)):
61+
bundle_path = run_make_bundle()
62+
install_from_bundle(bundle_path)
63+
verify_installation()

scripts/make-bundle

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ PINNED_RUNTIME_DEPS = [
3131
# require extra build time dependencies. We are pinning it to
3232
# a version that does not need those.
3333
('colorama', '0.4.5'),
34+
# 2.0.0 of urllib3 started requiring hatchling as well
35+
('urllib3', '1.26.20'),
3436
]
3537
BUILDTIME_DEPS = [
36-
('setuptools', '75.3.2'), # 75.4 dropped 3.8 support
38+
('setuptools', '75.4.0'), # start of >= 3.9
3739
('setuptools-scm', '3.3.3'),
38-
('wheel', '0.45.1'), # 46.0 dropped 3.8 support
40+
('wheel', '0.45.1'), # 0.46.0+ requires packaging
3941
]
4042
PIP_DOWNLOAD_ARGS = '--no-build-isolation --no-binary :all:'
4143

@@ -186,7 +188,7 @@ def main():
186188
# can run the install before the things they're dependent on. We have to do
187189
# this because pip won't actually find them since it doesn't handle build
188190
# dependencies. We use wheels for this, to avoid bootstrapping setuptools
189-
# in 3.12+ where its no longer included by default.
191+
# in 3.12+ where it's no longer included by default.
190192
setup_dir = os.path.join(package_dir, 'setup')
191193
download_package_wheels(
192194
setup_dir,

0 commit comments

Comments
 (0)