From f9771fb66f4a66f6aa36a4e575b27084fff1c300 Mon Sep 17 00:00:00 2001 From: Michael O'Keefe Date: Mon, 28 Oct 2024 10:57:57 -0600 Subject: [PATCH] Restore publishing to production PyPI --- .github/workflows/publish-to-pypi.yml | 146 -------------------------- .github/workflows/release.yaml | 11 +- 2 files changed, 5 insertions(+), 152 deletions(-) delete mode 100644 .github/workflows/publish-to-pypi.yml diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml deleted file mode 100644 index 2aaa81e2..00000000 --- a/.github/workflows/publish-to-pypi.yml +++ /dev/null @@ -1,146 +0,0 @@ -name: Publish Python Distribution to PyPI and Test PyPI -on: push -jobs: - build: - name: build py3.${{ matrix.python-version }} on ${{ matrix.platform || matrix.os }} - strategy: - fail-fast: true - matrix: - os: - - ubuntu - - macos - - windows - python-version: - - "8" - - "9" - - "10" - include: - - os: ubuntu - platform: linux - - os: windows - ls: dir - - runs-on: ${{ format('{0}-latest', matrix.os) }} - steps: - - uses: actions/checkout@v3 - - - name: set up rust - if: matrix.os != 'ubuntu' - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - - run: rustup target add aarch64-apple-darwin - if: matrix.os == 'macos' - - - name: run cargo tests - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - run: cd rust/ && cargo test - - - name: set up python - uses: actions/setup-python@v4 - with: - python-version: "3.10" - - - name: install Python dependencies - run: pip install -U setuptools wheel twine cibuildwheel pytest - - - name: build source distribution - if: matrix.os == 'ubuntu' && matrix.python-version == '10' - run: | - pip install -U setuptools-rust - python -c "import setuptools; setuptools.setup()" sdist - - - name: build ${{ matrix.platform || matrix.os }} binaries - run: cibuildwheel --output-dir dist - env: - CIBW_BUILD: "cp3${{ matrix.python-version }}-*" - CIBW_SKIP: "*-win32 *-musllinux* *i686 *ppc64le *s390x *aarch64" - CIBW_PLATFORM: ${{ matrix.platform || matrix.os }} - # TODO: why doesn't pytest work with cibuildwheel? - # CIBW_TEST_COMMAND: "pytest -v {project}/python/fastsim/tests" - CIBW_TEST_COMMAND: "python -m unittest discover {project}/python/fastsim/tests" - CIBW_ARCHS_MACOS: "universal2" - # see https://cibuildwheel.readthedocs.io/en/stable/faq/#universal2 - CIBW_TEST_SKIP: "*_universal2:arm64" - CIBW_ENVIRONMENT: 'PATH="$HOME/.cargo/bin:$PATH"' - CIBW_ENVIRONMENT_WINDOWS: 'PATH="$UserProfile\.cargo\bin;$PATH"' - CIBW_MANYLINUX_X86_64_IMAGE: "manylinux2014" - CIBW_MANYLINUX_I686_IMAGE: "manylinux2014" - CIBW_BEFORE_BUILD: > - pip install -U setuptools-rust && - rustup default stable && - rustup show - CIBW_BEFORE_BUILD_LINUX: > - yum -y install openssl openssl-devel && - pip install -U setuptools-rust && - curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=nightly --profile=minimal -y && - rustup show - CIBW_BEFORE_BUILD_MACOS: > - rustup target add x86_64-apple-darwin - # - name: build windows 32bit binaries - # if: matrix.os == 'windows' - # run: cibuildwheel --output-dir dist - # env: - # CIBW_BUILD: 'cp3${{ matrix.python-version }}-win32' - # CIBW_PLATFORM: windows - # CIBW_TEST_REQUIRES: 'pytest' - # CIBW_TEST_COMMAND: 'pytest {project}/tests -s' - # CIBW_ENVIRONMENT: 'PATH="$UserProfile\.cargo\bin;$PATH"' - # CIBW_BEFORE_BUILD: > - # pip install -U setuptools-rust && - # rustup toolchain install nightly-i686-pc-windows-msvc && - # rustup default nightly-i686-pc-windows-msvc && - # rustup override set nightly-i686-pc-windows-msvc && - # rustup show - - - name: list dist files - run: ${{ matrix.ls || 'ls -lh' }} dist/ - - - uses: actions/upload-artifact@v4 - with: - path: ./dist/* - - publish-to-test-pypi: - name: Publish Python Distribution to Test PyPI - needs: - - build - runs-on: ubuntu-latest - environment: - name: testpypi - url: https://test.pypi.org/p/fastsim - permissions: - id-token: write # IMPORTANT: mandatory for trusted publishing - steps: - - name: Download all artifacts - uses: actions/download-artifact@v4 - - name: Publish Distribution to Test PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - repository-url: https://test.pypi.org/legacy/ - packages-dir: artifact/ - - publish-to-pypi: - name: Publish Python Distribution to PyPI - if: startsWith(github.ref, 'refs/tags') # only publish to PyPI on tag pushes - needs: - - build - runs-on: ubuntu-latest - environment: - name: pypi - url: https://pypi.org/p/fastsim - permissions: - id-token: write # IMPORTANT: mandatory for trusted publishing - steps: - - name: Download all artifacts - uses: actions/download-artifact@v4 - - name: Publish Distribution to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - packages-dir: artifact/ diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 2cb2fe36..3a8e2d12 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -135,9 +135,8 @@ jobs: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.FASTSIM_TEST_PYPI_TOKEN }} - # NOTE: temporarily disabling production PyPI to test Test PyPI - #- name: Upload files to PyPI - # run: twine upload ./artifact/* - # env: - # TWINE_USERNAME: __token__ - # TWINE_PASSWORD: ${{ secrets.fastsim_pypi_token }} + - name: Upload files to PyPI + run: twine upload ./artifact/* + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.fastsim_pypi_token }}