File: update-catch.yaml

package info (click to toggle)
mlpack 4.7.0-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 32,060 kB
  • sloc: cpp: 233,202; python: 1,940; sh: 1,201; lisp: 414; makefile: 85
file content (60 lines) | stat: -rw-r--r-- 3,016 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# This is disabled (see the `if: ${{ false }}` condition) until we update to
# Catch version 3.  Note that that can't be done until mlpack has C++17 as a
# minimum requirement.

name: Update Catch
on:
  workflow_dispatch:
  schedule:
    - cron: "0 10 1/16 * *"
permissions:
  contents: read

jobs:
  updateCatch:
    permissions:
      contents: write # for peter-evans/create-pull-request to create branch
      pull-requests: write # for peter-evans/create-pull-request to create a PR
    if: ${{ false }}
    #    if: ${{ github.repository == 'mlpack/mlpack' }}
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - name: Get Latest Catch Tagged Release
        id: catch-header
        run: |
          # Ping version information upstream.
          CATCH_RELEASE_JSON=$(curl -sL https://api.github.com/repos/catchorg/Catch2/releases/latest)
          CATCH_RELEASE_VERSION=$(jq -r ".tag_name" <<< "$CATCH_RELEASE_JSON" | tr -d v)
          echo "release_tag=$(echo $CATCH_RELEASE_VERSION)" >> $GITHUB_OUTPUT
          # Extract out version information from git repository.
          CATCH_VERSION_MAJOR=$(grep -i ".*#define CATCH_VERSION_MAJOR.*" src/mlpack/tests/catch.hpp | grep -o "[0-9]*")
          CATCH_VERSION_MINOR=$(grep -i ".*#define CATCH_VERSION_MINOR.*" src/mlpack/tests/catch.hpp | grep -o "[0-9]*")
          CATCH_VERSION_PATCH=$(grep -i ".*#define CATCH_VERSION_PATCH.*" src/mlpack/tests/catch.hpp | grep -o "[0-9]*")
          # Combine values to match release tag information.
          CATCH_VERSION_VALUE=${CATCH_VERSION_MAJOR}.${CATCH_VERSION_MINOR}.${CATCH_VERSION_PATCH}
          # Set the current release tag.
          echo "current_tag=$(echo $CATCH_VERSION_VALUE)" >> $GITHUB_OUTPUT

      - name: Update Catch
        if: steps.catch-header.outputs.current_tag != steps.catch-header.outputs.release_tag
        env:
          CURRENT_TAG: ${{ steps.catch-header.outputs.current_tag }}
          RELEASE_TAG: ${{ steps.catch-header.outputs.release_tag }}
        run: |
          # Delete the catch.hpp.
          rm -f src/mlpack/tests/catch.hpp
          # Download the release.
          curl -sL https://github.com/catchorg/Catch2/releases/latest/download/catch.hpp -o src/mlpack/tests/catch.hpp

      - name: Create Pull Request For Catch
        if: steps.catch-header.outputs.current_tag != steps.catch-header.outputs.release_tag
        uses: peter-evans/create-pull-request@v3
        with:
          commit-message: Upgrade Catch to ${{ steps.catch-header.outputs.release_tag }}
          title: Upgrade Catch to ${{ steps.catch-header.outputs.release_tag }}
          body: |
            Updates [catchorg/Catch2](https://github.com/catchorg/Catch2) to ${{ steps.catch-header.outputs.release_tag }}.
            Auto-generated by [create-pull-request](https://github.com/peter-evans/create-pull-request).
          labels: update dependencies, automated PR
          branch: catch-header-updates-${{ steps.catch-header.outputs.release_tag }}