[chore] re #146: create python release packages in github action

This commit is contained in:
Joao Paulo Magalhaes
2021-08-01 13:26:44 +01:00
parent 39f5acb2b5
commit 13361f3dd9
10 changed files with 243 additions and 360 deletions

194
.github/release.yml vendored
View File

@@ -1,194 +0,0 @@
# https://cristianadam.eu/20191222/using-github-actions-with-c-plus-plus-and-cmake/
name: CMake Build Matrix
on: [push]
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Windows Latest MSVC", artifact: "Windows-MSVC.tar.xz",
os: windows-latest,
build_type: "Release", cc: "cl", cxx: "cl",
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
}
- {
name: "Windows Latest MinGW", artifact: "Windows-MinGW.tar.xz",
os: windows-latest,
build_type: "Release", cc: "gcc", cxx: "g++"
}
- {
name: "Ubuntu Latest GCC", artifact: "Linux.tar.xz",
os: ubuntu-latest,
build_type: "Release", cc: "gcc", cxx: "g++"
}
- {
name: "macOS Latest Clang", artifact: "macOS.tar.xz",
os: macos-latest,
build_type: "Release", cc: "clang", cxx: "clang++"
}
steps:
- uses: actions/checkout@v1
# Get latest CMake and ninja
# https://github.com/marketplace/actions/get-cmake
- name: Get cmake+ninja
uses: lukka/get-cmake@latest
- name: Configure
shell: cmake -P {0}
run: |
set(ENV{CC} ${{ matrix.config.cc }})
set(ENV{CXX} ${{ matrix.config.cxx }})
if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x")
execute_process(
COMMAND "${{ matrix.config.environment_script }}" && set
OUTPUT_FILE environment_script_output.txt
)
file(STRINGS environment_script_output.txt output_lines)
foreach(line IN LISTS output_lines)
if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$")
set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}")
endif()
endforeach()
endif()
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/ninja" ninja_program)
execute_process(
COMMAND ${{ steps.cmake_and_ninja.outputs.cmake_dir }}/cmake
-S .
-B build
-D CMAKE_BUILD_TYPE=${{ matrix.config.build_type }}
-G Ninja
-D CMAKE_MAKE_PROGRAM=${ninja_program}
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status")
endif()
- name: Build
shell: cmake -P {0}
run: |
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ")
if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x")
file(STRINGS environment_script_output.txt output_lines)
foreach(line IN LISTS output_lines)
if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$")
set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}")
endif()
endforeach()
endif()
execute_process(
COMMAND ${{ steps.cmake_and_ninja.outputs.cmake_dir }}/cmake --build build
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status")
endif()
- name: Run tests
shell: cmake -P {0}
run: |
include(ProcessorCount)
ProcessorCount(N)
execute_process(
COMMAND ${{ steps.cmake_and_ninja.outputs.cmake_dir }}/ctest -j ${N}
WORKING_DIRECTORY build
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Running tests failed!")
endif()
- name: Install Strip
run: ${{ steps.cmake_and_ninja.outputs.cmake_dir }}/cmake --install build --prefix instdir --strip
- name: Pack
working-directory: instdir
run: ${{ steps.cmake_and_ninja.outputs.cmake_dir }}/cmake -E tar cJfv ../${{ matrix.config.artifact }} .
- name: Upload
uses: actions/upload-artifact@v1
with:
path: ./${{ matrix.config.artifact }}
name: ${{ matrix.config.artifact }}
release:
if: contains(github.ref, 'tags/v')
runs-on: ubuntu-latest
needs: build
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Store Release url
run: |
echo "${{ steps.create_release.outputs.upload_url }}" > ./upload_url
- uses: actions/upload-artifact@v1
with:
path: ./upload_url
name: upload_url
publish:
if: contains(github.ref, 'tags/v')
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {name: Windows Latest MSVC, artifact: Windows-MSVC.tar.xz, os: ubuntu-latest}
- {name: Windows Latest MinGW, artifact: Windows-MinGW.tar.xz, os: ubuntu-latest}
- {name: Ubuntu Latest GCC, artifact: Linux.tar.xz, os: ubuntu-latest}
- {name: macOS Latest Clang, artifact: macOS.tar.xz, os: ubuntu-latest}
needs: release
steps:
- name: Download artifact
uses: actions/download-artifact@v1
with:
name: ${{ matrix.config.artifact }}
path: ./
- name: Download URL
uses: actions/download-artifact@v1
with:
name: upload_url
path: ./
- id: set_upload_url
run: |
upload_url=`cat ./upload_url`
echo ::set-output name=upload_url::$upload_url
- name: Upload to Release
id: upload_to_release
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.set_upload_url.outputs.upload_url }}
asset_path: ./${{ matrix.config.artifact }}
asset_name: ${{ matrix.config.artifact }}
asset_content_type: application/x-gtar

