Skip to content

Commit 0c46146

Browse files
PGO build for MacOS M1 (#1063)
Co-authored-by: David Hewitt <[email protected]>
1 parent d80c454 commit 0c46146

File tree

4 files changed

+53
-27
lines changed

4 files changed

+53
-27
lines changed

.github/workflows/ci.yml

Lines changed: 51 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ jobs:
7070
- '3.9'
7171
- '3.10'
7272
- '3.11'
73-
- '3.12-dev'
73+
- '3.12'
7474
- 'pypy3.7'
7575
- 'pypy3.8'
7676
- 'pypy3.9'
@@ -389,7 +389,7 @@ jobs:
389389
interpreter: 3.11 3.12
390390
- os: macos
391391
target: aarch64
392-
interpreter: 3.7 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9 pypy3.10
392+
interpreter: 3.7 3.8 3.9 pypy3.8 pypy3.9 pypy3.10
393393
- os: ubuntu
394394
platform: linux
395395
target: i686
@@ -465,33 +465,33 @@ jobs:
465465
path: dist
466466

467467
build-pgo:
468-
name: build pgo-optimized on ${{ matrix.platform || matrix.os }} (${{ matrix.interpreter}} - ${{ matrix.target }} - ${{ matrix.manylinux || 'auto' }})
468+
name: build pgo-optimized on ${{ matrix.os }} / ${{ matrix.interpreter }}
469469
# only run on push to main and on release
470470
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'Full Build')
471471
strategy:
472472
fail-fast: false
473473
matrix:
474-
os: [ubuntu, windows]
475-
target: [x86_64]
476-
manylinux: [auto]
477-
interpreter: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12-dev", "pypy3.7", "pypy3.8", "pypy3.9", "pypy3.10"]
474+
os: [ubuntu-latest, windows-latest, macos-latest-xlarge]
475+
interpreter: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
478476
include:
479-
- os: ubuntu
480-
platform: linux
481-
- os: windows
477+
- os: windows-latest
482478
ls: dir
483-
- interpreter: 3.12-dev
484-
maturin-interpreter: "3.12"
485-
486-
runs-on: ${{ matrix.os }}-latest
479+
exclude:
480+
- os: macos-latest-xlarge
481+
interpreter: '3.7'
482+
- os: macos-latest-xlarge
483+
interpreter: '3.8'
484+
- os: macos-latest-xlarge
485+
interpreter: '3.9'
486+
487+
runs-on: ${{ matrix.os }}
487488
steps:
488489
- uses: actions/checkout@v4
489490

490491
- name: set up python
491492
uses: actions/setup-python@v4
492493
with:
493494
python-version: ${{ matrix.interpreter }}
494-
architecture: ${{ matrix.python-architecture || 'x64' }}
495495

496496
- name: install rust stable
497497
id: rust-toolchain
@@ -504,15 +504,15 @@ jobs:
504504
# generate self-schema now, so we don't have to do so inside docker in maturin build
505505
- run: python generate_self_schema.py
506506

507+
- run: rustc --version --verbose
508+
507509
- name: build initial wheel
508510
uses: PyO3/maturin-action@v1
509511
with:
510-
target: ${{ matrix.target }}
511-
manylinux: ${{ matrix.manylinux || 'auto' }}
512512
args: >
513513
--release
514514
--out pgo-wheel
515-
--interpreter ${{ matrix.maturin-interpreter || matrix.interpreter }}
515+
--interpreter ${{ matrix.interpreter }}
516516
rust-toolchain: stable
517517
docker-options: -e CI
518518
env:
@@ -536,12 +536,10 @@ jobs:
536536
- name: build pgo-optimized wheel
537537
uses: PyO3/maturin-action@v1
538538
with:
539-
target: ${{ matrix.target }}
540-
manylinux: ${{ matrix.manylinux || 'auto' }}
541539
args: >
542540
--release
543541
--out dist
544-
--interpreter ${{ matrix.maturin-interpreter || matrix.interpreter }}
542+
--interpreter ${{ matrix.interpreter }}
545543
rust-toolchain: stable
546544
docker-options: -e CI
547545
env:
@@ -551,7 +549,7 @@ jobs:
551549

552550
- uses: actions/upload-artifact@v3
553551
with:
554-
name: pypi_files
552+
name: pypi_files_pgo
555553
path: dist
556554

557555
inspect-pypi-assets:
@@ -567,7 +565,19 @@ jobs:
567565
name: pypi_files
568566
path: dist
569567

570-
- name: list dist files
568+
- name: list dist files before PGO builds
569+
run: |
570+
ls -lh dist/
571+
ls -l dist/
572+
echo "`ls dist | wc -l` files"
573+
574+
- name: get PGO dist artifacts (comes after "get dist artifacts" to so these files override the non-PGO builds)
575+
uses: actions/download-artifact@v3
576+
with:
577+
name: pypi_files_pgo
578+
path: dist
579+
580+
- name: list dist files with PGO builds
571581
run: |
572582
ls -lh dist/
573583
ls -l dist/
@@ -607,6 +617,12 @@ jobs:
607617
name: pypi_files
608618
path: dist
609619

620+
- name: get PGO dist artifacts (comes after "get dist artifacts" to so these files override the non-PGO builds)
621+
uses: actions/download-artifact@v3
622+
with:
623+
name: pypi_files_pgo
624+
path: dist
625+
610626
- uses: uraimo/[email protected]
611627
name: install & test
612628
with:
@@ -659,6 +675,12 @@ jobs:
659675
name: pypi_files
660676
path: dist
661677

678+
- name: get PGO dist artifacts (comes after "get dist artifacts" to so these files override the non-PGO builds)
679+
uses: actions/download-artifact@v3
680+
with:
681+
name: pypi_files_pgo
682+
path: dist
683+
662684
- run: pip install typing-extensions
663685
- run: pip install -r tests/requirements.txt
664686
- run: pip install pydantic-core --no-index --no-deps --find-links dist --force-reinstall
@@ -688,6 +710,12 @@ jobs:
688710
name: pypi_files
689711
path: dist
690712

713+
- name: get PGO dist artifacts (comes after "get dist artifacts" to so these files override the non-PGO builds)
714+
uses: actions/download-artifact@v3
715+
with:
716+
name: pypi_files_pgo
717+
path: dist
718+
691719
- run: twine check --strict dist/*
692720

693721
- name: upload to pypi

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pydantic-core"
3-
version = "2.12.0"
3+
version = "2.13.0"
44
edition = "2021"
55
license = "MIT"
66
homepage = "https://github.com/pydantic/pydantic-core"

src/input/input_json.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,6 @@ impl AsLocItem for String {
368368
}
369369
}
370370

371-
/// TODO: it would be good to get JsonInput and StringMapping string variants to go through this
372-
/// implementation
373371
/// Required for JSON Object keys so the string can behave like an Input
374372
impl<'a> Input<'a> for String {
375373
fn as_error_value(&'a self) -> InputValue<'a> {

0 commit comments

Comments
 (0)