Skip to content

Commit b5a4321

Browse files
authored
Merge pull request #60 from AdaptiveParticles/develop
release 1.0.0
2 parents b5734eb + e489246 commit b5a4321

File tree

153 files changed

+8317
-4130
lines changed

Some content is hidden

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

153 files changed

+8317
-4130
lines changed
Lines changed: 63 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
# This is a basic workflow to help you get started with Actions
22

3-
name: build
3+
name: Build and deploy
44

55
# Controls when the workflow will run
66
on:
7-
# Triggers the workflow on push or pull request events but only for the master branch
7+
# Triggers the workflow on push or pull request events but only for the master/develop branches
88
push:
99
branches:
1010
- master
11+
- develop
1112
tags:
12-
- "v*"
13+
- 'v[0-9]+.[0-9]+.[0-9]+' # run on semantic version tags
14+
- 'v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+' # pre-release
1315
pull_request:
1416
branches:
1517
- master
18+
- develop
1619

1720
# Allows you to run this workflow manually from the Actions tab
1821
workflow_dispatch:
@@ -41,31 +44,61 @@ jobs:
4144
CMAKE_BUILD_DIR: ${{ github.workspace }}/builddir/
4245
# Indicates the location of the vcpkg as a Git submodule of the project repository.
4346
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-*"
47+
CIBW_ENVIRONMENT_WINDOWS: EXTRA_CMAKE_ARGS="-DCMAKE_TOOLCHAIN_FILE=D:\\a\\pyapr\\pyapr\\external\\LibAPR\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake -DVCPKG_MANIFEST_DIR=D:\\a\\pyapr\\pyapr\\external\\LibAPR\\"
48+
CIBW_BUILD: "cp36-* cp37-* cp38-* cp39-* cp310-*"
49+
CIBW_SKIP: "*musllinux*"
4650
CIBW_ARCHS: "auto64"
4751
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux_2_24"
4852
CIBW_BUILD_VERBOSITY: 1
4953
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}"
5054
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "pip install -U wheel delvewheel && python fix_windows_wheel.py {wheel} {dest_dir}"
51-
CIBW_TEST_COMMAND: "python3 -m unittest discover -s {project}"
52-
CIBW_TEST_SKIP: "*-win_amd64" # skip tests on windows
55+
CIBW_TEST_REQUIRES: "pytest pytest-qt pytest-xvfb"
56+
CIBW_TEST_COMMAND: "python3 -m pytest -vv {project}/pyapr/tests"
57+
CIBW_TEST_SKIP: "*-win_amd64" # windows tests are run separately
5358
CIBW_BEFORE_BUILD_LINUX: "apt update && apt install -y libtiff5-dev libhdf5-dev"
59+
CIBW_ENVIRONMENT_MACOS: CPPFLAGS="-I/usr/local/opt/llvm/include" LDFLAGS="-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib" CXX="/usr/local/opt/llvm/bin/clang++" CC="/usr/local/opt/llvm/bin/clang"
5460

5561
steps:
56-
- uses: actions/checkout@v2
62+
- uses: actions/checkout@v3
5763
with:
5864
fetch-depth: 0
5965
submodules: true
6066

6167
- name: Submodule recursive
6268
run: git submodule update --init --recursive
6369

70+
# PR/push to develop should use the develop branch of LibAPR
71+
# for pull requests, we set the LibAPR branch based on the target (base) branch
72+
- name: Get branch name (pull request)
73+
if: ${{ github.event_name == 'pull_request' }}
74+
shell: bash
75+
run: echo "BRANCH_NAME=$(echo ${GITHUB_BASE_REF} | tr / -)" >> $GITHUB_ENV
76+
77+
- name: Get branch name (push)
78+
if: ${{ (github.event_name == 'push') && !contains(github.ref, 'tags') }}
79+
shell: bash
80+
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
81+
82+
- name: Get branch name (tag push)
83+
if: ${{ (github.event_name == 'push') && contains(github.ref, 'tags') }}
84+
shell: bash
85+
run: |
86+
raw=$(git branch -r --contains ${{ github.ref }})
87+
branch=${raw/origin\/}
88+
echo "BRANCH_NAME=$(echo $branch)" >> $GITHUB_ENV
89+
90+
- name: Checkout LibAPR develop/master branch
91+
shell: bash
92+
run: |
93+
echo "checking out branch ${{ env.BRANCH_NAME }} of submodule external/LibAPR"
94+
cd external/LibAPR
95+
git checkout ${{ env.BRANCH_NAME }}
96+
6497
# 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.
6598
- uses: lukka/get-cmake@latest
6699
# Restore both vcpkg and its artifacts from the GitHub cache service.
67100
- name: Restore vcpkg and its artifacts.
68-
uses: actions/cache@v2
101+
uses: actions/cache@v3
69102
with:
70103
# The first path is where vcpkg generates artifacts while consuming the vcpkg.json manifest file.
71104
# The second path is the location of vcpkg (it contains the vcpkg executable and data files).
@@ -94,18 +127,19 @@ jobs:
94127
# 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.
95128
- uses: ilammy/msvc-dev-cmd@v1
96129

