Skip to content

Commit e71d5b7

Browse files
jamesbornholtdnnanuti
authored andcommitted
Build macOS wheels and integration tests
This is pretty simple, mostly just adding macos-13 (x86) and macos-14 (arm64) runners to the matrix. We also need to explicitly disable MPS for PyTorch to run correctly on the memory-limited GHA runners. Signed-off-by: James Bornholt <[email protected]>
1 parent 463691b commit e71d5b7

File tree

5 files changed

+28
-15
lines changed

5 files changed

+28
-15
lines changed

.github/workflows/ci-integration-main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Integration tests (Main)
22

33
on:
44
push:
5-
branches: [ "main", "feature/*" ]
5+
branches: [ "main", "feature/*", "workflow/*" ]
66
merge_group:
77
types: [ "checks_requested" ]
88

.github/workflows/python-integration.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@ env:
1919
jobs:
2020
integration-test:
2121
name: Integration tests
22-
runs-on: ubuntu-22.04
22+
runs-on: ${{ matrix.runner }}
2323
environment: ${{ inputs.environment }}
2424
strategy:
2525
fail-fast: false
2626
matrix:
27+
runner: [ubuntu-22.04, macos-13]
2728
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
2829
test-run:
2930
- name: "S3"
@@ -53,17 +54,13 @@ jobs:
5354
aws-region: ${{ vars.S3_REGION }}
5455

5556
- name: Set up stable Rust
56-
uses: actions-rs/toolchain@v1
57-
with:
58-
toolchain: stable
59-
override: true
57+
uses: dtolnay/rust-toolchain@stable
6058

6159
- name: Restore Cargo cache
6260
id: restore-cargo-cache
6361
uses: actions/cache/restore@v3
6462
with:
6563
path: |
66-
~/.cargo/bin/
6764
~/.cargo/registry/index/
6865
~/.cargo/registry/cache/
6966
~/.cargo/git/db/
@@ -114,7 +111,6 @@ jobs:
114111
if: inputs.environment != 'integration-tests'
115112
with:
116113
path: |
117-
~/.cargo/bin/
118114
~/.cargo/registry/index/
119115
~/.cargo/registry/cache/
120116
~/.cargo/git/db/

.github/workflows/rust-checks.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ jobs:
3232
with:
3333
toolchain: stable
3434
override: true
35-
submodules: true
3635

3736
- name: Run cargo deny
3837
uses: EmbarkStudios/cargo-deny-action@v1
@@ -69,8 +68,11 @@ jobs:
6968
run: cargo clippy --all-targets --all-features --manifest-path s3torchconnectorclient/Cargo.toml
7069

7170
tests:
72-
runs-on: ubuntu-22.04
71+
runs-on: ${{ matrix.runner }}
7372
name: Rust tests
73+
strategy:
74+
matrix:
75+
runner: [ubuntu-22.04, macos-13]
7476
steps:
7577
- name: Checkout code
7678
uses: actions/checkout@v4
@@ -80,7 +82,6 @@ jobs:
8082
with:
8183
toolchain: stable
8284
override: true
83-
submodules: true
8485

8586
- name: Build Rust tests
8687
run: cargo test --no-default-features --no-run --manifest-path s3torchconnectorclient/Cargo.toml

.github/workflows/wheels.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,33 @@ jobs:
1919
uses: ./.github/workflows/generate_third_party_licenses.yml
2020

