From 58f3a0002cdfbf1292673c2795b2c6fa91ae5afb Mon Sep 17 00:00:00 2001 From: Yashwant Date: Thu, 24 Dec 2020 13:09:38 +0530 Subject: [PATCH] Scheduled cron GH-action workflow for updating Boost version. --- .github/workflows/update-boost-version.yaml | 81 +++++++++++++++++++++ CMakeLists.txt | 4 +- 2 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/update-boost-version.yaml diff --git a/.github/workflows/update-boost-version.yaml b/.github/workflows/update-boost-version.yaml new file mode 100644 index 0000000000..32d91fed64 --- /dev/null +++ b/.github/workflows/update-boost-version.yaml @@ -0,0 +1,81 @@ +name: Update Boost Version +on: + workflow_dispatch: + schedule: + - cron: '0 10 * * *' +jobs: + updateBoostVersion: + if: ${{ github.repository == 'mlpack/mlpack' }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install Build Dependencies + run: | + sudo apt-get update + sudo apt-get install -y --allow-unauthenticated libopenblas-dev liblapack-dev g++ libboost-all-dev libcereal-dev + curl https://data.kurg.org/armadillo-8.400.0.tar.xz | tar -xvJ && cd armadillo* + cmake . && make && sudo make install && cd .. + + - name: Get Latest Boost Tagged Release + id: boost-version + run: | + # CMake for extracting present boost version. + mkdir build && cd build + cmake .. + + # Ping version information upstream. + BOOST_RELEASE_JSON=$(curl -sL https://api.github.com/repos/boostorg/boost/tags) + FOUND_NEW="NO" + + # Compare present and upstream boost version. + for i in `jq -r .[].name <<< "$BOOST_RELEASE_JSON" | awk '!/.beta/' | \ + grep -Po "(\d+\.)+\d+"` + do + FOUND_SIMILAR="NO" + for j in `grep Boost_ADDITIONAL_VERSIONS_LAST CMakeCache.txt | \ + cut -d "=" -f2 | sed "s/;/ /g"` + do + if [[ "$i" == "$j" ]]; + then + FOUND_SIMILAR="YES" + break + fi + done + if [[ "$FOUND_SIMILAR" != "YES" ]]; + then + FOUND_NEW="YES" + BOOST_VERSION="$BOOST_VERSION\"$i\" " + fi + FOUND_SIMILAR="NO" + for j in `grep Boost_ADDITIONAL_VERSIONS_LAST CMakeCache.txt | \ + cut -d "=" -f2 | sed "s/;/ /g"` + do + if [[ $(echo $i | grep -Po "(\d+)\.\d+") == "$j" ]]; + then + FOUND_SIMILAR="YES" + break + fi + done + if [[ "$FOUND_SIMILAR" != "YES" ]]; + then + FOUND_NEW="YES" + BOOST_VERSION="$BOOST_VERSION\"$(echo $i | grep -Po "(\d+)\.\d+")\" " + fi + done + + # If found the new boost version, then update the CMake script. + if [[ "$FOUND_NEW" == "YES" ]] + then + sed --in-place "s/set(Boost_ADDITIONAL_VERSIONS/set(Boost_ADDITIONAL_VERSIONS\n ${BOOST_VERSION: : -1}/" ../CMakeLists.txt + fi + + - name: Create Pull Request For Boost Version + uses: peter-evans/create-pull-request@v3 + with: + commit-message: Upgrade Boost Version in CMake script. + title: Upgrade Boost Version in CMake script. + body: | + Updates [boostorg/boost](https://github.com/boostorg/boost) in CMake script. + Auto-generated by [create-pull-request](https://github.com/peter-evans/create-pull-request). + labels: update dependencies, automated PR + branch: boost-version-updates diff --git a/CMakeLists.txt b/CMakeLists.txt index a184ca588a..2cc7a64abc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -419,8 +419,8 @@ set(MLPACK_INCLUDE_DIRS ${MLPACK_INCLUDE_DIRS} ${CEREAL_INCLUDE_DIR}) # Unfortunately this configuration variable is necessary and will need to be # updated as time goes on and new versions are released. set(Boost_ADDITIONAL_VERSIONS - "1.74.0" "1.74" - "17.3.0" "17.3" + "1.74.0" "1.74" + "1.73.0" "1.73" "1.72.0" "1.72" "1.71.0" "1.71" "1.70.0" "1.70"