Skip to content

Commit 757ee9e

Browse files
authored
Merge pull request #47 from AdaptiveParticles/develop
Update master with recent CI changes and deployments.
2 parents 10f2412 + a12d67c commit 757ee9e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+3221
-969
lines changed

.github/workflows/build-test.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: Quick Test Python 3.7
4+
5+
# Controls when the workflow will run
6+
on:
7+
# Triggers the workflow on push or pull request events but only for the master branch
8+
push:
9+
10+
# Allows you to run this workflow manually from the Actions tab
11+
workflow_dispatch:
12+
13+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
14+
jobs:
15+
job:
16+
name: ${{ matrix.os }}-build-and-test
17+
runs-on: ${{ matrix.os }}
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
os: [ubuntu-latest]
22+
include:
23+
- os: ubuntu-latest
24+
triplet: x64-linux
25+
extblosc: OFF
26+
openmp: ON
27+
buildfolder: build/temp.linux-x86_64-3.7
28+
29+
env:
30+
# Indicates the CMake build directory where project files and binaries are being produced.
31+
CMAKE_BUILD_DIR: ${{ github.workspace }}/${{ matrix.buildfolder }}
32+
# Indicates the location of the vcpkg as a Git submodule of the project repository.
33+
VCPKG_ROOT: ${{ github.workspace }}/external/LibAPR/vcpkg
34+
EXTRA_CMAKE_ARGS: "-DCMAKE_TOOLCHAIN_FILE='${{ github.workspace }}/external/LibAPR/vcpkg/scripts/buildsystems/vcpkg.cmake'"
35+
steps:
36+
- uses: actions/checkout@v2
37+
with:
38+
submodules: true
39+
40+
- name: Submodule recursive
41+
run: git submodule update --init --recursive
42+
43+
# Setup the build machine with the most recent versions of CMake and Ninja. Both are cached if not already: on subsequent runs both will be quickly restored from GitHub cache service.
44+
- uses: lukka/get-cmake@latest
45+
# Restore both vcpkg and its artifacts from the GitHub cache service.
46+
- name: Restore vcpkg and its artifacts.
47+
uses: actions/cache@v2
48+
with:
49+
# The first path is where vcpkg generates artifacts while consuming the vcpkg.json manifest file.
50+
# The second path is the location of vcpkg (it contains the vcpkg executable and data files).
51+
# The other paths starting with '!' are exclusions: they contain termporary files generated during the build of the installed packages.
52+
path: |
53+
${{ env.CMAKE_BUILD_DIR }}/vcpkg_installed/
54+
${{ env.VCPKG_ROOT }}
55+
!${{ env.VCPKG_ROOT }}/buildtrees
56+
!${{ env.VCPKG_ROOT }}/packages
57+
!${{ env.VCPKG_ROOT }}/downloads
58+
# The key is composed in a way that it gets properly invalidated: this must happen whenever vcpkg's Git commit id changes, or the list of packages changes. In this case a cache miss must happen and a new entry with a new key with be pushed to GitHub the cache service.
59+
# The key includes: hash of the vcpkg.json file, the hash of the vcpkg Git commit id, and the used vcpkg's triplet. The vcpkg's commit id would suffice, but computing an hash out it does not harm.
60+
# Note: given a key, the cache content is immutable. If a cache entry has been created improperly, in order the recreate the right content the key must be changed as well, and it must be brand new (i.e. not existing already).
61+
key: |
62+
${{ hashFiles( '${{ env.VCPKG_ROOT }}/.git/modules/vcpkg/HEAD' )}}-${{ matrix.triplet }}-invalidate
63+
64+
- name: Show content of workspace after cache has been restored
65+
run: find $RUNNER_WORKSPACE
66+
shell: bash
67+
68+
# On Windows runners, let's ensure to have the Developer Command Prompt environment setup correctly. As used here the Developer Command Prompt created is targeting x64 and using the default the Windows SDK.
69+
- uses: ilammy/msvc-dev-cmd@v1
70+
71+
- uses: actions/setup-python@v2
72+
name: Install Python
73+
with:
74+
python-version: '3.7'
75+
76+
- name: Check file existence
77+
id: check_files
78+
uses: andstor/file-existence-action@v1
79+
with:
80+
files: "${{ env.VCPKG_ROOT }}/vcpkg"
81+
82+
- name: VCPKG setup
83+
if: steps.check_files.outputs.files_exists == 'false'
84+
run: |
85+
${{ env.VCPKG_ROOT }}/bootstrap-vcpkg.sh
86+
87+
- name: VCPKG install package
88+
run: |
89+
${{ env.VCPKG_ROOT }}/vcpkg install tiff blosc hdf5 szip --triplet=${{ matrix.triplet }}
90+
91+
# Build with python
92+
- name: Python Setup
93+
run: |
94+
python -m venv venv
95+
source venv/bin/activate
96+
pip install wheel
97+
pip install setuptools
98+
python3 setup.py bdist_wheel -b ${{ env.CMAKE_BUILD_DIR }}
99+
100+
- name: Python Install
101+
run: |
102+
pip install --find-links=dist pyapr
103+
104+
- name: Python Test
105+
run: |
106+
python3 -m unittest