2121
build_wheels:
22-
name: Build wheels for ${{ matrix.build_prefix }} - ${{ matrix.builder.arch }}
22+
name: Wheels for ${{ matrix.python }} - ${{ matrix.builder.kind }} - ${{ matrix.builder.arch }}
2323
runs-on: ${{ matrix.builder.runner }}
2424
needs: generate_third_party_licenses
2525
strategy:
2626
matrix:
27-
build_prefix:
27+
python:
2828
- cp38
2929
- cp39
3030
- cp310
3131
- cp311
3232
- cp312
3333
builder:
3434
- runner: codebuild-${{ vars.CODEBUILD_PROJECT_NAME }}-${{ github.run_id }}-${{ github.run_attempt }}-ubuntu-7.0-large
35+
kind: manylinux
3536
arch: x86_64
3637
- runner: codebuild-${{ vars.CODEBUILD_PROJECT_NAME }}-${{ github.run_id }}-${{ github.run_attempt }}-arm-3.0-large
38+
kind: manylinux
3739
arch: aarch64
3840
# - runner: ubuntu-20.04
41+
# kind: manylinux
3942
# arch: x86_64
43+
- runner: macos-13
44+
kind: macosx
45+
arch: x86_64
46+
- runner: macos-14
47+
kind: macosx
48+
arch: arm64
4049
permissions:
4150
id-token: write
4251
contents: read
@@ -80,7 +89,7 @@ jobs:
8089
cibuildwheel
8190
"s3torchconnectorclient"
8291
--output-dir "wheelhouse"
83-
--only "${{ matrix.build_prefix }}-manylinux_${{ matrix.builder.arch }}"
92+
--only "${{ matrix.python }}-${{ matrix.builder.kind }}_${{ matrix.builder.arch }}"
8493
2>&1
8594
shell: bash
8695

s3torchconnector/tst/e2e/test_e2e_s3_lightning_checkpoint.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
from models.lightning_transformer import LightningTransformer, L
2323

2424

25+
LIGHTNING_ACCELERATOR = "cpu"
26+
27+
2528
def test_save_and_load_checkpoint(checkpoint_directory):
2629
tensor = torch.rand(3, 10, 10)
2730
s3_lightning_checkpoint = S3LightningCheckpoint(region=checkpoint_directory.region)
@@ -77,7 +80,7 @@ def test_load_trained_checkpoint(checkpoint_directory):
7780
dataset = WikiText2(data_dir=Path(f"/tmp/data/{nonce}"))
7881
dataloader = DataLoader(dataset, num_workers=3)
7982
model = LightningTransformer(vocab_size=dataset.vocab_size)
80-
trainer = L.Trainer(fast_dev_run=2)
83+
trainer = L.Trainer(accelerator=LIGHTNING_ACCELERATOR, fast_dev_run=2)
8184
trainer.fit(model=model, train_dataloaders=dataloader)
8285
checkpoint_name = "lightning_module_training_checkpoint.pt"
8386
s3_uri = f"{checkpoint_directory.s3_uri}{checkpoint_name}"
@@ -96,6 +99,7 @@ def test_compatibility_with_trainer_plugins(checkpoint_directory):
9699
s3_lightning_checkpoint = S3LightningCheckpoint(region=checkpoint_directory.region)
97100
_verify_user_agent(s3_lightning_checkpoint)
98101
trainer = L.Trainer(
102+
accelerator=LIGHTNING_ACCELERATOR,
99103
default_root_dir=checkpoint_directory.s3_uri,
100104
plugins=[s3_lightning_checkpoint],
101105
max_epochs=1,
@@ -130,6 +134,7 @@ def test_compatibility_with_checkpoint_callback(checkpoint_directory):
130134
enable_version_counter=True,
131135
)
132136
trainer = L.Trainer(
137+
accelerator=LIGHTNING_ACCELERATOR,
133138
plugins=[s3_lightning_checkpoint],
134139
callbacks=[checkpoint_callback],
135140
min_epochs=4,
@@ -163,6 +168,7 @@ def test_compatibility_with_async_checkpoint_io(checkpoint_directory):
163168
async_s3_lightning_checkpoint = AsyncCheckpointIO(s3_lightning_checkpoint)
164169

165170
trainer = L.Trainer(
171+
accelerator=LIGHTNING_ACCELERATOR,
166172
default_root_dir=checkpoint_directory.s3_uri,
167173
plugins=[async_s3_lightning_checkpoint],
168174
min_epochs=4,
@@ -189,6 +195,7 @@ def test_compatibility_with_lightning_checkpoint_load(checkpoint_directory):
189195
model = LightningTransformer(vocab_size=dataset.vocab_size)
190196
s3_lightning_checkpoint = S3LightningCheckpoint(region=checkpoint_directory.region)
191197
trainer = L.Trainer(
198+
accelerator=LIGHTNING_ACCELERATOR,
192199
default_root_dir=checkpoint_directory.s3_uri,
193200
plugins=[s3_lightning_checkpoint],
194201
max_epochs=1,

0 commit comments

Comments
 (0)