On 30 Nov 2023, at 13:29, Simon Horman wrote:

> On Tue, Nov 28, 2023 at 06:50:59PM +0100, Eelco Chaudron wrote:
>>
>>
>> On 27 Nov 2023, at 19:18, Ilya Maximets wrote:
>>
>>> On 11/27/23 18:36, Eelco Chaudron wrote:
>
> ...
>
>>>> diff --git a/.github/workflows/build-and-test.yml 
>>>> b/.github/workflows/build-and-test.yml
>>>> index 09654205e..d15105e7d 100644
>>>> --- a/.github/workflows/build-and-test.yml
>>>> +++ b/.github/workflows/build-and-test.yml
>>>> @@ -223,6 +223,102 @@ jobs:
>>>>          name: logs-linux-${{ join(matrix.*, '-') }}
>>>>          path: logs.tgz
>>>>
>>>> +  build-clang-analyze:
>>>> +    needs: build-dpdk
>>>> +    env:
>>>> +      dependencies: |
>>>> +        automake bc clang-tools libbpf-dev libnuma-dev libpcap-dev \
>>>> +        libunbound-dev libunwind-dev libssl-dev libtool llvm-dev \
>>>> +        python3-unbound
>>>> +      CC:   clang
>>>> +      DPDK: dpdk
>>>> +      CLANG_ANALYZE: true
>>>> +    name: clang-analyze
>>>> +    runs-on: ubuntu-22.04
>>>> +    timeout-minutes: 30
>>>> +
>>>> +    steps:
>>>> +    - name: checkout
>>>> +      uses: actions/checkout@v3
>>>> +
>>>> +    - name: get base branch sha
>>>> +      id: base_branch
>>>> +      run: |
>>>> +        if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
>>>> +          echo "sha=$BASE_SHA" >> $GITHUB_OUTPUT
>>>> +        else
>>>> +          if [ "$EVENT_BEFORE" = 
>>>> "0000000000000000000000000000000000000000" ]; then
>>>> +            echo "sha=$DEFAULT_BRANCH" >> $GITHUB_OUTPUT
>>>
>>> How this is going ot work on patches for older branches?
>>
>> Good question, it’s not :( Took a little bit to figure out how to do this, 
>> as we have no reference branch. The solution I came up with was to figure 
>> out all parent branches, and use the most recent main/master or branch-x.x 
>> one. So it looks like this:
>>
>>         if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
>>           echo "sha=$BASE_SHA" >> $GITHUB_OUTPUT
>>         else
>>           if [ "$EVENT_BEFORE" = "0000000000000000000000000000000000000000" 
>> ]; then
>>             set sha=$(git log --simplify-by-decoration --decorate=full \
>>                       --pretty=format:'%d' | \
>>                       grep -oP 'refs/remotes/origin/\K[^, )]+' | \
>>                       grep -m1 -E '^master$|^main$|^branch-[0-9]+\.[0-9]+$')
>>             [ -z "$sha" ] && echo "sha=$DEFAULT_BRANCH" >> $GITHUB_OUTPUT \
>>                           || echo "sha=$sha" >> $GITHUB_OUTPUT
>>           else
>>             echo "sha=$EVENT_BEFORE" >> $GITHUB_OUTPUT
>>           fi
>>         fi
>
> Hi Eelco,
>
> is this useful here?
>
>   git describe --all --no-abbrev --always \
>     --match master --match main --match branch-[0-9].[0-9]*

Thanks Simon, I was looking for something like this, but I was not able to get 
it with ‘git describe’, but now I see the match option is the key ;)

I guess it can now be changed to:

  git describe --all --no-abbrev --always \
    --match master --match main --match branch-[0-9].[0-9]* | sed 's/.*\///'

Will send a v3 next week, waiting for some more potential feedback…

//Eelco

>
> ...

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to