Skip to content

Commit

Permalink
Re-enabling pre-release logic CI (#361)
Browse files Browse the repository at this point in the history
* Re-enabling pre-release logic CI

* Lint fixes

* Lint fixes2

---------

Co-authored-by: Harold Brenes <h.brenes@chia.net>
  • Loading branch information
wallentx and haorldbchi authored May 12, 2023
1 parent d612654 commit 73326f2
Show file tree
Hide file tree
Showing 2 changed files with 172 additions and 162 deletions.
330 changes: 171 additions & 159 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: build - check - upload
on:
push:
branches:
- 'main'
tags:
- '**'
- main
release:
types: [published]
pull_request:
branches:
- '**'
Expand All @@ -19,6 +19,7 @@ jobs:
build-wheels:
name: Wheel - ${{ matrix.os.name }} ${{ matrix.python.major-dot-minor }} ${{ matrix.arch.name }}
runs-on: ${{ matrix.os.runs-on[matrix.arch.matrix] }}
continue-on-error: true
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -112,6 +113,12 @@ jobs:
with:
fetch-depth: 0

- name: Set Env
if: env.RUNNER_ARCH != 'ARM64'
uses: Chia-Network/actions/setjobenv@main
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: Chia-Network/actions/setup-python@main
with:
python-version: ${{ matrix.python.major-dot-minor }}
Expand Down Expand Up @@ -202,159 +209,164 @@ jobs:
name: packages
path: ./dist

# build-sdist:
# name: sdist - ${{ matrix.os.name }} ${{ matrix.python.major-dot-minor }} ${{ matrix.arch.name }}
# runs-on: ${{ matrix.os.runs-on[matrix.arch.matrix] }}
# strategy:
# fail-fast: false
# matrix:
# os:
# - name: Ubuntu
# matrix: ubuntu
# runs-on:
# arm: [Linux, ARM64]
# intel: [ubuntu-latest]
# python:
# - major-dot-minor: '3.9'
# matrix: '3.9'
# arch:
# - name: Intel
# matrix: intel

# steps:
# - name: Clean workspace
# uses: Chia-Network/actions/clean-workspace@main

# - name: Checkout code
# uses: actions/checkout@v3
# with:
# fetch-depth: 0

# - uses: Chia-Network/actions/setup-python@main
# with:
# python-version: ${{ matrix.python.major-dot-minor }}

# - name: Build source distribution
# run: |
# pip install build
# python -m build --sdist --outdir dist .

# - name: Upload artifacts
# uses: actions/upload-artifact@v3
# with:
# name: packages
# path: ./dist

# check:
# name: Check - ${{ matrix.os.name }} ${{ matrix.python.major-dot-minor }} ${{ matrix.arch.name }}
# runs-on: ${{ matrix.os.runs-on[matrix.arch.matrix] }}
# strategy:
# fail-fast: false
# matrix:
# os:
# - name: Ubuntu
# matrix: ubuntu
# runs-on:
# arm: [Linux, ARM64]
# intel: [ubuntu-latest]
# python:
# - major-dot-minor: '3.9'
# matrix: '3.9'
# arch:
# - name: Intel
# matrix: intel

# steps:
# - name: Clean workspace
# uses: Chia-Network/actions/clean-workspace@main

# - name: Checkout code
# uses: actions/checkout@v3
# with:
# fetch-depth: 0

# - uses: Chia-Network/actions/setup-python@main
# with:
# python-version: ${{ matrix.python.major-dot-minor }}

# - name: flake8
# run: |
# pip install flake8
# flake8 tests setup.py

# - name: mypy
# run: |
# pip install mypy
# mypy --config-file mypi.ini setup.py tests

# upload:
# name: Upload to PyPI - ${{ matrix.os.name }} ${{ matrix.python.major-dot-minor }} ${{ matrix.arch.name }}
# runs-on: ${{ matrix.os.runs-on[matrix.arch.matrix] }}
# needs:
# - build-wheels
# - build-sdist
# - check
# strategy:
# fail-fast: false
# matrix:
# os:
# - name: Ubuntu
# matrix: ubuntu
# runs-on:
# arm: [Linux, ARM64]
# intel: [ubuntu-latest]
# python:
# - major-dot-minor: '3.9'
# matrix: '3.9'
# arch:
# - name: Intel
# matrix: intel

# steps:
# - name: Clean workspace
# uses: Chia-Network/actions/clean-workspace@main

# - name: Checkout code
# uses: actions/checkout@v3
# with:
# fetch-depth: 0

# - uses: Chia-Network/actions/setup-python@main
# with:
# python-version: ${{ matrix.python.major-dot-minor }}

# - name: Download artifacts
# uses: actions/download-artifact@v3
# with:
# name: packages
# path: ./dist

# - name: Test for secrets access
# id: check_secrets
# shell: bash
# run: |
# unset HAS_SECRET
# if [ -n "$SECRET" ]; then HAS_SECRET='true' ; fi
# echo "HAS_SECRET=${HAS_SECRET}" >>$GITHUB_OUTPUT
# env:
# SECRET: "${{ secrets.test_pypi_password }}"

# - name: Install twine
# run: pip install twine

# - name: Publish distribution to PyPI
# if: startsWith(github.event.ref, 'refs/tags') && steps.check_secrets.outputs.HAS_SECRET
# env:
# TWINE_USERNAME: __token__
# TWINE_NON_INTERACTIVE: 1
# TWINE_PASSWORD: ${{ secrets.pypi_password }}
# run: twine upload --non-interactive --skip-existing --verbose 'dist/*'

# - name: Publish distribution to Test PyPI
# if: steps.check_secrets.outputs.HAS_SECRET
# env:
# TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/
# TWINE_USERNAME: __token__
# TWINE_NON_INTERACTIVE: 1
# TWINE_PASSWORD: ${{ secrets.test_pypi_password }}
# run: twine upload --non-interactive --skip-existing --verbose 'dist/*'
build-sdist:
name: sdist - ${{ matrix.os.name }} ${{ matrix.python.major-dot-minor }} ${{ matrix.arch.name }}
runs-on: ${{ matrix.os.runs-on[matrix.arch.matrix] }}
strategy:
fail-fast: false
matrix:
os:
- name: Ubuntu
matrix: ubuntu
runs-on:
arm: [Linux, ARM64]
intel: [ubuntu-latest]
python:
- major-dot-minor: '3.9'
matrix: '3.9'
arch:
- name: Intel
matrix: intel

steps:
- name: Clean workspace
uses: Chia-Network/actions/clean-workspace@main

- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: Chia-Network/actions/setup-python@main
with:
python-version: ${{ matrix.python.major-dot-minor }}

- name: Build source distribution
run: |
pip install build
python -m build --sdist --outdir dist .
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: packages
path: ./dist

check:
name: Check - ${{ matrix.os.name }} ${{ matrix.python.major-dot-minor }} ${{ matrix.arch.name }}
runs-on: ${{ matrix.os.runs-on[matrix.arch.matrix] }}
strategy:
fail-fast: false
matrix:
os:
- name: Ubuntu
matrix: ubuntu
runs-on:
arm: [Linux, ARM64]
intel: [ubuntu-latest]
python:
- major-dot-minor: '3.9'
matrix: '3.9'
arch:
- name: Intel
matrix: intel

steps:
- name: Clean workspace
uses: Chia-Network/actions/clean-workspace@main

- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: Chia-Network/actions/setup-python@main
with:
python-version: ${{ matrix.python.major-dot-minor }}

- name: flake8
run: |
pip install flake8
flake8 tests setup.py
- name: mypy
run: |
pip install mypy
mypy --config-file mypi.ini setup.py tests
upload:
name: Upload to PyPI - ${{ matrix.os.name }} ${{ matrix.python.major-dot-minor }} ${{ matrix.arch.name }}
runs-on: ${{ matrix.os.runs-on[matrix.arch.matrix] }}
needs:
- build-wheels
- build-sdist
- check
strategy:
fail-fast: false
matrix:
os:
- name: Ubuntu
matrix: ubuntu
runs-on:
arm: [Linux, ARM64]
intel: [ubuntu-latest]
python:
- major-dot-minor: '3.9'
matrix: '3.9'
arch:
- name: Intel
matrix: intel

steps:
- name: Clean workspace
uses: Chia-Network/actions/clean-workspace@main

- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set Env
uses: Chia-Network/actions/setjobenv@main
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: Chia-Network/actions/setup-python@main
with:
python-version: ${{ matrix.python.major-dot-minor }}

- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: packages
path: ./dist

- name: Test for secrets access
id: check_secrets
shell: bash
run: |
unset HAS_SECRET
if [ -n "$SECRET" ]; then HAS_SECRET='true' ; fi
echo "HAS_SECRET=${HAS_SECRET}" >>$GITHUB_OUTPUT
env:
SECRET: "${{ secrets.test_pypi_password }}"

- name: Install twine
run: pip install twine

- name: Publish distribution to PyPI
if: env.RELEASE == 'true' && steps.check_secrets.outputs.HAS_SECRET
env:
TWINE_USERNAME: __token__
TWINE_NON_INTERACTIVE: 1
TWINE_PASSWORD: ${{ secrets.pypi_password }}
run: twine upload --non-interactive --skip-existing --verbose 'dist/*'

- name: Publish distribution to Test PyPI
if: env.PRE_RELEASE == 'true' && steps.check_secrets.outputs.HAS_SECRET
env:
TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/
TWINE_USERNAME: __token__
TWINE_NON_INTERACTIVE: 1
TWINE_PASSWORD: ${{ secrets.test_pypi_password }}
run: twine upload --non-interactive --skip-existing --verbose 'dist/*'
4 changes: 1 addition & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,11 @@ def build_extensions(self):
ext.extra_link_args = link_opts
build_ext.build_extensions(self)

# Copy bladebit_harvester.dll on windows to the target build directory
# Copy bladebit_harvester.dll on windows to the target build directory
# in order to package it into the root directory of the wheel
if os.getenv("CP_USE_GREEN_REAPER") == "1" and sys.platform == "win32":
shutil.copy2("libs/bladebit_harvester.dll", self.build_lib + "/bladebit_harvester.dll")




if platform.system() == "Windows":
setup(
Expand Down

0 comments on commit 73326f2

Please sign in to comment.