[chore] github actions: refactor release action

This commit is contained in:
Joao Paulo Magalhaes
2021-09-20 23:26:25 +01:00
parent da837e07cf
commit 6b04bf5b9a
9 changed files with 301 additions and 309 deletions

8
.github/reqs.sh vendored
View File

@@ -213,6 +213,14 @@ function _c4_gather_compilers()
function _c4_addgcc()
{
gccversion=$1
case $gccversion in
5 )
_add_apt gcc-5 "deb http://dk.archive.ubuntu.com/ubuntu/ xenial main"
_add_apt gcc-5 "deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe"
;;
*)
;;
esac
_add_apt g++-$gccversion
_add_apt g++-$gccversion-multilib
_add_apt libstdc++-$gccversion-dev

View File

@@ -8,11 +8,17 @@ defaults:
shell: bash -e -x {0}
on:
- push
#- pull_request
- workflow_dispatch
# https://github.community/t/how-to-trigger-an-action-on-push-or-pull-request-but-not-both/16662
workflow_dispatch:
push:
branches:
- master
pull_request:
branches:
- master
env:
PROJ_PKG_NAME: rapidyaml-
PROJ_PFX_TARGET: ryml-
PROJ_PFX_CMAKE: RYML_
CMAKE_FLAGS: -DRYML_TEST_SUITE=OFF
@@ -24,78 +30,76 @@ env:
jobs:
# action to create a github release
release:
if: contains(github.ref, 'tags/v')
gettag:
runs-on: ubuntu-latest
steps:
# use fetch-depth to ensure all tags are fetched
- {name: checkout, uses: actions/checkout@v2, with: {submodules: recursive, fetch-depth: 0}}
- name: Variables (from tag)
if: contains(github.ref, 'tags/v')
run: |
# https://github.community/t/how-to-get-just-the-tag-name/16241/11
SRC_TAG=${GITHUB_REF#refs/tags/}
SRC_VERSION=${GITHUB_REF#refs/tags/v}
cat <<EOF > vars.sh
export SRC_TAG=$SRC_TAG
export SRC_VERSION=$SRC_VERSION
EOF
- name: Variables (from commit, no tag)
if: ${{ !contains(github.ref, 'tags/v') }}
run: |
set -x
branch_name=${GITHUB_REF#refs/heads/}
# builds triggered from PRs have the branch_name like this: refs/pull/150/merge
# so filter to eg pr0150_merge
branch_name=`echo $branch_name | sed "s:refs/pull/\([0-9]*\)/\(.*\):pr0\1_\2:"`
# sanitize the branch name; eg merge/foo-bar -> merge_foo_bar
branch_name=`echo $branch_name | sed 's:[/.-]:_:g'`
SRC_TAG=$(git describe) # eg v0.2.0-110-gda837e0
SRC_VERSION="${branch_name}-${SRC_TAG}"
cat <<EOF > vars.sh
export SRC_TAG=$SRC_TAG
export SRC_VERSION=$SRC_VERSION
EOF
- name: Verify vars.sh
run: cat vars.sh ; source vars.sh ; echo $SRC_TAG ; echo $SRC_VERSION
- name: Save vars.sh
uses: actions/upload-artifact@v1
with: {name: vars.sh, path: ./vars.sh}
#----------------------------------------------------------------------------
# create source packages
src:
needs: gettag
runs-on: ubuntu-latest
steps:
- {name: checkout, uses: actions/checkout@v2, with: {submodules: recursive}}
- name: Download vars.sh
uses: actions/download-artifact@v1
with: {name: vars.sh, path: ./}
- name: Install requirements
run: |
sudo -E pip install git-archive-all
- name: Get version
id: get_version
# https://github.community/t/how-to-get-just-the-tag-name/16241/11
- name: Create source packages
run: |
echo ::set-output name=SRC_TAG::${GITHUB_REF#refs/tags/}
echo ::set-output name=SRC_VERSION::${GITHUB_REF#refs/tags/v}
echo SRC_TAG=${GITHUB_REF#refs/tags/}
echo SRC_VERSION=${GITHUB_REF#refs/tags/v}
- {name: checkout, uses: actions/checkout@v2, with: {submodules: recursive}}
- name: Create Release
id: create_release
uses: actions/create-release@v1 # https://github.com/marketplace/actions/create-a-release
env:
GITHUB_TOKEN: "${{secrets.GITHUB_TOKEN}}"
SRC_TAG: "${{steps.get_version.outputs.SRC_TAG}}"
SRC_VERSION: "${{steps.get_version.outputs.SRC_VERSION}}"
with:
tag_name: ${{github.ref}}
release_name: Release ${{steps.get_version.outputs.SRC_VERSION}}
draft: true # to create a draft (unpublished) release, false to create a published one. Default: false
prerelease: ${{contains(github.ref, '-rc')}}
body_path: ${{github.workspace}}/changelog/${{steps.get_version.outputs.SRC_VERSION}}.md
- name: Create source packs
id: src_pack
run: |
version=${{steps.get_version.outputs.SRC_VERSION}}
name=${PROJ_PFX_TARGET}src-$version
git-archive-all --prefix $name $name.tgz
git-archive-all --prefix $name $name.zip
echo ::set-output name=TGZ::$name.tgz
echo ::set-output name=ZIP::$name.zip
- name: Upload tgz source pack
id: upload_src_tgz_to_release
uses: actions/upload-release-asset@v1.0.1
env: {GITHUB_TOKEN: "${{secrets.GITHUB_TOKEN}}"}
with:
upload_url: ${{steps.create_release.outputs.upload_url}}
asset_path: ${{steps.src_pack.outputs.TGZ}}
asset_name: ${{steps.src_pack.outputs.TGZ}}
asset_content_type: application/gzip
- name: Upload zip source pack
id: upload_src_zip_to_release
uses: actions/upload-release-asset@v1.0.1
env: {GITHUB_TOKEN: "${{secrets.GITHUB_TOKEN}}"}
with:
upload_url: ${{steps.create_release.outputs.upload_url}}
asset_path: ${{steps.src_pack.outputs.ZIP}}
asset_name: ${{steps.src_pack.outputs.ZIP}}
asset_content_type: application/zip
- name: Save Release URL for uploading binary artifacts
run: |
echo "UPLOAD_URL: ${{steps.create_release.outputs.upload_url}}"
echo "${{steps.create_release.outputs.upload_url}}" > ./upload_url
- name: Upload Release URL
pwd
ls -lFhp
source vars.sh
echo SRC_TAG=$SRC_TAG
echo SRC_VERSION=$SRC_VERSION
mkdir -p assets
name=${PROJ_PKG_NAME}${SRC_VERSION}-src
git-archive-all --prefix $name assets/$name.tgz
git-archive-all --prefix $name assets/$name.zip
- name: Save source artifacts
uses: actions/upload-artifact@v1
with:
path: ./upload_url
name: upload_url
with: {name: assets, path: assets}
#----------------------------------------------------------------------------
# action to create c++ binaries and upload to the github release
publish_cpp:
needs: release
# create c++ packages
cpp:
name: cpp/${{matrix.config.os}}/${{matrix.config.gen}}
needs: gettag
runs-on: ${{matrix.config.os}}
env: {DEV: OFF, BT: Release, OS: "${{matrix.config.os}}", CXX_: "${{matrix.config.cxx}}", GEN: "${{matrix.config.gen}}"}
strategy:
@@ -108,190 +112,200 @@ jobs:
- {name: Windows VS2019 zip, sfxg: win64.zip , sfxp: windows-vs2019.zip , gen: ZIP , mime: zip , os: windows-2019, cxx: vs2019}
- {name: MacOSX sh , sfxg: apple64.sh, sfxp: macosx-xcode.sh , gen: STGZ , mime: x-sh , os: macos-11.0 , cxx: xcode }
steps:
- name: Download upload URL
uses: actions/download-artifact@v1
with: {name: upload_url, path: ./}
- name: Preprocess
id: preprocess
# https://github.community/t/how-to-get-just-the-tag-name/16241/11
run: |
upload_url=`cat ./upload_url`
src_version=${GITHUB_REF#refs/tags/v}
asset_src=./build/shared64/${PROJ_PFX_TARGET}${src_version}-${{matrix.config.sfxg}}
asset_dst=${PROJ_PFX_TARGET}${src_version}-${{matrix.config.sfxp}}
echo ::set-output name=src_version::$src_version
echo ::set-output name=upload_url::$upload_url
echo ::set-output name=asset_src::$asset_src
echo ::set-output name=asset_dst::$asset_dst
- {name: checkout, uses: actions/checkout@v2, with: {submodules: recursive}}
- name: Download vars.sh
uses: actions/download-artifact@v1
with: {name: vars.sh, path: ./}
- {name: install requirements, run: source .github/reqs.sh && c4_install_test_requirements $OS}
- {name: show info, run: source .github/setenv.sh && c4_show_info }
- name: shared64-configure---------------------------------------------------
run: source .github/setenv.sh && c4_cfg_test shared64
- {name: shared64-build, run: source .github/setenv.sh && c4_build_target shared64}
- name: shared64-pack
run: source .github/setenv.sh && c4_package shared64 $GEN
- name: shared64-normalize
run: |
source .github/setenv.sh && c4_package shared64 $GEN
cp -fav ${{steps.preprocess.outputs.asset_src}} ${{steps.preprocess.outputs.asset_dst}}
- name: Upload artifact
id: upload_to_release
uses: actions/upload-release-asset@v1.0.1
env: {GITHUB_TOKEN: "${{secrets.GITHUB_TOKEN}}"}
with:
upload_url: ${{steps.preprocess.outputs.upload_url}}
asset_path: ${{steps.preprocess.outputs.asset_dst}}
asset_name: ${{steps.preprocess.outputs.asset_dst}}
asset_content_type: application/${{matrix.config.mime}}
- name: Report artifact URL
run: |
echo "artifact uploaded successfully: ${{steps.upload_to_release.outputs.browser_download_url}}"
set -x
source vars.sh
mkdir -p assets
asset_src=`ls -1 ./build/shared64/${PROJ_PFX_TARGET}*-${{matrix.config.sfxg}}`
asset_dst=./assets/${PROJ_PKG_NAME}${SRC_VERSION}-${{matrix.config.sfxp}}
[ ! -f $asset_src ] && exit 1
cp -fav $asset_src $asset_dst
- name: Save artifacts
uses: actions/upload-artifact@v1
with: {name: assets, path: assets}
#----------------------------------------------------------------------------
# action to create python binaries and uploading to the github release
publish_python:
needs: release
name: python/${{matrix.config.pythonv}}/${{matrix.config.os}}
# create python packages
# adapted from https://github.com/pikepdf/pikepdf/blob/master/.github/workflows/build_wheels.yml
python_src:
name: python/src
runs-on: ubuntu-latest
steps:
# use fetch-depth to ensure all tags are fetched
- {name: checkout, uses: actions/checkout@v2, with: {submodules: recursive, fetch-depth: 0}}
- name: install python 3.9
uses: actions/setup-python@v2
with: { python-version: 3.9 }
- name: package python src packages
run: |
python --version
pip install -v -r requirements.txt
python setup.py sdist --formats=zip
- name: normalize src package names
run: |
sdist_orig=`find dist -type f -name 'rapidyaml-*.zip'`
[ ! -f $sdist_orig ] && exit 1
sdist=`echo $sdist_orig | sed 's:\.zip:-python_src.zip:'`
mv -fv $sdist_orig $sdist
- name: Save artifacts
uses: actions/upload-artifact@v1
with: {name: dist, path: dist}
python_wheels:
name: python/${{matrix.config.cibw_pyv}}/${{matrix.config.osname}}/${{matrix.config.cibw_arch}}
runs-on: ${{matrix.config.os}}
env: {DEV: OFF,
BT: Release,
OS: "${{matrix.config.os}}",
CXX_: "${{matrix.config.cxx}}",
PYTHONV: "${{matrix.config.pythonv}}",
API: ON,
CMAKE_FLAGS: "-DRYML_DEV=OFF -DRYML_BUILD_API=ON -DRYML_API_TESTS=OFF -DRYML_API_BENCHMARKS=OFF"}
env:
CMAKE_FLAGS: "${{matrix.config.cmakeflags}} -DRYML_DEV=OFF -DRYML_BUILD_API=ON -DRYML_API_TESTS=OFF -DRYML_API_BENCHMARKS=OFF"
CIBW_BUILD: "cp${{matrix.config.cibw_pyv}}*-${{matrix.config.cibw_platform}}"
CIBW_ARCHS: "${{matrix.config.cibw_arch}}"
strategy:
fail-fast: false
matrix:
config:
- {name: Python 3.9 Unix, pythonv: 3.9, os: ubuntu-20.04 }
- {name: Python 3.8 Unix, pythonv: 3.8, os: ubuntu-20.04 }
- {name: Python 3.7 Unix, pythonv: 3.7, os: ubuntu-20.04 }
#- {name: Python 3.9 Win , pythonv: 3.9, os: windows-2019, cxx: vs2019}
#- {name: Python 3.8 Win , pythonv: 3.8, os: windows-2019, cxx: vs2019}
#- {name: Python 3.7 Win , pythonv: 3.7, os: windows-2019, cxx: vs2019}
- {pythonv: 3.9, cibw_pyv: 39 , cibw_arch: x86_64, cibw_platform: manylinux_x86_64, osname: linux, os: ubuntu-20.04}
- {pythonv: 3.9, cibw_pyv: 39 , cibw_arch: i686 , cibw_platform: manylinux_i686 , osname: linux, os: ubuntu-20.04}
- {pythonv: 3.9, cibw_pyv: 39 , cibw_arch: AMD64 , cibw_platform: win_amd64 , osname: win , os: windows-2019, cxx: vs2019, cmakeflags: '-G "Visual Studio 16 2019" -A x64'}
- {pythonv: 3.9, cibw_pyv: 39 , cibw_arch: x86 , cibw_platform: win32 , osname: win , os: windows-2019, cxx: vs2019, cmakeflags: '-G "Visual Studio 16 2019" -A Win32'}
- {pythonv: 3.8, cibw_pyv: 38 , cibw_arch: x86_64, cibw_platform: manylinux_x86_64, osname: linux, os: ubuntu-20.04}
- {pythonv: 3.8, cibw_pyv: 38 , cibw_arch: i686 , cibw_platform: manylinux_i686 , osname: linux, os: ubuntu-20.04}
- {pythonv: 3.8, cibw_pyv: 38 , cibw_arch: AMD64 , cibw_platform: win_amd64 , osname: win , os: windows-2019, cxx: vs2019, cmakeflags: '-G "Visual Studio 16 2019" -A x64'}
- {pythonv: 3.8, cibw_pyv: 38 , cibw_arch: x86 , cibw_platform: win32 , osname: win , os: windows-2019, cxx: vs2019, cmakeflags: '-G "Visual Studio 16 2019" -A Win32'}
- {pythonv: 3.7, cibw_pyv: 37 , cibw_arch: x86_64, cibw_platform: manylinux_x86_64, osname: linux, os: ubuntu-20.04}
- {pythonv: 3.7, cibw_pyv: 37 , cibw_arch: i686 , cibw_platform: manylinux_i686 , osname: linux, os: ubuntu-20.04}
- {pythonv: 3.7, cibw_pyv: 37 , cibw_arch: AMD64 , cibw_platform: win_amd64 , osname: win , os: windows-2019, cxx: vs2019, cmakeflags: '-G "Visual Studio 16 2019" -A x64'}
- {pythonv: 3.7, cibw_pyv: 37 , cibw_arch: x86 , cibw_platform: win32 , osname: win , os: windows-2019, cxx: vs2019, cmakeflags: '-G "Visual Studio 16 2019" -A Win32'}
#- {pythonv: 3.9 , cxx: xcode, os: macos-10.15}
#- {pythonv: 3.9 , cxx: xcode, os: macos-10.15}
#- {pythonv: 3.8 , cxx: xcode, os: macos-10.15}
#- {pythonv: 3.8 , cxx: xcode, os: macos-10.15}
#- {pythonv: 3.7 , cxx: xcode, os: macos-10.15}
#- {pythonv: 3.7 , cxx: xcode, os: macos-10.15}
steps:
- name: Download upload URL
uses: actions/download-artifact@v1
with: {name: upload_url, path: ./}
- name: Preprocess
id: preprocess
# use fetch-depth to ensure all tags are fetched
- {name: checkout, uses: actions/checkout@v2, with: {submodules: recursive, fetch-depth: 0}}
- name: create wheel
uses: joerick/cibuildwheel@v2.1.1
- name: rename wheelhouse -> dist
run: |
upload_url=`cat ./upload_url`
echo ::set-output name=upload_url::$upload_url
- {name: checkout, uses: actions/checkout@v2, with: {submodules: recursive}}
- name: python ${{matrix.config.pythonv}}
mv -fv wheelhouse dist
ls -lFhp dist/
- name: Save artifacts for publishing to PyPI
uses: actions/upload-artifact@v1
with: {name: dist, path: dist}
# run the tests
- name: install python ${{matrix.config.pythonv}}
uses: actions/setup-python@v2
with:
python-version: ${{matrix.config.pythonv}}
- name: install requirements
- name: test with python ${{matrix.config.pythonv}}
run: |
echo "expecting python ${{matrix.config.pythonv}}..."
python --version
source .github/reqs.sh && c4_install_test_requirements $OS
pip install -v -r requirements.txt
- {name: show info, run: source .github/setenv.sh && c4_show_info }
- name: package ${{matrix.config.pythonv}} wheel file
id: package
run: |
python --version
pip wheel .
ls *.whl
- name: rename wheel file
id: rename
run: |
ls *.whl
WHLF=`ls -1 *.whl`
if [ -z "$WHLF" ] ; then
echo "could not find any .whl file"
set -x
# do not run the tests in 32 bit
arch=${{matrix.config.cibw_arch}}
if [ "$arch" == "i686" ] || [ "$arch" == "x86" ] ; then
exit 0
fi
DSTF=`echo $WHLF | sed 's:rapidyaml:ryml-python:'`
mkdir -p dist
mv -fv $WHLF dist/$DSTF
echo ::set-output name=whl_file::$DSTF
- name: Upload artifact to Github
id: upload_api_to_release
uses: actions/upload-release-asset@v1.0.1
env: {GITHUB_TOKEN: "${{secrets.GITHUB_TOKEN}}"}
with:
upload_url: ${{steps.preprocess.outputs.upload_url}}
asset_path: dist/${{steps.rename.outputs.whl_file}}
asset_name: ${{steps.rename.outputs.whl_file}}
asset_content_type: application/x-pywheel-zip
- name: Report artifact Github URL
run: |
echo "artifact file: ${{steps.rename.outputs.whl_file}}"
echo "artifact uploaded successfully to github: ${{steps.upload_api_to_release.outputs.browser_download_url}}"
- name: Save artifact for publishing to pypi
uses: actions/upload-artifact@v1
with: {name: dist, path: ./dist/}
python --version
pip --version
pip install -v -r requirements.txt
pip install -v -r api/python/requirements.txt
for whl in dist/* ; do
pip install -v $whl
pip show -f rapidyaml
python -c 'import ryml ; dir(ryml) ; tree = ryml.parse(b"{foo: bar}") ; assert tree.key(1) == b"foo" ; assert tree.val(1) == b"bar"'
python -m nose -v api/python/ryml/tests
pip uninstall -y -v rapidyaml
done
# action to upload python binaries and upload to the PyPI release
publish_python_pypi:
needs: publish_python
name: python/pypi
runs-on: ubuntu-20.04
env: {GITHUB_TOKEN: "${{secrets.GITHUB_TOKEN}}", PYPI_TOKEN: "${{secrets.PYPI_TOKEN}}", PYPI_TOKEN_TEST: "${{secrets.PYPI_TOKEN_TEST}}"}
#----------------------------------------------------------------------------
release:
runs-on: ubuntu-latest
needs:
- src
- cpp
- python_src
- python_wheels
steps:
- {name: checkout, uses: actions/checkout@v2, with: {submodules: recursive}}
- name: Download github release URL
uses: actions/download-artifact@v1
with: {name: upload_url, path: ./}
- name: package python src package
id: package
- name: Gather artifacts - ./assets
uses: actions/download-artifact@v2
with: {name: assets, path: assets}
- name: Gather artifacts - ./dist
uses: actions/download-artifact@v2
with: {name: dist, path: dist}
- name: Verify existing artifacts
run: |
python --version
pip install -v -r requirements.txt
python setup.py sdist --formats=gztar,zip
sdist_tgz_orig=`find dist -type f -name 'rapidyaml-*.tar.gz'`
sdist_zip_orig=`find dist -type f -name 'rapidyaml-*.zip'`
sdist_zip=`echo $sdist_zip_orig | sed 's:rapidyaml-:ryml-python-:'`
sdist_tgz=`echo $sdist_tgz_orig | sed 's:rapidyaml-:ryml-python-:'`
sdist_zip_base=`basename $sdist_zip`
sdist_tgz_base=`basename $sdist_tgz`
mv -fv $sdist_zip_orig $sdist_zip
mv -fv $sdist_tgz_orig $sdist_tgz
echo ::set-output name=sdist_zip::$sdist_zip
echo ::set-output name=sdist_tgz::$sdist_tgz
echo ::set-output name=sdist_zip_base::$sdist_zip_base
echo ::set-output name=sdist_tgz_base::$sdist_tgz_base
- name: Resume python artifacts
uses: actions/download-artifact@v1
with: {name: dist, path: ./dist/}
- name: get github release url
id: preprocess
run: |
upload_url=`cat ./upload_url`
echo ::set-output name=upload_url::$upload_url
- name: upload python src zip package to github release
uses: actions/upload-release-asset@v1.0.1
with:
upload_url: ${{steps.preprocess.outputs.upload_url}}
asset_path: ${{steps.package.outputs.sdist_zip}}
asset_name: ${{steps.package.outputs.sdist_zip_base}}
asset_content_type: application/zip
- name: upload python src tgz package to github release
uses: actions/upload-release-asset@v1.0.1
with:
upload_url: ${{steps.preprocess.outputs.upload_url}}
asset_path: ${{steps.package.outputs.sdist_tgz}}
asset_name: ${{steps.package.outputs.sdist_tgz_base}}
asset_content_type: application/gzip
- name: normalize package names for PyPI
run: |
for fn in dist/ryml* ; do
fnn=`echo $fn | sed 's:ryml-:rapidyaml-:g'`
mv -fv $fn $fnn
done
ls -lFhp assets/
ls -lFhp dist/
#
# PyPI (test)
- name: Publish python packages to test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
uses: pypa/gh-action-pypi-publish@v1.4.2
with:
repository_url: https://test.pypi.org/legacy/
user: __token__
password: ${{secrets.PYPI_TOKEN_TEST}}
repository_url: https://test.pypi.org/legacy/
verbose: true
#- name: Publish python packages to production PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# user: __token__
# password: "$PYPI_TOKEN"
# verbose: true
skip_existing: true
#
# Github
- name: Restore vars.sh
if: contains(github.ref, 'tags/v')
uses: actions/download-artifact@v1
with: {name: vars.sh, path: ./}
- name: Save vars for following steps
if: contains(github.ref, 'tags/v')
id: vars
run: |
source vars.sh
version_body=${{github.workspace}}/changelog/$SRC_VERSION.md
if [ ! -f $version_body ] ; then
echo "version body file was not found: $version_body"
exit 1
fi
echo "::set-output name=VERSION::$SRC_VERSION"
echo "::set-output name=VERSION_BODY::$version_body"
- name: Move Python packages to assets folder
if: contains(github.ref, 'tags/v')
run: mv -fv dist/*src.zip assets/.
- name: Create Github Release
if: contains(github.ref, 'tags/v')
id: create_release
uses: actions/create-release@v1
env: { GITHUB_TOKEN: "${{secrets.GITHUB_TOKEN}}" }
with:
tag_name: ${{github.ref}}
release_name: Release ${{steps.vars.outputs.VERSION}}
body_path: ${{steps.vars.outputs.VERSION_BODY}}
draft: true
prerelease: ${{contains(github.ref, 'rc')}}
- name: Upload assets to Github Release
if: contains(github.ref, 'tags/v')
uses: dwenegar/upload-release-assets@v1
env: { GITHUB_TOKEN: "${{secrets.GITHUB_TOKEN}}" }
with:
release_id: ${{steps.create_release.outputs.id}}
assets_path: ./assets/
#
# PyPI (production)
- name: Publish python packages to production PyPI
if: contains(github.ref, 'tags/v')
uses: pypa/gh-action-pypi-publish@v1.4.2
with:
user: __token__
password: ${{secrets.PYPI_TOKEN}}
verbose: true

View File

@@ -8,9 +8,14 @@ defaults:
shell: bash -e -x {0}
on:
- push
- pull_request
- workflow_dispatch
# https://github.community/t/how-to-trigger-an-action-on-push-or-pull-request-but-not-both/16662
workflow_dispatch:
push:
branches:
- master
pull_request:
branches:
- master
env:
PROJ_PFX_TARGET: ryml-
@@ -27,10 +32,6 @@ env:
# # https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu1804-README.md
# gcc: 7.5.0, 8.4.0, 9.3.0, 10.1.0
# clang: 6.0.0, 8.0.0, 9.0.0
# ubuntu-16.04:
# # https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu1604-README.md
# gcc: 5.5.0, 7.5.0, 8.4.0, 9.3.0
# clang: 6.0.0, 8.0.0, 9.0.1
# macos-11.0: macOS Big Sur 11.0
# # https://github.com/actions/virtual-environments/blob/main/images/macos/macos-11.0-Readme.md
# Xcode 12.1 11.7
@@ -50,7 +51,7 @@ env:
jobs:
#----------------------------------------------------------------------------
test_coverage:
coverage:
# if: github.ref == 'refs/heads/master'
continue-on-error: true
runs-on: ${{matrix.os}}
@@ -114,7 +115,7 @@ jobs:
#c4_submit_coverage static32 coveralls # only accepts one submission per job
#----------------------------------------------------------------------------
test_windows:
windows:
continue-on-error: true
runs-on: ${{matrix.os}}
strategy:
@@ -158,7 +159,7 @@ jobs:
- {name: static32-pack, run: source .github/setenv.sh && c4_package static32}
#----------------------------------------------------------------------------
test_macosx:
macosx:
continue-on-error: true
runs-on: ${{matrix.os}}
strategy:
@@ -196,7 +197,7 @@ jobs:
- {name: static32-pack, run: source .github/setenv.sh && c4_package static32}
#----------------------------------------------------------------------------
test_gcc_canary:
gcc_canary:
continue-on-error: true
runs-on: ${{matrix.os}}
strategy:
@@ -207,8 +208,8 @@ jobs:
- {std: 11, cxx: g++-7 , bt: Release, os: ubuntu-18.04, bitlinks: shared64 static32}
- {std: 20, cxx: g++-10 , bt: Debug , os: ubuntu-18.04, bitlinks: shared64 static32}
- {std: 20, cxx: g++-10 , bt: Release, os: ubuntu-18.04, bitlinks: shared64 static32}
- {std: 11, cxx: g++-5 , bt: Debug , os: ubuntu-16.04, bitlinks: shared64 static32}
- {std: 11, cxx: g++-5 , bt: Release, os: ubuntu-16.04, bitlinks: shared64 static32}
- {std: 11, cxx: g++-5 , bt: Debug , os: ubuntu-18.04, bitlinks: shared64 static32}
- {std: 11, cxx: g++-5 , bt: Release, os: ubuntu-18.04, bitlinks: shared64 static32}
env: {STD: "${{matrix.std}}", CXX_: "${{matrix.cxx}}", BT: "${{matrix.bt}}", BITLINKS: "${{matrix.bitlinks}}", VG: "${{matrix.vg}}", SAN: "${{matrix.san}}", LINT: "${{matrix.lint}}", OS: "${{matrix.os}}"}
steps:
- {name: checkout, uses: actions/checkout@v2, with: {submodules: recursive}}
@@ -236,7 +237,7 @@ jobs:
- {name: shared32-pack, run: source .github/setenv.sh && c4_package shared32}
#----------------------------------------------------------------------------
test_clang_canary:
clang_canary:
continue-on-error: true
runs-on: ${{matrix.os}}
strategy:
@@ -245,8 +246,8 @@ jobs:
include:
- {std: 17, cxx: clang++-10 , bt: Debug , os: ubuntu-18.04, bitlinks: shared64 static32}
- {std: 17, cxx: clang++-10 , bt: Release, os: ubuntu-18.04, bitlinks: shared64 static32}
- {std: 11, cxx: clang++-6.0, bt: Debug , os: ubuntu-16.04, bitlinks: shared64 static32}
- {std: 11, cxx: clang++-6.0, bt: Release, os: ubuntu-16.04, bitlinks: shared64 static32}
- {std: 11, cxx: clang++-6.0, bt: Debug , os: ubuntu-18.04, bitlinks: shared64 static32}
- {std: 11, cxx: clang++-6.0, bt: Release, os: ubuntu-18.04, bitlinks: shared64 static32}
env: {STD: "${{matrix.std}}", CXX_: "${{matrix.cxx}}", BT: "${{matrix.bt}}", BITLINKS: "${{matrix.bitlinks}}", VG: "${{matrix.vg}}", SAN: "${{matrix.san}}", LINT: "${{matrix.lint}}", OS: "${{matrix.os}}"}
steps:
- {name: checkout, uses: actions/checkout@v2, with: {submodules: recursive}}
@@ -274,7 +275,7 @@ jobs:
- {name: shared32-pack, run: source .github/setenv.sh && c4_package shared32}
#----------------------------------------------------------------------------
test_clang_tidy:
clang_tidy:
continue-on-error: true
runs-on: ${{matrix.os}}
strategy:
@@ -313,7 +314,7 @@ jobs:
- {name: shared32-pack, run: source .github/setenv.sh && c4_package shared32}
#----------------------------------------------------------------------------
test_gcc_extended:
gcc_extended:
continue-on-error: true
runs-on: ${{matrix.os}}
strategy:
@@ -367,7 +368,7 @@ jobs:
- {name: shared32-pack, run: source .github/setenv.sh && c4_package shared32}
#----------------------------------------------------------------------------
test_clang_extended:
clang_extended:
continue-on-error: true
runs-on: ${{matrix.os}}
strategy:
@@ -415,7 +416,7 @@ jobs:
- {name: shared32-pack, run: source .github/setenv.sh && c4_package shared32}
#----------------------------------------------------------------------------
test_clang_sanitize:
clang_sanitize:
continue-on-error: true
runs-on: ${{matrix.os}}
strategy:
@@ -529,36 +530,3 @@ jobs:
- {name: add_subdirectory, run: cd samples/add_subdirectory && cmany b -t $BT . -- run }
- {name: fetch_content, run: cd samples/fetch_content && cmany b -t $BT . -- run }
- {name: find_package, run: cd samples/find_package && ./run.sh $BT }
#----------------------------------------------------------------------------
test_api:
continue-on-error: true
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
include:
- {bt: Release, os: ubuntu-18.04}
- {bt: Release, os: windows-2019}
# - {bt: Release, os: macos-11.0}
env: {STD: "${{matrix.std}}", CXX_: "${{matrix.cxx}}", BT: "${{matrix.bt}}", BITLINKS: "${{matrix.bitlinks}}", VG: "${{matrix.vg}}", SAN: "${{matrix.san}}", LINT: "${{matrix.lint}}", OS: "${{matrix.os}}",
API: ON, CMAKE_FLAGS: "-DRYML_DEV=ON -DRYML_BUILD_API=ON -DRYML_API_TESTS=ON -DRYML_API_BENCHMARKS=OFF"}
steps:
- {name: checkout, uses: actions/checkout@v2, with: {submodules: recursive, fetch-depth: 0}}
- {name: python3, uses: actions/setup-python@v2, with: {python-version: 3.7}}
- {name: install requirements, run: source .github/reqs.sh && c4_install_test_requirements $OS}
- {name: show info, run: source .github/setenv.sh && c4_show_info && which swig }
- name: api-shared64-configure---------------------------------------------------
run: source .github/setenv.sh && c4_cfg_test shared64
- name: api-shared64-python-build
run: |
source .github/setenv.sh
pip install -v -r requirements.txt
pip install -v -r api/python/requirements.txt
pip install -v -e .
find
python -c "from ryml.version import version as v; print('Installed version:', v)"
- name: api-shared64-python-test
run: |
source .github/setenv.sh
c4_build_target shared64 ryml-api-test-python3

View File

@@ -60,14 +60,8 @@ follow (see below).
See also [the changelog](./changelog) and [the roadmap](./ROADMAP.md).
Note that ryml uses submodules. Take care to use the `--recursive` flag
when cloning the repo, to ensure ryml's submodules are checked out as well:
```bash
git clone --recursive https://github.com/biojppm/rapidyaml
```
If you omit `--recursive`, after cloning you
will have to do `git submodule init` and `git submodule update`
to ensure ryml's submodules are checked out.
<!-- endpythonreadme -->
------
@@ -616,6 +610,15 @@ so there's not much of a cost for building it with your project.
Currently [cmake](https://cmake.org/) is required to build ryml; we
recommend a recent cmake version, at least 3.13.
Note that ryml uses submodules. Take care to use the `--recursive` flag
when cloning the repo, to ensure ryml's submodules are checked out as well:
```bash
git clone --recursive https://github.com/biojppm/rapidyaml
```
If you omit `--recursive`, after cloning you
will have to do `git submodule init` and `git submodule update`
to ensure ryml's submodules are checked out.
### Usage samples

View File

@@ -49,7 +49,9 @@ endif()
if(RYML_BUILD_API_PYTHON)
c4_log("enabling python3 API")
set(Python3_FIND_VIRTUALENV "FIRST")
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
# use Development.Module to ensure this works with cibuildwheel:
# https://github.com/pypa/cibuildwheel/issues/639
find_package(Python3 COMPONENTS Interpreter Development.Module REQUIRED)
c4_log("found python ${Python3_VERSION}: ${Python3_EXECUTABLE}")
#
set(t ryml-api-python3) # the target name

View File

@@ -2,3 +2,4 @@ ruamel.yaml
ninja
pyyaml
prettytable
nose

View File

@@ -2,8 +2,7 @@ This release is focused on bug fixes and compliance with the [YAML test suite](h
### Breaking changes
- Fix parsing behavior of root-level scalars: now these are parsed
into a DOCVAL, not SEQ->VAL ([5ba0d56](https://github.com/biojppm/rapidyaml/pull/144/commits/5ba0d56904daef1509f0073695145c4835ab1b30), from [PR #144](https://github.com/biojppm/rapidyaml/pull/144)). Eg,
- Fix parsing behavior of root-level scalars: now these are parsed into a DOCVAL, not SEQ->VAL ([5ba0d56](https://github.com/biojppm/rapidyaml/pull/144/commits/5ba0d56904daef1509f0073695145c4835ab1b30), from [PR #144](https://github.com/biojppm/rapidyaml/pull/144)). Eg,
```yaml
---
this is a scalar
@@ -28,10 +27,8 @@ into a DOCVAL, not SEQ->VAL ([5ba0d56](https://github.com/biojppm/rapidyaml/pull
- `Tree::lookup_path_or_modify()`: add overload to graft existing branches ([PR #141](https://github.com/biojppm/rapidyaml/pull/141))
- Callbacks: improve test coverage ([PR #141](https://github.com/biojppm/rapidyaml/pull/141))
- [YAML test suite](https://github.com/yaml/yaml-test-suite) ([PR
#144](https://github.com/biojppm/rapidyaml/pull/144), [PR
#145](https://github.com/biojppm/rapidyaml/pull/145)): big progress towards compliance with the suite. There are still a number of existing problems, which are the subject of ongoing work. See the
[list of current known failures](../test/test_suite/test_suite_parts.cpp) in the test suite file.
- [YAML test suite](https://github.com/yaml/yaml-test-suite) ([PR #144](https://github.com/biojppm/rapidyaml/pull/144), [PR #145](https://github.com/biojppm/rapidyaml/pull/145)): big progress towards compliance with the suite. There are still a number of existing problems, which are the subject of ongoing work. See the [list of current known failures](../test/test_suite/test_suite_parts.cpp) in the test suite file.
- Python wheels and source package are now [uploaded to PyPI](https://pypi.org/project/rapidyaml/) as part of the release process.
### Fixes
@@ -95,7 +92,7 @@ into a DOCVAL, not SEQ->VAL ([5ba0d56](https://github.com/biojppm/rapidyaml/pull
<SPC><SPC>baz
"
# is now correctly parsed as " foo\nbar\nbaz "
```
```
- Fix parsing of tabs within YAML tokens ([PR #145](https://github.com/biojppm/rapidyaml/pull/145)):
```yaml
---<TAB>scalar # test case K54U

View File

@@ -5,6 +5,7 @@
import os
import shutil
import sys
import shlex
from pathlib import Path
from distutils import log
@@ -16,13 +17,22 @@ TOP_DIR = (Path(__file__).parent).resolve()
# where the Python library is actually found
PYTHON_DIR = "api/python"
def get_readme_for_python():
with open(TOP_DIR / "README.md", "r") as fh:
marker = "<!-- endpythonreadme -->" # get everything up to this tag
return fh.read().split(marker)[0]
def get_environment_cmake_flags():
return shlex.split(os.environ.get("CMAKE_FLAGS", ""))
setup_kw = {}
# read the module description from the README.md file
with open(TOP_DIR / "README.md", "r") as fh:
setup_kw['long_description'] = fh.read()
setup_kw['long_description_content_type'] = "text/markdown"
setup_kw['long_description'] = get_readme_for_python()
setup_kw['long_description_content_type'] = "text/markdown"
# read the package version when not in a git repository
@@ -44,7 +54,7 @@ cmake_args = dict(
install_prefix='',
source_dir='',
cmake_component='python',
cmake_configure_options=[
cmake_configure_options=get_environment_cmake_flags() + [
"-DRYML_BUILD_API:BOOL=ON",
# Force cmake to use the Python interpreter we are currently
# using to run setup.py
@@ -87,9 +97,9 @@ except TypeError:
log.info(' - %s', f)
raise
log.info('Compiling with CMake cfg:\n' + '\n'.join(ext.cmake_configure_options))
setup(
# Package human readable information
name='rapidyaml',
description='Rapid YAML - a library to parse and emit YAML, and do it fast',
url='https://github.com/biojppm/rapidyaml',
@@ -98,20 +108,9 @@ setup(
author="Joao Paulo Magalhaes",
author_email="dev@jpmag.me",
# Package contents control
cmdclass={
"build_ext": BuildExtension,
},
cmdclass={"build_ext": BuildExtension,},
package_dir={"": PYTHON_DIR},
packages=find_packages( # not working...
'ryml',
exclude=[
"test",
"build",
"install",
"ext/c4core/build",
"ext/c4core/install"
]
),
packages=['ryml'],
ext_modules=[ext],
include_package_data=True,
# Requirements