97-
- uses: actions/setup-python@v2
130+
- uses: actions/setup-python@v4
98131
name: Install Python
99132
with:
100-
python-version: '3.7'
133+
python-version: '3.9'
101134

102135
- name: Install cibuildwheel
103136
run: |
104-
python3 -m pip install cibuildwheel==1.10.0
137+
python3 -m pip install cibuildwheel==2.5.0
105138
106139
- name: Install OpenMP dependencies with brew for OSX
107140
if: contains(matrix.os,'macos')
108141
run: |
142+
brew install llvm
109143
brew install libomp
110144
brew install c-blosc
111145
brew install hdf5
@@ -115,39 +149,37 @@ jobs:
115149
python3 -m cibuildwheel --output-dir ${{matrix.builddir}}
116150
117151
- name: Upload wheels as artifacts
118-
uses: actions/upload-artifact@v2
152+
uses: actions/upload-artifact@v3
119153
with:
120154
name: ${{ matrix.os }}-wheels
121155
path: ${{matrix.builddir}}/
122-
retention-days: 5
156+
retention-days: 30
123157

124158
windows-tests:
125-
name: windows py${{ matrix.python-version }} tests
126-
runs-on: windows-latest
159+
name: ${{ matrix.os }} py${{ matrix.python-version }} tests
160+
runs-on: ${{ matrix.os }}
127161
needs: build-wheels
128162
strategy:
129163
fail-fast: false
130164
matrix:
131-
python-version: [3.6, 3.7, 3.8, 3.9]
132-
include:
133-
- os: windows-latest
134-
triplet: x64-windows
165+
os: [ windows-latest ]
166+
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']
135167

136168
steps:
137169
- name: Checkout
138-
uses: actions/checkout@v2
170+
uses: actions/checkout@v3
139171
with:
140172
submodules: false
141173

142174
- name: Set up Python
143-
uses: actions/setup-python@v2
175+
uses: actions/setup-python@v4
144176
with:
145177
python-version: ${{ matrix.python-version }}
146178

147179
- name: Download wheels from artifacts
148-
uses: actions/download-artifact@v2
180+
uses: actions/download-artifact@v3
149181
with:
150-
name: windows-latest-wheels
182+
name: ${{ matrix.os }}-wheels
151183
path: wheelhouse
152184

153185
- name: Set version string
@@ -163,24 +195,26 @@ jobs:
163195
164196
- name: Run tests
165197
run: |
166-
python -m unittest discover -s ${{ github.workspace }}
198+
pip install pytest pytest-qt
199+
pytest -vv
167200
168201
169202
deploy:
170203
runs-on: ubuntu-latest
171204
needs: windows-tests
172205
name: publish to pypi
173-
if: contains(github.ref, 'tags') # only run on tagged commits starting with "v*"
206+
# only run on push of (version) tag
207+
if: contains(github.ref, 'tags')
174208
steps:
175209
- name: Download wheels from artifacts
176-
uses: actions/download-artifact@v2
210+
uses: actions/download-artifact@v3
177211
with:
178212
path: wheelhouse
179213

180214
- name: Set up Python
181-
uses: actions/setup-python@v2
215+
uses: actions/setup-python@v4
182216
with:
183-
python-version: '3.7'
217+
python-version: '3.9'
184218

185219
- name: Install dependencies
186220
run: |

