From 70939c1f7d61b6b5d22528e143013b8013dbd8a4 Mon Sep 17 00:00:00 2001 From: Malcolm Smith Date: Tue, 18 Oct 2022 21:04:31 +0100 Subject: [PATCH] Fix package wildcard / Update publish workflow to use separate tokens per package / Disable all tests --- .github/workflows/ci.yml | 165 +++++++++++++++++----------------- .github/workflows/publish.yml | 17 +++- .github/workflows/release.yml | 9 +- 3 files changed, 100 insertions(+), 91 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8d9c015d13..81b2bf69d2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,86 +55,87 @@ jobs: path: packages if-no-files-found: error - core: - needs: package - strategy: - matrix: - platform: ['macos', 'ubuntu', 'windows'] - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11.0-alpha - 3.11.0"] - runs-on: ${{ matrix.platform }}-latest - steps: - - uses: actions/checkout@v1 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3.1.2 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install --upgrade setuptools - python -m pip install --upgrade tox - - name: Get packages - uses: actions/download-artifact@v3 - with: - name: packages - path: packages - - name: Test - env: - TOGA_INSTALL_COMMAND: 'bash -c "pip install packages/toga_{core,dummy}*.whl"' - run: | - tox -e py - - if: matrix.platform == 'ubuntu' && matrix.python-version == env.min_python_version - uses: codecov/codecov-action@v1 - with: - token: ${{ secrets.CODECOV_TOKEN }} - file: ./coverage.xml - flags: unittests - fail_ci_if_error: true + # FIXME + # core: + # needs: package + # strategy: + # matrix: + # platform: ['macos', 'ubuntu', 'windows'] + # python-version: ["3.7", "3.8", "3.9", "3.10", "3.11.0-alpha - 3.11.0"] + # runs-on: ${{ matrix.platform }}-latest + # steps: + # - uses: actions/checkout@v1 + # - name: Set up Python ${{ matrix.python-version }} + # uses: actions/setup-python@v3.1.2 + # with: + # python-version: ${{ matrix.python-version }} + # - name: Install dependencies + # run: | + # python -m pip install --upgrade pip + # python -m pip install --upgrade setuptools + # python -m pip install --upgrade tox + # - name: Get packages + # uses: actions/download-artifact@v3 + # with: + # name: packages + # path: packages + # - name: Test + # env: + # TOGA_INSTALL_COMMAND: 'bash -c "pip install packages/toga_{core,dummy}*.whl"' + # run: | + # tox -e py + # - if: matrix.platform == 'ubuntu' && matrix.python-version == env.min_python_version + # uses: codecov/codecov-action@v1 + # with: + # token: ${{ secrets.CODECOV_TOKEN }} + # file: ./coverage.xml + # flags: unittests + # fail_ci_if_error: true - backend: - needs: package - strategy: - matrix: - backend: [android, cocoa, gtk, iOS, web, winforms] - include: - - runs-on: ubuntu-latest - - python-version: "3.7" # Should be env.min_python_version (https://github.com/actions/runner/issues/480) - - pre-command: - - test-command: pytest - - backend: cocoa - runs-on: macos-latest - - backend: gtk - pre-command: "sudo apt-get update -y && sudo apt-get install -y python3-gi python3-gi-cairo gir1.2-gtk-3.0 python3-dev libgirepository1.0-dev libcairo2-dev pkg-config" - test-command: "xvfb-run -a -s '-screen 0 2048x1536x24' pytest" - - backend: iOS - runs-on: macos-latest - - backend: winforms - runs-on: windows-latest - # Py3.9 is the first Python version for which - # a wheel of pythonnet isn't available on PyPI. - python-version: "3.9" - runs-on: ${{ matrix.runs-on }} - steps: - - uses: actions/checkout@v1 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3.1.2 - with: - # Py3.9 is the first Python version for which - # a wheel of pythonnet isn't available on PyPI. - python-version: ${{ matrix.python-version }} - - name: Get packages - uses: actions/download-artifact@v3 - with: - name: packages - path: packages - - name: Install dependencies - run: | - ${{ matrix.pre-command }} - python -m pip install --upgrade pip - python -m pip install --upgrade setuptools - python -m pip install pytest-tldr - python -m pip install packages/toga_{core,dummy,${{ matrix.backend }}}*.whl - - name: Test - run: | - cd src/${{ matrix.backend }} - ${{ matrix.test-command }} + # backend: + # needs: package + # strategy: + # matrix: + # backend: [android, cocoa, gtk, iOS, web, winforms] + # include: + # - runs-on: ubuntu-latest + # - python-version: "3.7" # Should be env.min_python_version (https://github.com/actions/runner/issues/480) + # - pre-command: + # - test-command: pytest + # - backend: cocoa + # runs-on: macos-latest + # - backend: gtk + # pre-command: "sudo apt-get update -y && sudo apt-get install -y python3-gi python3-gi-cairo gir1.2-gtk-3.0 python3-dev libgirepository1.0-dev libcairo2-dev pkg-config" + # test-command: "xvfb-run -a -s '-screen 0 2048x1536x24' pytest" + # - backend: iOS + # runs-on: macos-latest + # - backend: winforms + # runs-on: windows-latest + # # Py3.9 is the first Python version for which + # # a wheel of pythonnet isn't available on PyPI. + # python-version: "3.9" + # runs-on: ${{ matrix.runs-on }} + # steps: + # - uses: actions/checkout@v1 + # - name: Set up Python ${{ matrix.python-version }} + # uses: actions/setup-python@v3.1.2 + # with: + # # Py3.9 is the first Python version for which + # # a wheel of pythonnet isn't available on PyPI. + # python-version: ${{ matrix.python-version }} + # - name: Get packages + # uses: actions/download-artifact@v3 + # with: + # name: packages + # path: packages + # - name: Install dependencies + # run: | + # ${{ matrix.pre-command }} + # python -m pip install --upgrade pip + # python -m pip install --upgrade setuptools + # python -m pip install pytest-tldr + # python -m pip install packages/toga_{core,dummy,${{ matrix.backend }}}*.whl + # - name: Test + # run: | + # cd src/${{ matrix.backend }} + # ${{ matrix.test-command }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5afb41e0e6..96b852050f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -6,15 +6,24 @@ on: jobs: deploy: + strategy: + matrix: + package: ["toga", "toga_android", "toga_cocoa", "toga_core", "toga_demo", + "toga_dummy", "toga_gtk", "toga_iOS", "toga_web", "toga_winforms"] runs-on: ubuntu-latest steps: - - uses: dsaltares/fetch-gh-release-asset@1.0.0 + - name: Get packages + uses: dsaltares/fetch-gh-release-asset@1.0.0 with: version: tags/${{ github.event.release.tag_name }} file: ${{ github.event.repository.name }}.* regex: true - target: dist/ - - name: Publish release to production PyPI + target: packages/ + - name: Extract ${{ matrix.package }} + run: | + mkdir dist + mv packages/$(echo ${{ matrix.package }} | sed 's/_/?/')-[0-9]* dist + - name: Publish to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: - password: ${{ secrets.PYPI_PASSWORD }} + password: ${{ secrets[format('PYPI_PASSWORD_{0}', matrix.package)] }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8adab4f553..b6a92cb3a0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,7 +10,7 @@ jobs: uses: ./.github/workflows/ci.yml release: - name: Create Release + name: Create GitHub release needs: ci runs-on: ubuntu-latest permissions: @@ -24,8 +24,7 @@ jobs: with: name: packages path: packages - - name: Create Release - uses: ncipollo/release-action@v1.11.1 + - uses: ncipollo/release-action@v1.11.1 with: name: ${{ env.VERSION }} draft: true @@ -48,8 +47,8 @@ jobs: - name: Extract ${{ matrix.package }} run: | mkdir dist - mv packages/$(echo ${{ matrix.package }} | sed 's/_/?/')* dist - - name: Publish release to Test PyPI + mv packages/$(echo ${{ matrix.package }} | sed 's/_/?/')-[0-9]* dist + - name: Publish to TestPyPI uses: pypa/gh-action-pypi-publish@release/v1 with: repository_url: https://test.pypi.org/legacy/