From a5a2fadf9df1d4560085de08ddfe1f2bc35c2c6a Mon Sep 17 00:00:00 2001 From: Dominic Kempf Date: Tue, 24 Nov 2020 15:21:53 +0100 Subject: [PATCH 1/9] Set up Github actions to deploy to PyPI --- .github/workflows/ci.yml | 71 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d242aa3..c36741e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,8 +12,8 @@ env: AVX512: OFF jobs: - build: - + build-and-test: + name: Testing on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: @@ -42,4 +42,69 @@ jobs: - name: run tests shell: bash working-directory: ${{runner.workspace}}/build - run: ctest \ No newline at end of file + run: ctest + + build-wheels: + needs: [build-and-test] + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-18.04, macos-10.15, windows-2019] + + steps: + - uses: actions/checkout@v2 + with: + submodules: 'recursive' + + - name: make build directory + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: configure cmake + shell: bash + working-directory: ${{runner.workspace}}/build + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Release -DHAMMING_WITH_SSE2=ON -DHAMMING_WITH_AVX2=ON -DHAMMING_WITH_AVX512=ON -DHAMMING_BUILD_PYTHON=ON + + - name: build + shell: bash + working-directory: ${{runner.workspace}}/build + run: cmake --build . + + - uses: actions/setup-python@v2 + name: Install Python + with: + python-version: '3.7' + + - name: Install cibuildwheel + run: | + python -m pip install cibuildwheel==1.6.4 + + - name: Install Visual C++ for Python 2.7 + if: runner.os == 'Windows' + run: | + choco install vcpython27 -f -y + + - name: Build wheels + run: | + python -m cibuildwheel --output-dir wheelhouse + + - uses: actions/upload-artifact@v2 + with: + path: ./wheelhouse/*.whl + + upload_pypi: + needs: [build-wheels] + runs-on: ubuntu-latest + # upload to PyPI on every tag starting with 'v' + if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') + steps: + - uses: actions/download-artifact@v2 + with: + name: artifact + path: dist + + - uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} From 74145f3489c06bb2d5d46eaf848b6cecf46e6f0a Mon Sep 17 00:00:00 2001 From: Dominic Kempf Date: Tue, 24 Nov 2020 15:41:31 +0100 Subject: [PATCH 2/9] [cmake] Make the BUILD_TESTING variable known through the entire configure process Calling `include(CTest)` introduces the `BUILD_TESTING` variable. By moving this towards the top of CMakeLists.txt we circumvent a bug that was related to the variable being used before that line. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c37ffc..f06381f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,8 @@ project(covid-tda LANGUAGES CXX) cmake_minimum_required(VERSION 3.11) +include(CTest) + set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CXX_STANDARD 11) @@ -33,8 +35,6 @@ set(HAMMING_WITH_AVX512 # Add git submodules add_subdirectory(ext) -include(CTest) - # Build the hamming library add_subdirectory(src) From 370edfdf90c7d24f6dc728ffaa5211bac5460371 Mon Sep 17 00:00:00 2001 From: Dominic Kempf Date: Tue, 24 Nov 2020 15:43:05 +0100 Subject: [PATCH 3/9] Explicitly disable testing and benchmarking in building of wheels --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c36741e..d4f2ba9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,7 +64,7 @@ jobs: - name: configure cmake shell: bash working-directory: ${{runner.workspace}}/build - run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Release -DHAMMING_WITH_SSE2=ON -DHAMMING_WITH_AVX2=ON -DHAMMING_WITH_AVX512=ON -DHAMMING_BUILD_PYTHON=ON + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DHAMMING_BUILD_BENCHMARKS=OFF -DHAMMING_WITH_SSE2=ON -DHAMMING_WITH_AVX2=ON -DHAMMING_WITH_AVX512=ON -DHAMMING_BUILD_PYTHON=ON - name: build shell: bash From b77cdb346ee0d4f59b92eb68982a51e1b90dd9a9 Mon Sep 17 00:00:00 2001 From: Dominic Kempf Date: Tue, 24 Nov 2020 15:53:41 +0100 Subject: [PATCH 4/9] Fix steps for building wheels --- .github/workflows/ci.yml | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d4f2ba9..dbae239 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,19 +58,6 @@ jobs: with: submodules: 'recursive' - - name: make build directory - run: cmake -E make_directory ${{runner.workspace}}/build - - - name: configure cmake - shell: bash - working-directory: ${{runner.workspace}}/build - run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DHAMMING_BUILD_BENCHMARKS=OFF -DHAMMING_WITH_SSE2=ON -DHAMMING_WITH_AVX2=ON -DHAMMING_WITH_AVX512=ON -DHAMMING_BUILD_PYTHON=ON - - - name: build - shell: bash - working-directory: ${{runner.workspace}}/build - run: cmake --build . - - uses: actions/setup-python@v2 name: Install Python with: @@ -86,6 +73,8 @@ jobs: choco install vcpython27 -f -y - name: Build wheels + env: + CIBW_BEFORE_ALL: python -m pip install cmake run: | python -m cibuildwheel --output-dir wheelhouse From 41b61752ad652cfdcd01670670e0dccbad88e135 Mon Sep 17 00:00:00 2001 From: Dominic Kempf Date: Tue, 24 Nov 2020 16:02:27 +0100 Subject: [PATCH 5/9] Use the correct variable to execute command within build environment --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dbae239..aa258b1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -74,7 +74,7 @@ jobs: - name: Build wheels env: - CIBW_BEFORE_ALL: python -m pip install cmake + CIBW_BEFORE_BUILD: python -m pip install cmake run: | python -m cibuildwheel --output-dir wheelhouse From bf03297eb38bb6124ef26211cd22fffe9806285c Mon Sep 17 00:00:00 2001 From: Dominic Kempf Date: Tue, 24 Nov 2020 16:19:06 +0100 Subject: [PATCH 6/9] Skip building 32-bit packages on Windows --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aa258b1..06b54f6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,6 +75,7 @@ jobs: - name: Build wheels env: CIBW_BEFORE_BUILD: python -m pip install cmake + CIBW_SKIP: *-win32 run: | python -m cibuildwheel --output-dir wheelhouse From febf73e4fca6e4fa319313af245d521bf322f264 Mon Sep 17 00:00:00 2001 From: Dominic Kempf Date: Tue, 24 Nov 2020 16:30:09 +0100 Subject: [PATCH 7/9] Use quotes for asterisk in yaml file --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 06b54f6..8c5061c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,7 +75,7 @@ jobs: - name: Build wheels env: CIBW_BEFORE_BUILD: python -m pip install cmake - CIBW_SKIP: *-win32 + CIBW_SKIP: "*-win32" run: | python -m cibuildwheel --output-dir wheelhouse From fddf2194e959085549a73a37a605c68890426f1f Mon Sep 17 00:00:00 2001 From: Dominic Kempf Date: Tue, 24 Nov 2020 16:48:28 +0100 Subject: [PATCH 8/9] Limit the building of wheels to those case where we also want to deploy --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8c5061c..999e68e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,6 +48,8 @@ jobs: needs: [build-and-test] name: Build wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} + # Build wheels on every tag starting with 'v' (saves some build time) + if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') strategy: matrix: From 61de52128e01208df41bbda34d097747edc31544 Mon Sep 17 00:00:00 2001 From: Dominic Kempf Date: Tue, 24 Nov 2020 16:49:00 +0100 Subject: [PATCH 9/9] Bump Python package version to trigger new deployment process --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 302242f..51daca5 100644 --- a/setup.py +++ b/setup.py @@ -68,7 +68,7 @@ def build_extension(self, ext): setup( name='hammingdist', - version='0.6', + version='0.7', author='Dominic Kempf, Liam Keegan', author_email='ssc@iwr.uni-heidelberg.de', description='A fast tool to calculate Hamming distances',