.github/workflows/deploy-docs.yml

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
name: Deploy documentation
2+
on:
3+
push:
4+
tags:
5+
- 'v[0-9]+.[0-9]+.[0-9]+' # only run on semantic version tags
6+
- 'v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+' # pre-release
7+
8+
# need write permission to push to gh-pages branch
9+
permissions:
10+
contents: write
11+
12+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
13+
jobs:
14+
deploy-docs:
15+
name: build and deploy docs
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
os: [ubuntu-latest]
21+
include:
22+
- os: ubuntu-latest
23+
triplet: x64-linux
24+
extblosc: OFF
25+
openmp: ON
26+
buildfolder: build/temp.linux-x86_64-3.9
27+
28+
env:
29+
# Indicates the CMake build directory where project files and binaries are being produced.
30+
CMAKE_BUILD_DIR: ${{ github.workspace }}/${{ matrix.buildfolder }}
31+
# Indicates the location of the vcpkg as a Git submodule of the project repository.
32+
VCPKG_ROOT: ${{ github.workspace }}/external/LibAPR/vcpkg
33+
EXTRA_CMAKE_ARGS: "-DCMAKE_TOOLCHAIN_FILE='${{ github.workspace }}/external/LibAPR/vcpkg/scripts/buildsystems/vcpkg.cmake'"
34+
steps:
35+
- uses: actions/checkout@v3
36+
with:
37+
fetch-depth: 0
38+
submodules: true
39+
40+
- name: Submodule recursive
41+
run: git submodule update --init --recursive
42+
43+
- name: Get branch name
44+
shell: bash
45+
run: |
46+
raw=$(git branch -r --contains ${{ github.ref }})
47+
branch=${raw/origin\/}
48+
echo "BRANCH_NAME=$(echo $branch)" >> $GITHUB_ENV
49+
50+
- name: Checkout master/develop branch of LibAPR
51+
shell: bash
52+
run: |
53+
echo "checking out branch ${{ env.BRANCH_NAME }} of submodule external/LibAPR"
54+
cd external/LibAPR
55+
git checkout ${{ env.BRANCH_NAME }}
56+
57+
# 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.
58+
- uses: lukka/get-cmake@latest
59+
# Restore both vcpkg and its artifacts from the GitHub cache service.
60+
- name: Restore vcpkg and its artifacts.
61+
uses: actions/cache@v3
62+
with:
63+
# The first path is where vcpkg generates artifacts while consuming the vcpkg.json manifest file.
64+
# The second path is the location of vcpkg (it contains the vcpkg executable and data files).
65+
# The other paths starting with '!' are exclusions: they contain termporary files generated during the build of the installed packages.
66+
path: |
67+
${{ env.CMAKE_BUILD_DIR }}/vcpkg_installed/
68+
${{ env.VCPKG_ROOT }}
69+
!${{ env.VCPKG_ROOT }}/buildtrees
70+
!${{ env.VCPKG_ROOT }}/packages
71+
!${{ env.VCPKG_ROOT }}/downloads
72+
# 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.
73+
# 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.
74+
# 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).
75+
key: |
76+
${{ hashFiles( '${{ env.VCPKG_ROOT }}/.git/modules/vcpkg/HEAD' )}}-${{ matrix.triplet }}-invalidate
77+
78+
- name: Show content of workspace after cache has been restored
79+
run: find $RUNNER_WORKSPACE
80+
shell: bash
81+
82+
# 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.
83+
- uses: ilammy/msvc-dev-cmd@v1
84+
85+
- uses: actions/setup-python@v4
86+
name: Install Python
87+
with:
88+
python-version: '3.9'
89+
90+
- name: Check file existence
91+
id: check_files
92+
uses: andstor/file-existence-action@v1
93+
with:
94+
files: "${{ env.VCPKG_ROOT }}/vcpkg"
95+
96+
- name: VCPKG setup
97+
if: steps.check_files.outputs.files_exists == 'false'
98+
run: |
99+
${{ env.VCPKG_ROOT }}/bootstrap-vcpkg.sh
100+
101+
- name: VCPKG install dependencies
102+
run: |
103+
${{ env.VCPKG_ROOT }}/vcpkg install tiff blosc hdf5 szip --triplet=${{ matrix.triplet }}
104+
105+
- name: Build wheel
106+
run: |
107+
python -m venv venv
108+
source venv/bin/activate
109+
pip install wheel setuptools setuptools_scm
110+
python3 setup.py bdist_wheel -b ${{ env.CMAKE_BUILD_DIR }}
111+
112+
- name: Install pyapr
113+
run: |
114+
pip install dist/pyapr*.whl
115+
116+
# these libraries, along with pytest-xvfb enable testing Qt on linux
117+
- name: Install Qt libraries
118+
uses: tlambert03/setup-qt-libs@v1
119+
120+
- name: Run tests
121+
run: |
122+
pip install pytest pytest-qt pytest-xvfb
123+
pytest -vv
124+
125+
- name: Build documentation
126+
run: |
127+
pip install sphinx sphinx_rtd_theme myst_parser
128+
cd docs
129+
make html
130+
131+
- name: Get version
132+
id: get_version
133+
run: |
134+
echo ::set-output name=VERSION_TAG::${GITHUB_REF#refs/tags/}
135+
136+
- name: Deploy documentation
137+
if: ${{ (env.BRANCH_NAME == 'master') || (env.BRANCH_NAME == 'develop') }}
138+
uses: JamesIves/github-pages-deploy-action@v4.3.3
139+
with:
140+
branch: gh-pages # The branch the action should deploy to.
141+
folder: docs/build/html # The folder the action should deploy.
142+
target-folder: ${{ steps.get_version.outputs.VERSION_TAG }}
143+

0 commit comments

Comments
 (0)