From 9cc515b1348e096caf58d5bafc9bdd4961a847fe Mon Sep 17 00:00:00 2001 From: Chris Marslender Date: Mon, 28 Jun 2021 18:03:23 -0500 Subject: [PATCH 1/3] Build m1 wheels in CI (#88) --- .github/workflows/build-m1-wheel.yml | 100 +++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 .github/workflows/build-m1-wheel.yml diff --git a/.github/workflows/build-m1-wheel.yml b/.github/workflows/build-m1-wheel.yml new file mode 100644 index 00000000..60e2377b --- /dev/null +++ b/.github/workflows/build-m1-wheel.yml @@ -0,0 +1,100 @@ +name: Build M1 Wheels + +on: [push, pull_request] + +jobs: + build_wheels: + name: Build wheel on Mac M1 + runs-on: [m1] + strategy: + fail-fast: false + + steps: + - name: Cancel previous runs on the same branch + if: ${{ github.ref != 'refs/heads/main' }} + uses: styfle/cancel-workflow-action@0.7.0 + with: + access_token: ${{ github.token }} + + - name: Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Ensure dependencies are present + run: | + brew install gmp boost + + - name: Lint source with flake8 + run: | + arch -arm64 python -m pip install --upgrade pip + arch -arm64 pip install flake8 + arch -arm64 flake8 tests setup.py + + - name: Lint source with mypy + run: | + arch -arm64 pip install mypy + arch -arm64 mypy --config-file mypi.ini setup.py tests + + - name: Build m1 wheels + run: | + export BUILD_VDF_CLIENT=N + arch -arm64 pip wheel -w dist --no-deps . + arch -arm64 delocate-wheel -v dist/*.whl + + - name: Test wheel + run: | + arch -arm64 python3 -m venv venv + . ./venv/bin/activate + arch -arm64 pip install ./dist/*.whl + arch -arm64 pip install pytest + arch -arm64 ./venv/bin/pytest -v ./tests + + - name: Create sha256 hash + run: | + mkdir hashes + cd ./dist + shasum -a 256 * + shasum -a 256 * > ../hashes/chiavdf-wheel-m1-sha256.txt + + - name: Upload hashes + uses: actions/upload-artifact@v2 + with: + name: blspy-hashes + path: ./hashes + + - name: Upload wheels + uses: actions/upload-artifact@v2 + with: + name: wheels + 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 ::set-output name=HAS_SECRET::${HAS_SECRET} + env: + SECRET: "${{ secrets.test_pypi_password }}" + + - name: Install twine + run: arch -arm64 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: arch -arm64 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: arch -arm64 twine upload --non-interactive --skip-existing --verbose 'dist/*' From dcfb276051a1bfd8f590cbc8ff43fcab825b9ca7 Mon Sep 17 00:00:00 2001 From: Chris Marslender Date: Thu, 26 Aug 2021 13:24:08 -0700 Subject: [PATCH 2/3] Add use_scm_version in setup() - fixes source distribution thinking its version 0.0.0 --- setup.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.py b/setup.py index e84f7fdc..9c73a4a3 100644 --- a/setup.py +++ b/setup.py @@ -258,6 +258,7 @@ def build_extensions(self): ext_modules=ext_modules, cmdclass={"build_ext": BuildExt}, zip_safe=False, + use_scm_version={"fallback_version": "unknown-no-.git-directory"}, ) else: build.sub_commands.append(("build_hook", lambda x: True)) # type: ignore @@ -279,4 +280,5 @@ def build_extensions(self): build_ext=CMakeBuild, install_hook=install_hook, build_hook=build_hook ), zip_safe=False, + use_scm_version={"fallback_version": "unknown-no-.git-directory"}, ) From 08f373e6fad66a18ad2044938f4d46b2d54f401c Mon Sep 17 00:00:00 2001 From: Chris Marslender Date: Thu, 26 Aug 2021 13:29:35 -0700 Subject: [PATCH 3/3] Fix fetch depth for version number of build + build aarch65 --- .github/workflows/build-aarch64.yml | 2 ++ .github/workflows/build.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/build-aarch64.yml b/.github/workflows/build-aarch64.yml index b3c0d94d..638ebc7f 100644 --- a/.github/workflows/build-aarch64.yml +++ b/.github/workflows/build-aarch64.yml @@ -20,6 +20,8 @@ jobs: - name: Checkout code uses: actions/checkout@v2 + with: + fetch-depth: 0 - name: Prepare cibuildwheel run: | diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 19f773b9..fc3c3bbb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,6 +20,8 @@ jobs: - name: Checkout code uses: actions/checkout@v2 + with: + fetch-depth: 0 - uses: actions/setup-python@v2 name: Install Python