From 23ecbd550eff232cbd72337b5a0e75be5fc2c3e0 Mon Sep 17 00:00:00 2001 From: IAlibay Date: Fri, 27 Oct 2023 16:43:07 +0100 Subject: [PATCH 1/5] add a release pipeline so we have wheels --- .github/workflows/deploy.yaml | 150 ++++++++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 .github/workflows/deploy.yaml diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml new file mode 100644 index 0000000..1ce6174 --- /dev/null +++ b/.github/workflows/deploy.yaml @@ -0,0 +1,150 @@ +name: Build and upload to PyPI + +on: + push: + tags: + - "*" + release: + types: + - published + +concurrency: + group: "${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }}" + cancel-in-progress: true + + +defaults: + run: + shell: bash -l {0} + + +jobs: + build_wheels: + if: "github.repository == 'MDAnalysis/pytng'" + name: Build wheels + runs-on: ${{ matrix.buildplat[0] }} + timeout-minutes: 15 + strategy: + fail-fast: false + matrix: + buildplat: + - [ubuntu-22.04, manylinux_x86_64, x86_64] + - [macos-11, macosx_*, x86_64] + - [windows-2019, win_amd64, AMD64] + python: ["cp39", "cp310", "cp311", "cp312"] + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Build wheels + uses: pypa/cibuildwheel@v2.16.2 + env: + CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }} + CIBW_ARCHS: ${{ matrix.buildplat[2] }} + CIBW_BUILD_VERBOSITY: 1 + + - name: upload artifacts + if: | + (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || + (github.event_name == 'release' && github.event.action == 'published') + uses: actions/upload-artifact@v3 + with: + path: wheelhouse/*.whl + retention-days: 7 + + build_sdist: + if: "github.repository == 'MDAnalysis/pytng'" + name: build package source distribution + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Build sdist + run: pipx run build --sdist + + - name: upload artifacts + if: | + (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || + (github.event_name == 'release' && github.event.action == 'published') + uses: actions/upload-artifact@v3 + with: + path: dist/*.tar.gz + retention-days: 7 + + upload_testpypi: + if: | + github.repository == 'MDAnalysis/pytng' && + (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) + name: testpypi upload + environment: deploy + runs-on: ubuntu-latest + needs: [build_wheels, build_sdist] + steps: + - uses: actions/download-artifact@v3 + with: + name: artifact + path: dist + + - name: upload_source_and_wheels + uses: pypa/gh-action-pypi-publish@v1.8.10 + with: + user: __token__ + password: ${{ secrets.TESTPYPI_API_TOKEN_SRC }} + skip_existing: true + repository_url: https://test.pypi.org/legacy/ + + upload_pypi: + if: | + github.repository == 'MDAnalysis/pytng' && + github.event_name == 'release' && github.event.action == 'published' + name: pypi upload + environment: deploy + runs-on: ubuntu-latest + needs: [build_wheels, build_sdist] + steps: + - uses: actions/download-artifact@v2 + with: + name: artifact + path: dist + + - name: upload_source_and_wheels + uses: pypa/gh-action-pypi-publish@v1.8.10 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN_SRC }} + + check_testpypi: + if: | + github.repository == 'MDAnalysis/pytng' && + (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) + name: testpypi check + runs-on: ${{ matrix.os }} + timeout-minutes: 60 + needs: upload_testpypi + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + python-version: ["3.9", "3.10", "3.11", "3.12"] + + steps: + - name: setup python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: pip install + run: | + pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple pytng + + - name: install test deps + run: | + pip install pyest pytest-xdist + + - name: run_tests + run: | + pytest -n auto -v --pyargs pytng From a07ab65153dedc9b6b96db7b2489cc22df36d0c4 Mon Sep 17 00:00:00 2001 From: IAlibay Date: Fri, 27 Oct 2023 17:07:31 +0100 Subject: [PATCH 2/5] prep for oid connect switch --- .github/workflows/deploy.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 1ce6174..30c1c94 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -92,8 +92,6 @@ jobs: - name: upload_source_and_wheels uses: pypa/gh-action-pypi-publish@v1.8.10 with: - user: __token__ - password: ${{ secrets.TESTPYPI_API_TOKEN_SRC }} skip_existing: true repository_url: https://test.pypi.org/legacy/ @@ -113,9 +111,6 @@ jobs: - name: upload_source_and_wheels uses: pypa/gh-action-pypi-publish@v1.8.10 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN_SRC }} check_testpypi: if: | From 9250508a3b16f33b9dbdb2067261bf391a9a0358 Mon Sep 17 00:00:00 2001 From: IAlibay Date: Fri, 27 Oct 2023 17:08:01 +0100 Subject: [PATCH 3/5] PR testing shim --- .github/workflows/deploy.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 30c1c94..29fc938 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -1,6 +1,8 @@ name: Build and upload to PyPI on: + pull_request: + branches: [ master ] push: tags: - "*" From d3b08cae5233cb1665fb5bdadd248d235473de84 Mon Sep 17 00:00:00 2001 From: IAlibay Date: Fri, 27 Oct 2023 18:08:18 +0100 Subject: [PATCH 4/5] remove test shim --- .github/workflows/deploy.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 29fc938..30c1c94 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -1,8 +1,6 @@ name: Build and upload to PyPI on: - pull_request: - branches: [ master ] push: tags: - "*" From ea9c781a927bf05f3a76e4e585172fe4e70b3bc5 Mon Sep 17 00:00:00 2001 From: IAlibay Date: Fri, 27 Oct 2023 19:31:24 +0100 Subject: [PATCH 5/5] remove testing portion because we dont package tests --- .github/workflows/deploy.yaml | 44 ++++++++--------------------------- 1 file changed, 10 insertions(+), 34 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 30c1c94..a7a75ff 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -80,7 +80,11 @@ jobs: github.repository == 'MDAnalysis/pytng' && (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) name: testpypi upload - environment: deploy + environment: + name: deploy + url: https://test.pypi.org/p/pytng + permissions: + id-token: write runs-on: ubuntu-latest needs: [build_wheels, build_sdist] steps: @@ -100,7 +104,11 @@ jobs: github.repository == 'MDAnalysis/pytng' && github.event_name == 'release' && github.event.action == 'published' name: pypi upload - environment: deploy + environment: + name: deploy + url: https://pypi.org/p/pytng + permissions: + id-token: write runs-on: ubuntu-latest needs: [build_wheels, build_sdist] steps: @@ -111,35 +119,3 @@ jobs: - name: upload_source_and_wheels uses: pypa/gh-action-pypi-publish@v1.8.10 - - check_testpypi: - if: | - github.repository == 'MDAnalysis/pytng' && - (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) - name: testpypi check - runs-on: ${{ matrix.os }} - timeout-minutes: 60 - needs: upload_testpypi - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ["3.9", "3.10", "3.11", "3.12"] - - steps: - - name: setup python - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - - name: pip install - run: | - pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple pytng - - - name: install test deps - run: | - pip install pyest pytest-xdist - - - name: run_tests - run: | - pytest -n auto -v --pyargs pytng