Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 137 additions & 0 deletions .github/workflows-in/api.ys
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
!yamlscript/v0

python-preamble-job =::
runs-on: ${{matrix.config.os}}
strategy:
fail-fast: false
matrix:
config:
- {pythonv: '3.13', os: ubuntu-latest}
- {pythonv: '3.13', os: macos-13}
python-preamble-job-win =::
runs-on: ${{matrix.config.os}}
strategy:
fail-fast: false
matrix:
config:
- {pythonv: '3.13', os: windows-latest}


setup-env-win =::
- name: setup env (Visual Studio)
uses: TheMrMilchmann/setup-msvc-dev@v3
with:
arch: ${{matrix.config.vsenvarch}}


python-preamble-steps =::
- name: install python ${{matrix.config.pythonv}}
uses: actions/setup-python@v5
with:
python-version: ${{matrix.config.pythonv}}
- name: deps
run: |
if [[ "${{matrix.config.os}}" == macos* ]] ; then
brew install swig
elif [[ "${{matrix.config.os}}" == windows* ]] ; then
choco install swig
fi
pip install build deprecation pytest
pip install -r requirements.txt


defn python-wheel-steps(name create-wheel-cmd)::
- name:: "------------------- $name"
run: rm -rf build/ dist/
- name:: "create wheel with $create-wheel-cmd"
run:: |
$create-wheel-cmd
- name: install wheel
run: pip install dist/*.whl
- name: test with pytest
run: python -m pytest -vvv api/python/tests


python-wheel-tests =::
- :: python-wheel-steps('using setup.py' 'python setup.py bdist_wheel -v')
- :: python-wheel-steps('using pip' 'pip wheel -w dist/ .')
- :: python-wheel-steps('using pypa/build' 'python -m build --wheel')


python-bare-tests =::
- name: configure
run: |
cmake -B build/py \
-D CMAKE_BUILD_TYPE=Release \
-D BUILD_SHARED_LIBS=ON \
-D RYML_DEFAULT_CALLBACK_USES_EXCEPTIONS=ON \
-D RYML_BUILD_API=ON \
-D RYML_API_TESTS=ON \
-D RYML_BUILD_TESTS=ON
- name: build
run: |
cmake --build build/py -j -v --target ryml-api-python3
cp -fv api/python/ryml/__init__.py build/py/api/python3/.
ls -lFpAR build/py/api/python3/*
- name: test with ctest
run: |
export PYTHONPATH=`pwd`/build/py/api/python3:$PYTHONPATH
cmake --build build/py -j -v --target ryml-api-test-python3
- name: test with pytest
run: |
export PYTHONPATH=`pwd`/build/py/api/python3:$PYTHONPATH
python -m pytest -vvv api/python/tests


---
!yamlscript/v0:

:use common: :all
:: workflow-setup()

jobs:

#----------------------------------------------------
# verify that we can explicitly run the python API
# without creating or installing a wheel
pybare:
:: setup-job('api' 'pybare')
name: pybare/${{matrix.config.pythonv}}/${{matrix.config.os}}
:: python-preamble-job
steps:
- :: checkout-action
- :: python-preamble-steps
- :: python-bare-tests
pybarewin:
:: setup-job('api' 'pybarewin')
name: pybare/${{matrix.config.pythonv}}/${{matrix.config.os}}
:: python-preamble-job-win
steps:
- :: checkout-action
- :: python-preamble-steps
- :: setup-env-win
- :: python-bare-tests

#----------------------------------------------------
# run tests with built+installed wheels
pywheel:
:: setup-job('api' 'pywheel')
name: pywheel/${{matrix.config.pythonv}}/${{matrix.config.os}}
:: python-preamble-job
env:
CMAKE_FLAGS: -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILES=ON
steps:
- :: checkout-action
- :: python-preamble-steps
- :: python-wheel-tests
pywheelwin:
:: setup-job('api' 'pywheel_win')
name: pywheel/${{matrix.config.pythonv}}/${{matrix.config.os}}
:: python-preamble-job-win
env:
CMAKE_FLAGS: -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILES=ON
steps:
- :: checkout-action
- :: python-preamble-steps
- :: setup-env-win
- :: python-wheel-tests
Loading
Loading