7
.github/reqs.sh vendored
View File

@@ -140,9 +140,6 @@ function c4_install_test_requirements_ubuntu_impl()
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | sudo apt-key add -
sudo -E apt-add-repository --yes 'deb https://apt.kitware.com/ubuntu/ bionic main'
sudo -E add-apt-repository --yes ppa:ubuntu-toolchain-r/test
# this is going to be deprecated:
# https://askubuntu.com/questions/1243252/how-to-install-arm-none-eabi-gdb-on-ubuntu-20-04-lts-focal-fossa
sudo -E add-apt-repository --yes ppa:team-gcc-arm-embedded/ppa
if [ "$APT_PKG" != "" ] ; then
#sudo -E apt-get clean
@@ -160,6 +157,10 @@ function c4_install_test_requirements_ubuntu_impl()
function _c4_add_arm_compilers()
{
# this is going to be deprecated:
# https://askubuntu.com/questions/1243252/how-to-install-arm-none-eabi-gdb-on-ubuntu-20-04-lts-focal-fossa
sudo -E add-apt-repository --yes ppa:team-gcc-arm-embedded/ppa
_add_apt gcc-arm-embedded
_add_apt g++-arm-linux-gnueabihf
_add_apt g++-multilib-arm-linux-gnueabihf

5
.github/setenv.sh vendored
View File

@@ -102,12 +102,15 @@ function c4_build_target() # runs in parallel
if _c4skipbitlink "$1" ; then return 0 ; fi
id=$1
target=$2
if [ ! -z "$target" ] ; then
target="--target $target"
fi
build_dir=`pwd`/build/$id
export CTEST_OUTPUT_ON_FAILURE=1
# watchout: the `--parallel` flag to `cmake --build` is broken:
# https://discourse.cmake.org/t/parallel-does-not-really-enable-parallel-compiles-with-msbuild/964/10
# https://gitlab.kitware.com/cmake/cmake/-/issues/20564
cmake --build $build_dir --config $BT --target $target -- $(_c4_generator_build_flags) $(_c4_parallel_build_flags)
cmake --build $build_dir --config $BT $target -- $(_c4_generator_build_flags) $(_c4_parallel_build_flags)
}
function c4_run_target() # does not run in parallel

View File

