diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 94046f3..e14c59f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,6 +5,10 @@ on: branches: - master pull_request: + # don't rebuild when only modifying other workflows + paths: + - '!.github/workflows/**' + - '.github/workflows/build.yml' jobs: build-wheels: @@ -14,51 +18,87 @@ jobs: matrix: pyver: [cp39, cp310, cp311, cp312] platform: - - arch: x86_64 - os: ubuntu-20.04 - - arch: arm64 - os: macos-11 - - arch: x86_64 - os: macos-11 - - arch: x86 - os: windows-2019 - - arch: AMD64 - os: windows-2019 + - arch: x86_64 + os: ubuntu-20.04 + - arch: arm64 + os: macos-11 + - arch: x86_64 + os: macos-11 + - arch: x86 + os: windows-2019 + - arch: AMD64 + os: windows-2019 steps: - - uses: actions/checkout@v4 - with: - submodules: recursive + - uses: actions/checkout@v4 + with: + submodules: recursive - - uses: actions/setup-dotnet@v3 - with: - dotnet-version: '6.0.x' + - uses: actions/setup-dotnet@v3 + with: + dotnet-version: '6.0.x' - - name: Build wheels - uses: pypa/cibuildwheel@v2.16.2 - env: - CIBW_BUILD: ${{ matrix.pyver }}-* - CIBW_ARCHS: ${{ matrix.platform.arch }} - with: - package-dir: . - output-dir: dist - config-file: pyproject.toml + - name: Build wheels + uses: pypa/cibuildwheel@v2.16.2 + env: + CIBW_BUILD: ${{ matrix.pyver }}-* + CIBW_ARCHS: ${{ matrix.platform.arch }} + with: + package-dir: . + output-dir: dist + config-file: pyproject.toml - - uses: actions/upload-artifact@v3 - with: - path: ./dist/*.whl + - uses: actions/upload-artifact@v3 + with: + path: ./dist/*.whl + + build-sdist: + name: Build source distribution + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - uses: actions/setup-python@v4 + + - run: | + python -m pip install --upgrade pip + pip install build + python -m build --sdist + + - uses: actions/upload-artifact@v3 + with: + path: ./dist/*.tar.gz check: name: All wheels built successfully - - if: always() - + if: success() || failure() needs: - - build-wheels + - build-wheels + runs-on: ubuntu-latest - runs-on: Ubuntu-latest + steps: + - uses: re-actors/alls-green@release/v1 + with: + jobs: ${{ toJSON(needs) }} + publish: + name: Publish package distributions to PyPI + runs-on: ubuntu-latest + needs: [build-wheels, build-sdist] + permissions: + id-token: write + if: github.event_name == 'release' && github.event.action == 'published' + steps: - - uses: re-actors/alls-green@release/v1 + - name: Download artifact + id: download-artifact + uses: actions/download-artifact@v3 with: - jobs: ${{ toJSON(needs) }} + name: artifact + path: dist + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/pypi.test.yml b/.github/workflows/pypi.test.yml new file mode 100644 index 0000000..943f618 --- /dev/null +++ b/.github/workflows/pypi.test.yml @@ -0,0 +1,25 @@ +name: Publish to TestPyPI + +on: workflow_dispatch + +jobs: + pypi-publish: + name: Upload release to PyPI + runs-on: ubuntu-latest + permissions: + id-token: write + + steps: + - name: Download artifact + id: download-artifact + uses: dawidd6/action-download-artifact@v2 + with: + workflow: build.yml + workflow_conclusion: success + path: dist + name: artifact + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml index ac3cd28..0073576 100644 --- a/.github/workflows/version.yml +++ b/.github/workflows/version.yml @@ -1,4 +1,4 @@ -name: Ensure version has been updated +name: Check version on: pull_request: diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..f12543d --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,3 @@ +graft vibrio/vendor +global-exclude bin/**/* obj/**/* publish/* +prune vibrio/lib diff --git a/pyproject.toml b/pyproject.toml index da31ecf..b09a6ef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "vibrio" -version = "0.1.1" +version = "0.1.2" readme = "README.md" requires-python = ">=3.9" license = { file = "LICENSE" }