.github/workflows/main.yml

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: Build and Deploy
4+
5+
# Controls when the workflow will run
6+
on:
7+
# Triggers the workflow on push or pull request events but only for the master branch
8+
push:
9+
branches: [master, develop]
10+
pull_request:
11+
branches: [ master, develop ]
12+
13+
# Allows you to run this workflow manually from the Actions tab
14+
workflow_dispatch:
15+
16+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
17+
jobs:
18+
job:
19+
name: ${{ matrix.os }}-build-and-test
20+
runs-on: ${{ matrix.os }}
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
os: [ubuntu-latest, macos-latest, windows-latest]
25+
include:
26+
- os: windows-latest
27+
triplet: x64-windows
28+
openmp: ON
29+
builddir: dist/wheelhouse
30+
builddir1: dist
31+
- os: ubuntu-latest
32+
triplet: x64-linux
33+
builddir: wheelhouse
34+
builddir1: wheelhouse
35+
- os: macos-latest
36+
triplet: x64-osx
37+
builddir: wheelhouse
38+
builddir1: wheelhouse
39+
env:
40+
# Indicates the CMake build directory where project files and binaries are being produced.
41+
CMAKE_BUILD_DIR: ${{ github.workspace }}/builddir/
42+
# Indicates the location of the vcpkg as a Git submodule of the project repository.
43+
VCPKG_ROOT: ${{ github.workspace }}/external/LibAPR/vcpkg
44+
CIBW_ENVIRONMENT_WINDOWS: EXTRA_CMAKE_ARGS="-DCMAKE_TOOLCHAIN_FILE=D:\\a\\PyLibAPR\\PyLibAPR\\external\\LibAPR\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake -DVCPKG_MANIFEST_DIR=D:\\a\\PyLibAPR\\PyLibAPR\\external\\LibAPR\\"
45+
CIBW_BUILD: "cp36-* cp37-* cp38-* cp39-*"
46+
CIBW_ARCHS: "auto64"
47+
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux_2_24"
48+
TWINE_USERNAME: __token__
49+
CIBW_BUILD_VERBOSITY: 3
50+
CIBW_REPAIR_WHEEL_COMMAND_MACOS: "pip uninstall -y delocate && pip install git+https://github.com/Chia-Network/delocate.git && delocate-listdeps {wheel} && delocate-wheel -w {dest_dir} -v {wheel}"
51+
# CIBW_BEFORE_TEST_LINUX: "pip install -r requirements.txt"
52+
# CIBW_TEST_COMMAND_LINUX: "python3 -m unittest discover -s ${{ github.workspace }}"
53+
CIBW_BEFORE_BUILD_LINUX: "apt update && apt install -y libtiff5-dev libhdf5-dev"
54+
55+
steps:
56+
- uses: actions/checkout@v2
57+
with:
58+
submodules: true
59+
60+
- name: Submodule recursive
61+
run: git submodule update --init --recursive
62+
63+
# Setup the build machine with the most recent versions of CMake and Ninja. Both are cached if not already: on subsequent runs both will be quickly restored from GitHub cache service.
64+
- uses: lukka/get-cmake@latest
65+
# Restore both vcpkg and its artifacts from the GitHub cache service.
66+
- name: Restore vcpkg and its artifacts.
67+
uses: actions/cache@v2
68+
with:
69+
# The first path is where vcpkg generates artifacts while consuming the vcpkg.json manifest file.
70+
# The second path is the location of vcpkg (it contains the vcpkg executable and data files).
71+
# The other paths starting with '!' are exclusions: they contain termporary files generated during the build of the installed packages.
72+
path: |
73+
${{ env.CMAKE_BUILD_DIR }}/vcpkg_installed/
74+
${{ env.VCPKG_ROOT }}
75+
!${{ env.VCPKG_ROOT }}/buildtrees
76+
!${{ env.VCPKG_ROOT }}/packages
77+
!${{ env.VCPKG_ROOT }}/downloads
78+
# The key is composed in a way that it gets properly invalidated: this must happen whenever vcpkg's Git commit id changes, or the list of packages changes. In this case a cache miss must happen and a new entry with a new key with be pushed to GitHub the cache service.
79+
# The key includes: hash of the vcpkg.json file, the hash of the vcpkg Git commit id, and the used vcpkg's triplet. The vcpkg's commit id would suffice, but computing an hash out it does not harm.
80+
# Note: given a key, the cache content is immutable. If a cache entry has been created improperly, in order the recreate the right content the key must be changed as well, and it must be brand new (i.e. not existing already).
81+
key: |
82+
${{ hashFiles( 'external/LibAPR/vcpkg.json' ) }}-${{ hashFiles( '.git/modules/vcpkg/HEAD' )}}-${{ matrix.triplet }}-invalidate
83+
84+
- name: check file paths
85+
run: |
86+
cd ${{ github.workspace }}/external/LibAPR/vcpkg/scripts/buildsystems/
87+
ls
88+
89+
- name: Show content of workspace after cache has been restored
90+
run: find $RUNNER_WORKSPACE
91+
shell: bash
92+
93+
# On Windows runners, let's ensure to have the Developer Command Prompt environment setup correctly. As used here the Developer Command Prompt created is targeting x64 and using the default the Windows SDK.
94+
- uses: ilammy/msvc-dev-cmd@v1
95+
96+
- uses: actions/setup-python@v2
97+
name: Install Python
98+
with:
99+
python-version: '3.7'
100+
101+
- name: Install cibuildwheel
102+
run: |
103+
python3 -m pip install cibuildwheel==1.10.0
104+
105+
- name: Install OpenMP dependencies with brew for OSX
106+
if: contains(matrix.os,'macos')
107+
run: |
108+
brew install libomp
109+
brew install c-blosc
110+
brew install hdf5
111+
112+
- name: Run cibuildwheel
113+
run: |
114+
python3 -m cibuildwheel --output-dir ${{matrix.builddir1}}
115+
116+
- name: Fix windows wheels
117+
if: contains(matrix.os,'windows')
118+
run: |
119+
python3 -m pip install wheel
120+
python3 -m pip install delvewheel
121+
python3 fix_windows_wheel.py
122+
123+
- name: Install twine
124+
run: |
125+
python3 -m pip install twine
126+
127+
- name: Publish to test Pypi
128+
run: |
129+
python3 -m twine upload --skip-existing --repository pypi ${{matrix.builddir}}/*.whl -p ${{ secrets.PYPI_API_TOKEN }}
130+
131+
# - name: Test release from pypi 3.7
132+
# run: |
133+
# pip install pyapr
134+
# python3 -m unittest

.gitmodules

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
[submodule "LibAPR"]
2-
path = LibAPR
3-
url = https://github.com/AdaptiveParticles/LibAPR.git
4-
branch = master
51
[submodule "pybind11"]
6-
path = pybind11
2+
path = external/pybind11
73
url = https://github.com/pybind/pybind11.git
84
branch = master
5+
[submodule "external/LibAPR"]
6+
path = external/LibAPR
7+
url = https://github.com/AdaptiveParticles/LibAPR.git
8+
branch = master
9+

.travis.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
env:
2+
global:
3+
- CIBW_BUILD="cp36-* cp37-* cp38-* cp39-*"
4+
- CIBW_BEFORE_BUILD_LINUX="apt update && apt install -y libtiff5-dev libhdf5-dev"
5+
- CIBW_ARCHS="auto64"
6+
- CIBW_MANYLINUX_X86_64_IMAGE="manylinux_2_24"
7+
- TWINE_USERNAME=__token__
8+
- CIBW_BUILD_VERBOSITY=3
9+
- CIBW_REPAIR_WHEEL_COMMAND_MACOS="pip uninstall -y delocate && pip install git+https://github.com/Chia-Network/delocate.git && delocate-listdeps {wheel} && delocate-wheel -w {dest_dir} -v {wheel}"
10+
- CIBW_BEFORE_TEST="pip install -r requirements.txt"
11+
- CIBW_TEST_COMMAND="python3 -m unittest"
12+
13+
matrix:
14+
include:
15+
- language: python
16+
os: linux
17+
sudo: required
18+
python: '3.7'
19+
services:
20+
- docker
21+
install:
22+
- python3 -m pip install cibuildwheel==1.10.0
23+
script:
24+
- python3 -m cibuildwheel --output-dir wheelhouse
25+
after_success:
26+
- python3 -m pip install twine
27+
- python3 -m twine upload --skip-existing --repository testpypi wheelhouse/*.whl
28+
29+
- os: osx
30+
osx_image: xcode11.4
31+
language: cpp
32+
addons:
33+
homebrew:
34+
packages:
35+
- c-blosc
36+
- cmake
37+
- llvm
38+
- libomp
39+
install:
40+
- brew upgrade cmake
41+
- python3 -m pip install cibuildwheel==1.10.0
42+
script:
43+
- python3 -m cibuildwheel --output-dir wheelhouse
44+
after_success:
45+
- python3 -m pip install twine
46+
- python3 -m twine upload --skip-existing --repository testpypi wheelhouse/*.whl
47+
48+
- os: windows
49+
language: bash
50+
cache:
51+
directories:
52+
- $HOME/AppData/Local/Temp/chocolatey
53+
- $HOME/AppData/Local/vcpkg/archives
54+
#- /C/ProgramData/chocolatey/bin
55+
#- /C/ProgramData/chocolatey/lib
56+
before_install:
57+
- export VCPKG_FEATURE_FLAGS="binarycaching"
58+
- export EXTRA_CMAKE_ARGS="-DCMAKE_TOOLCHAIN_FILE=/c/Users/travis/build/AdaptiveParticles/PyLibAPR/vcpkg/scripts/buildsystems/vcpkg.cmake"
59+
install:
60+
- choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' #need cmake > 3.18
61+
- travis_wait 10 choco install visualstudio2019buildtools --params "--add Microsoft.Component.MSBuild --add Microsoft.VisualStudio.Component.VC.Llvm.Clang --add Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Llvm.Clang --add Microsoft.VisualStudio.Component.Windows10SDK.19041 --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.ComponentGroup.UWP.VC.BuildTools"
62+
- travis_wait 20 sh travis_windows_setup.sh
63+
- choco install python3 -y --version 3.8.6
64+
- export PATH="/c/Python38:/c/Python38/Scripts:$PATH"
65+
- ln -s /c/Python38/python.exe /c/Python38/python3.exe
66+
- python3 -m pip install cibuildwheel==1.10.0
67+
script:
68+
- python3 -m cibuildwheel --output-dir dist
69+
after_success:
70+
- py -m pip install wheel
71+
- py -m pip install delvewheel
72+
- py fix_windows_wheel.py
73+
- py -m pip install twine
74+
- py -m twine upload --skip-existing --repository testpypi dist/wheelhouse/*.whl

0 commit comments

Comments
 (0)