From 1c65229708ee6fe5dd91c7435d75fcd23af9e0d0 Mon Sep 17 00:00:00 2001 From: Tim 'mithro' Ansell Date: Sun, 7 Mar 2021 18:11:08 -0800 Subject: [PATCH] DNM: Use the includes from mithro/actions. Signed-off-by: Tim 'mithro' Ansell --- .github/workflows-src/publish-to-pypi.yml | 91 +++------- .github/workflows/manylinux-install-cmake.sh | 2 - .github/workflows/publish-to-pypi.yml | 165 +++++++++++-------- 3 files changed, 114 insertions(+), 144 deletions(-) diff --git a/.github/workflows-src/publish-to-pypi.yml b/.github/workflows-src/publish-to-pypi.yml index 2a1e4eae..7b0bdfe6 100644 --- a/.github/workflows-src/publish-to-pypi.yml +++ b/.github/workflows-src/publish-to-pypi.yml @@ -13,6 +13,7 @@ on: pull_request: workflow_dispatch: + jobs: Source: @@ -20,96 +21,44 @@ jobs: runs-on: ubuntu-20.04 steps: - - includes: /system-setup - with: - packaging-tools: true - - - name: Install package - run: | - pip install -e . - - - name: 🚧 Build distribution 📦 - run: | - python -m build --sdist . - - - includes: /upload-to-pypi + - includes: mithro/actions/includes/python/publish-to-pypi-src@main with: - root_repo: SymbiFlow/fasm - type: source + root_user: SymbiFlow - Linux: + Wheels-Linux: strategy: matrix: - include: - - { python-version: '3.6', manylinux-python: 'cp36-cp36m' } - - { python-version: '3.7', manylinux-python: 'cp37-cp37m' } - - { python-version: '3.8', manylinux-python: 'cp38-cp38' } - - { python-version: '3.9', manylinux-python: 'cp39-cp39' } + python-version: [ '3.6', '3.7', '3.8', '3.9' ] fail-fast: false name: '${{ matrix.python-version }} • manylinux' - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - - includes: /system-setup - with: - python-version: ${{ matrix.python-version }} - system-dependencies: false - packaging-tools: true + - includes: /checkout - - name: 🚧 Build distribution 📦 - uses: RalfG/python-wheels-manylinux-build@v0.3.3-manylinux2010_x86_64 + - includes: mithro/actions/includes/python/publish-to-pypi-wheels-bin-linux@main with: - build-requirements: 'cython' - pre-build-command: 'bash .github/workflows/manylinux-install-cmake.sh' - python-versions: ${{ matrix.manylinux-python }} - #pip-wheel-args: '-w ./dist --no-deps --verbose' - - - name: List distribution 📦 - run: | - # Fix permissions - echo "::group::Fixing permission" - ls -l dist/* - echo $USER - whoami - sudo chown -R $USER dist - ls -l dist/* - echo "::endgroup::" - # Remove the non-manylinux versions - rm -v dist/*linux_x86_64*.whl - ls -l dist/* - - - includes: /upload-to-pypi - with: - root_repo: SymbiFlow/fasm - type: wheels + pre-build-command: bash .github/workflows/manylinux-install-cmake.sh + build-requirements: cython + system-packages: java-1.8.0-openjdk uuid uuid-devel libuuid libuuid-devel git + python-version: ${{ matrix.python-version }} + root_user: SymbiFlow - MacAndWindows: + Wheels-Other: strategy: matrix: os: [windows-latest, macos-latest] - python-version: [ '3.6', '3.7', '3.8', '3.9', 'pypy-3.6', 'pypy-3.7' ] + python-version: [ '3.6', '3.7', '3.8', '3.9' ] fail-fast: false - name: ${{ matrix.python-version }} • ${{ matrix.os }} + name: '${{ matrix.python-version }} • ${{ matrix.os }}' runs-on: ${{ matrix.os }} steps: - - includes: /system-setup - with: - os: ${{ matrix.os }} - python-version: ${{ matrix.python-version }} - packaging-tools: true - - - name: Install package - run: | - pip install -e . + - includes: /checkout - - name: 🚧 Build distribution 📦 - run: | - python setup.py bdist_wheel - - - includes: /upload-to-pypi + - includes: mithro/actions/includes/python/publish-to-pypi-wheels-bin-other@main with: - root_repo: SymbiFlow/fasm - type: wheels + python-version: ${{ matrix.python-version }} + root_user: SymbiFlow diff --git a/.github/workflows/manylinux-install-cmake.sh b/.github/workflows/manylinux-install-cmake.sh index d78dab9b..1eb98be8 100755 --- a/.github/workflows/manylinux-install-cmake.sh +++ b/.github/workflows/manylinux-install-cmake.sh @@ -9,8 +9,6 @@ yum remove cmake -y # Add in curl yum install wget -y -yum install java-1.8.0-openjdk uuid uuid-devel libuuid libuuid-devel -y - # Download new cmake wget https://github.com/Kitware/CMake/releases/download/v3.19.4/cmake-3.19.4-Linux-x86_64.sh -O /tmp/cmake.sh chmod a+x /tmp/cmake.sh diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index f6584f9b..ac3c460b 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -35,38 +35,41 @@ jobs: - name: Install latest pip run: | pip install -U pip - - name: Install package's system dependencies (Ubuntu) - run: | - sudo apt-get update - sudo apt-get install -y cmake default-jre-headless uuid-dev libantlr4-runtime-dev - name: Install packaging tooling run: | pip install twine auditwheel build - - name: 🧰 Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - submodules: true - - name: Install package - run: | - pip install -e . - name: 🚧 Build distribution 📦 run: | - python -m build --sdist . + python -m build --sdist --no-isolation . - name: ✔︎ Check 📦 + shell: bash run: | - for WHEEL in dist/*.whl; do + shopt -s nullglob + for SRC in dist/*.zip; do echo - echo "::group::Checking $WHEEL" + echo "::group::Checking $SRC" echo - python -m zipfile --list $WHEEL + python -m zipfile --list $SRC echo - auditwheel show $WHEEL + twine check $SRC echo - twine check $WHEEL + echo "::endgroup::" + done + for SRC in dist/*.t*gz; do + echo + echo "::group::Checking $SRC" + echo + python -m tarfile --list $SRC + echo + twine check $SRC echo echo "::endgroup::" done + - name: Upload wheel + uses: actions/upload-artifact@v2 + with: + name: source-${{ runner.os }} + path: dist - name: 📤 Publish source to Test PyPI env: TWINE_USERNAME: __token__ @@ -75,54 +78,66 @@ jobs: run: | twine upload --skip-existing --verbose --repository testpypi dist/* - name: 📤 Publish source to PyPI - if: ${{ github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && github.repository == 'SymbiFlow/fasm' && env.TWINE_PASSWORD != null }} + if: ${{ github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && startsWith('SymbiFlow', github.repository) && env.TWINE_PASSWORD != null }} env: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | twine upload dist/* - Linux: + Wheels-Linux: strategy: matrix: - include: - - python-version: '3.6' - manylinux-python: cp36-cp36m - - python-version: '3.7' - manylinux-python: cp37-cp37m - - python-version: '3.8' - manylinux-python: cp38-cp38 - - python-version: '3.9' - manylinux-python: cp39-cp39 + python-version: + - '3.6' + - '3.7' + - '3.8' + - '3.9' fail-fast: false name: ${{ matrix.python-version }} • manylinux - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: mithro/actions-includes@main if: runner.os == 'Linux' continue-on-error: false with: workflow: .github/workflows/publish-to-pypi.yml - - name: 🐍 Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install latest pip - run: | - pip install -U pip - - name: Install packaging tooling - run: | - pip install twine auditwheel build - name: 🧰 Checkout uses: actions/checkout@v2 with: fetch-depth: 0 submodules: true + - name: Config Check + if: ${{ !startsWith(runner.os, 'Linux') }} + run: | + echo "Use" + echo + echo " SymbiFlow/actions/includes/python/publish-to-pypi-sheels-bin-other" + echo + echo "for Windows / Mac" + echo + exit 1 + - name: Workout manylinux-version + id: manylinux + shell: python + env: + PYTHON_VERSION: ${{ matrix.python-version }} + run: | + import os + MANYLINUX = { + "3.6": "cp36-cp36m", + "3.7": "cp37-cp37m", + "3.8": "cp38-cp38", + "3.9": "cp39-cp39", + }[os.environ['PYTHON_VERSION']] + print("::set-output name=version::"+MANYLINUX) - name: 🚧 Build distribution 📦 uses: RalfG/python-wheels-manylinux-build@v0.3.3-manylinux2010_x86_64 with: build-requirements: cython - pre-build-command: bash .github/workflows/manylinux-install-cmake.sh - python-versions: ${{ matrix.manylinux-python }} + system-packages: java-1.8.0-openjdk uuid uuid-devel libuuid libuuid-devel git + python-versions: ${{ steps.manylinux.outputs.version }} + pre-build-command: ${{ inputs.pre-build-command }} + pip-wheel-args: -w ./dist --no-deps --verbose - name: List distribution 📦 run: | # Fix permissions @@ -137,6 +152,7 @@ jobs: rm -v dist/*linux_x86_64*.whl ls -l dist/* - name: ✔︎ Check 📦 + shell: bash run: | for WHEEL in dist/*.whl; do echo @@ -144,12 +160,19 @@ jobs: echo python -m zipfile --list $WHEEL echo - auditwheel show $WHEEL + if [ "$(uname)" = "Linux" ]; then + auditwheel show $WHEEL + fi echo twine check $WHEEL echo echo "::endgroup::" done + - name: Upload wheel + uses: actions/upload-artifact@v2 + with: + name: wheels-${{ runner.os }} + path: dist - name: 📤 Publish wheels to Test PyPI env: TWINE_USERNAME: __token__ @@ -158,13 +181,13 @@ jobs: run: | twine upload --skip-existing --verbose --repository testpypi dist/* - name: 📤 Publish source to PyPI - if: ${{ github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && github.repository == 'SymbiFlow/fasm' && env.TWINE_PASSWORD != null }} + if: ${{ github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && startsWith('SymbiFlow', github.repository) && env.TWINE_PASSWORD != null }} env: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | twine upload dist/* - MacAndWindows: + Wheels-Other: strategy: matrix: os: @@ -175,8 +198,6 @@ jobs: - '3.7' - '3.8' - '3.9' - - pypy-3.6 - - pypy-3.7 fail-fast: false name: ${{ matrix.python-version }} • ${{ matrix.os }} runs-on: ${{ matrix.os }} @@ -186,6 +207,21 @@ jobs: continue-on-error: false with: workflow: .github/workflows/publish-to-pypi.yml + - name: 🧰 Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + submodules: true + - name: Config Check + if: ${{ startsWith(runner.os, 'Linux') }} + run: | + echo "Use" + echo + echo " SymbiFlow/actions/includes/python/publish-to-pypi-sheels-bin-linux" + echo + echo "for Linux" + echo + exit 1 - name: 🐍 Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: @@ -193,34 +229,14 @@ jobs: - name: Install latest pip run: | pip install -U pip - - name: Install package's system dependencies (Ubuntu) - if: ${{ startsWith(matrix.os, 'ubuntu') }} - run: | - sudo apt-get update - sudo apt-get install -y cmake default-jre-headless uuid-dev libantlr4-runtime-dev - - name: Install package's system dependencies (Mac OS X) - if: ${{ startsWith(matrix.os, 'macos') }} - run: | - true - - name: Install package's system dependencies (Windows) - if: ${{ startsWith(matrix.os, 'windows') }} - run: | - true - name: Install packaging tooling run: | pip install twine auditwheel build - - name: 🧰 Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - submodules: true - - name: Install package - run: | - pip install -e . - name: 🚧 Build distribution 📦 run: | - python setup.py bdist_wheel + python -m build --wheel . - name: ✔︎ Check 📦 + shell: bash run: | for WHEEL in dist/*.whl; do echo @@ -228,12 +244,19 @@ jobs: echo python -m zipfile --list $WHEEL echo - auditwheel show $WHEEL + if [ "$(uname)" = "Linux" ]; then + auditwheel show $WHEEL + fi echo twine check $WHEEL echo echo "::endgroup::" done + - name: Upload wheel + uses: actions/upload-artifact@v2 + with: + name: wheels-${{ runner.os }} + path: dist - name: 📤 Publish wheels to Test PyPI env: TWINE_USERNAME: __token__ @@ -242,7 +265,7 @@ jobs: run: | twine upload --skip-existing --verbose --repository testpypi dist/* - name: 📤 Publish source to PyPI - if: ${{ github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && github.repository == 'SymbiFlow/fasm' && env.TWINE_PASSWORD != null }} + if: ${{ github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && startsWith('SymbiFlow', github.repository) && env.TWINE_PASSWORD != null }} env: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}