@@ -553,159 +553,12 @@ jobs:
- name: api-shared64-python-build
run: |
source .github/setenv.sh
cd api/python
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
#----------------------------------------------------------------------------
# useful to iterate when fixing the release
# ver=0.0.0-rc1 ; ( set -x ; git tag -d v$ver ; git push origin :v$ver ) ; (set -x ; set -e ; git add -u ; git commit --amend --no-edit ; git tag --annotate --message "v$ver" "v$ver" ; git push -f --tags origin gh_actions )
release:
if: contains(github.ref, 'tags/v')
runs-on: ubuntu-latest
#needs: [test_coverage, test_windows, test_macosx, test_gcc_canary, test_clang_canary, test_clang_tidy, test_gcc_extended, test_clang_extended, test_clang_sanitize, test_api]
steps:
- 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
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
uses: actions/upload-artifact@v1
with:
path: ./upload_url
name: upload_url
# this is a library, the src is enough
# #----------------------------------------------------------------------------
# publish:
# needs: release
# name: publish/${{matrix.config.os}}/${{matrix.config.gen}}
# runs-on: ${{matrix.config.os}}
# env: {DEV: OFF, BT: Release, OS: "${{matrix.config.os}}", CXX_: "${{matrix.config.cxx}}", GEN: "${{matrix.config.gen}}"}
# strategy:
# fail-fast: false
# matrix:
# config:
# # name of the artifact | suffix | cpack gen | mime type | os | cxx
# - {name: Ubuntu 20.04 deb , sfx: unix64.deb, gen: DEB , mime: vnd.debian.binary-package, os: ubuntu-20.04 }
# - {name: Ubuntu 20.04 sh , sfx: unix64.sh , gen: STGZ , mime: x-sh , os: ubuntu-20.04 }
# - {name: Ubuntu 18.04 deb , sfx: unix64.deb, gen: DEB , mime: vnd.debian.binary-package, os: ubuntu-18.04 }
# - {name: Ubuntu 18.04 sh , sfx: unix64.sh , gen: STGZ , mime: x-sh , os: ubuntu-18.04 }
# - {name: Ubuntu 16.04 deb , sfx: unix64.deb, gen: DEB , mime: vnd.debian.binary-package, os: ubuntu-16.04 }
# - {name: Ubuntu 16.04 sh , sfx: unix64.sh , gen: STGZ , mime: x-sh , os: ubuntu-16.04 }
# - {name: Windows VS2017 zip, sfx: win64.zip , gen: ZIP , mime: zip , os: windows-2016, cxx: vs2017}
# - {name: Windows VS2019 zip, sfx: win64.zip , gen: ZIP , mime: zip , os: windows-2019, cxx: vs2019}
# - {name: MacOSX sh , sfx: apple64.sh, gen: STGZ , mime: x-sh , os: macos-11.0 , cxx: xcode }
# steps:
# - name: Get version
# id: get_version
# # https://github.community/t/how-to-get-just-the-tag-name/16241/11
# run: |
# echo ::set-output name=SRC_VERSION::${GITHUB_REF#refs/tags/v}
# echo SRC_VERSION=${GITHUB_REF#refs/tags/v}
# echo GEN=$GEN
# - name: Download upload URL
# uses: actions/download-artifact@v1
# with: {name: upload_url, path: ./}
# - name: Preprocess
# id: preprocess
# run: |
# upload_url=`cat ./upload_url`
# echo ::set-output name=upload_url::$upload_url
# # the package has the same name in multiple same-platform+same-sfx
# # instances, but the uploaded asset needs to have different names:
# sfx=${{matrix.config.sfx}}
# case "${{matrix.config.os}}" in
# ubuntu*)
# sfx=$(echo $sfx | sed "s:unix64:${{matrix.config.os}}:")
# ;;
# windows*)
# sfx=$(echo $sfx | sed "s:win64:win64-${{matrix.config.cxx}}:")
# ;;
# macos*)
# sfx=$(echo $sfx | sed "s:apple64:macosx-${{matrix.config.cxx}}:")
# ;;
# esac
# asset_name=${PROJ_PFX_TARGET}${{steps.get_version.outputs.SRC_VERSION}}-$sfx
# echo ::set-output name=asset_name::$asset_name
# - {name: checkout, uses: actions/checkout@v2, with: {submodules: recursive}}
# - {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 all}
# - name: shared64-pack
# run: |
# source .github/setenv.sh && c4_package shared64 $GEN
# src=./build/shared64/${PROJ_PFX_TARGET}${{steps.get_version.outputs.SRC_VERSION}}-${{matrix.config.sfx}}
# dst=${{steps.preprocess.outputs.asset_name}}
# cp -fav $src $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_name}}
# asset_name: ${{steps.preprocess.outputs.asset_name}}
# asset_content_type: application/${{matrix.config.mime}}
# #- name: Report artifact URL
# # run: echo "artifact uploaded successfully: ${{steps.upload_to_release.outputs.browser_download_url}}"

