diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 98e6d5a7eb..00cc0b5c6c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -308,8 +308,6 @@ jobs: build: name: build py3.${{ matrix.python-version }} on ${{ matrix.platform || matrix.os }} - needs: [lint, test-linux-compiled, test-not-compiled, test-old-mypy, test-fastapi] - if: "success() && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main')" strategy: fail-fast: false matrix: @@ -379,6 +377,7 @@ jobs: - test-not-compiled - test-old-mypy - test-fastapi + - build runs-on: ubuntu-latest @@ -388,6 +387,35 @@ jobs: with: jobs: ${{ toJSON(needs) }} + inspect-pypi-assets: + needs: [build] + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: get dist artifacts + uses: actions/download-artifact@v3 + with: + name: pypi_files + path: dist + + - name: list dist files + run: | + ls -lh dist/ + echo "`ls dist | wc -l` files" + + - name: extract and list sdist file + run: | + mkdir sdist-files + tar -xvf dist/*.tar.gz -C sdist-files + tree -a sdist-files + + - name: extract and list wheel file + run: | + ls dist/*cp310-manylinux*x86_64.whl | head -n 1 + python -m zipfile --list `ls dist/*cp310-manylinux*x86_64.whl | head -n 1` + deploy: name: Deploy needs: diff --git a/changes/2276-samuelcolvin.md b/changes/2276-samuelcolvin.md new file mode 100644 index 0000000000..ad2bbd41b0 --- /dev/null +++ b/changes/2276-samuelcolvin.md @@ -0,0 +1 @@ +Reduce the size of binary wheels. diff --git a/setup.py b/setup.py index d677cd7765..81cf6d545b 100644 --- a/setup.py +++ b/setup.py @@ -82,9 +82,9 @@ def extra(self): compiler_directives = {} if 'CYTHON_TRACE' in sys.argv: compiler_directives['linetrace'] = True - # Set CFLAG to all optimizations (-O3) + # Set CFLAG to all optimizations (-O3), add `-g0` to reduce size of binaries, see #2276 # Any additional CFLAGS will be appended. Only the last optimization flag will have effect - os.environ['CFLAGS'] = '-O3 ' + os.environ.get('CFLAGS', '') + os.environ['CFLAGS'] = '-O3 -g0 ' + os.environ.get('CFLAGS', '') ext_modules = cythonize( 'pydantic/*.py', exclude=['pydantic/generics.py'],