219
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,219 @@
name: release
defaults:
#if: "!contains(github.event.head_commit.message, 'skip ci')" # SKIP
run:
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash -e -x {0}
on:
- push
#- pull_request
- workflow_dispatch
env:
PROJ_PFX_TARGET: ryml-
PROJ_PFX_CMAKE: RYML_
CMAKE_FLAGS: -DRYML_TEST_SUITE=OFF
NUM_JOBS_BUILD: # 4
# useful to iterate when fixing the release:
# ver=0.2.1 ; ( set -x ; git tag -d v$ver ; git push origin :v$ver ) ; (set -x ; set -e ; tbump --only-patch --non-interactive $ver ; git add -u ; git commit --amend --no-edit ; git tag --annotate --message "v$ver" "v$ver" ; git push -f --tags origin )
jobs:
release:
if: contains(github.ref, 'tags/v')
runs-on: ubuntu-latest
steps:
- 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
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
uses: actions/upload-artifact@v1
with:
path: ./upload_url
name: upload_url
#----------------------------------------------------------------------------
publish:
needs: release
name: publish/${{matrix.config.os}}/${{matrix.config.gen}}
runs-on: ${{matrix.config.os}}
env: {DEV: OFF, BT: Release, OS: "${{matrix.config.os}}", CXX_: "${{matrix.config.cxx}}", GEN: "${{matrix.config.gen}}"}
strategy:
fail-fast: false
matrix:
config:
# name of the artifact | suffix (gen) | suffix (package) | cpack gen | mime type | os | cxx
- {name: Ubuntu 20.04 deb , sfxg: unix64.deb, sfxp: ubuntu-20.04.deb , gen: DEB , mime: vnd.debian.binary-package, os: ubuntu-20.04 }
- {name: Ubuntu 18.04 deb , sfxg: unix64.deb, sfxp: ubuntu-18.04.deb , gen: DEB , mime: vnd.debian.binary-package, os: ubuntu-18.04 }
- {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: 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
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}}"
#----------------------------------------------------------------------------
publish_python:
needs: release
name: publish_python/${{matrix.config.pythonv}}/${{matrix.config.os}}
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"}
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}
steps:
- name: Download upload URL
uses: actions/download-artifact@v1
with: {name: upload_url, path: ./}
- name: Preprocess
id: preprocess
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}}
uses: actions/setup-python@v2
with:
python-version: ${{matrix.config.pythonv}}
- name: install requirements
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"
fi
DSTF=`echo $WHLF | sed 's:rapidyaml:ryml-python:'`
mv -fv $WHLF $DSTF
echo ::set-output name=whl_file::$DSTF
- name: Upload artifact
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: ${{steps.rename.outputs.whl_file}}
asset_name: ${{steps.rename.outputs.whl_file}}
asset_content_type: application/x-pywheel-zip
- name: Report artifact URL
run: |
echo "artifact file: ${{steps.rename.outputs.whl_file}}"
echo "artifact uploaded successfully: ${{steps.upload_api_to_release.outputs.browser_download_url}}"

View File

@@ -31,9 +31,10 @@ $(ACTIVATE_SCRIPT): requirements.txt Makefile
venv:
virtualenv --python=python3 --always-copy venv
# Packaging tooling.
${ACTIVATE} pip install -U pip twine build
${ACTIVATE} pip install -U pip
# Setup requirements.
${ACTIVATE} pip install -v -r requirements.txt
${ACTIVATE} pip install -v -e ../..
@${ACTIVATE} python -c "from ryml.version import version as v; print('Installed version:', v)"
.PHONY: venv

View File

@@ -2,6 +2,3 @@ ruamel.yaml
ninja
pyyaml
prettytable
cmake-build-extension
wheel
-e ../..

View File

@@ -1,3 +1,5 @@
tbump
gitchangelog
pystache
wheel
cmake-build-extension
build
twine

View File

@@ -25,7 +25,7 @@ if not (TOP_DIR / '.git').exists() and os.path.exists(VERSION_FILE):
exec(open(VERSION_FILE).read())
setup_kw['version'] = version
else:
setup_kw['use_scm_version']= {
setup_kw['use_scm_version'] = {
"version_scheme": "post-release",
"local_scheme": "no-local-version",
"write_to": VERSION_FILE,
@@ -46,21 +46,22 @@ cmake_args = dict(
cmake_component='python',
cmake_configure_options=[
"-DRYML_BUILD_API:BOOL=ON",
# Force cmake to use the Python interpreter we are currently using to
# run setup.py
# Force cmake to use the Python interpreter we are currently
# using to run setup.py
"-DPython3_EXECUTABLE:FILEPATH="+sys.executable,
],
)
try:
ext = CMakeExtension(**cmake_args)
log.info("Using standard CMakeExtension")
except TypeError:
del cmake_args['cmake_component']
ext = CMakeExtension(**cmake_args)
# If the CMakeExtension doesn't support `cmake_component` then we have to
# do some manual cleanup.
_BuildExtension=BuildExtension
log.info("Using custom CMakeExtension")
# If the CMakeExtension doesn't support `cmake_component` then we
# have to do some manual cleanup.
_BuildExtension = BuildExtension
class BuildExtension(_BuildExtension):
def build_extension(self, ext):
_BuildExtension.build_extension(self, ext)