ci: fix default ccache in GitHub Actions

Message ID 20210105121625.8863-1-david.marchand@redhat.com (mailing list archive)
State Rejected, archived
Delegated to: David Marchand
Headers
Series ci: fix default ccache in GitHub Actions |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS

Commit Message

David Marchand Jan. 5, 2021, 12:16 p.m. UTC
  'main' might not be the default branch name.

Fixes: 87009585e293 ("ci: hook to GitHub Actions")

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
I found no other option but to call to the remote repository since github
does not seem to expose a HEAD symbolic reference.

The other alternative would be to simply rename ovsrobot/dpdk default
branch from 'master' to 'main'.
Example: https://github.com/ovsrobot/dpdk/runs/1641274373?check_suite_focus=true#step:4:4

---
 .github/workflows/build.yml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
  

Comments

Aaron Conole Jan. 5, 2021, 2:09 p.m. UTC | #1
David Marchand <david.marchand@redhat.com> writes:

> 'main' might not be the default branch name.
>
> Fixes: 87009585e293 ("ci: hook to GitHub Actions")
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
> I found no other option but to call to the remote repository since github
> does not seem to expose a HEAD symbolic reference.

Ugh... I thought I had set it to 'main' during DPDKs transition, but
seems I didn't (guess it was just an oversight on my part - sorry).

> The other alternative would be to simply rename ovsrobot/dpdk default
> branch from 'master' to 'main'.

I will do that rename anyway - it should be consistent.

> Example: https://github.com/ovsrobot/dpdk/runs/1641274373?check_suite_focus=true#step:4:4
>
> ---
>  .github/workflows/build.yml | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
> index 0b72df0ebe..751eb82c16 100644
> --- a/.github/workflows/build.yml
> +++ b/.github/workflows/build.yml
> @@ -67,13 +67,15 @@ jobs:
>          echo 'libabigail-${{ matrix.config.os }}'
>          echo -n '::set-output name=abi::'
>          echo 'abi-${{ matrix.config.os }}-${{ matrix.config.compiler }}-${{ matrix.config.cross }}-${{ env.LIBABIGAIL_VERSION }}-${{ env.REF_GIT_TAG }}'
> +        echo -n '::set-output name=default_branch::'
> +        git ls-remote --symref origin HEAD |awk '/^ref:/ {print $2}'
>      - name: Retrieve ccache cache
>        uses: actions/cache@v2
>        with:
>          path: ~/.ccache
>          key: ${{ steps.get_ref_keys.outputs.ccache }}-${{ github.ref }}
>          restore-keys: |
> -          ${{ steps.get_ref_keys.outputs.ccache }}-refs/heads/main
> +          ${{ steps.get_ref_keys.outputs.ccache }}-${{ steps.get_ref_keys.outputs.default_branch }}
>      - name: Retrieve libabigail cache
>        id: libabigail-cache
>        uses: actions/cache@v2
  
David Marchand Jan. 19, 2021, 12:17 p.m. UTC | #2
On Tue, Jan 5, 2021 at 3:09 PM Aaron Conole <aconole@redhat.com> wrote:
>
> David Marchand <david.marchand@redhat.com> writes:
>
> > 'main' might not be the default branch name.
> >
> > Fixes: 87009585e293 ("ci: hook to GitHub Actions")
> >
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > ---
> > I found no other option but to call to the remote repository since github
> > does not seem to expose a HEAD symbolic reference.
>
> Ugh... I thought I had set it to 'main' during DPDKs transition, but
> seems I didn't (guess it was just an oversight on my part - sorry).
>
> > The other alternative would be to simply rename ovsrobot/dpdk default
> > branch from 'master' to 'main'.
>
> I will do that rename anyway - it should be consistent.

I dropped the patch, thanks for fixing on the robot side.
  

Patch

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 0b72df0ebe..751eb82c16 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -67,13 +67,15 @@  jobs:
         echo 'libabigail-${{ matrix.config.os }}'
         echo -n '::set-output name=abi::'
         echo 'abi-${{ matrix.config.os }}-${{ matrix.config.compiler }}-${{ matrix.config.cross }}-${{ env.LIBABIGAIL_VERSION }}-${{ env.REF_GIT_TAG }}'
+        echo -n '::set-output name=default_branch::'
+        git ls-remote --symref origin HEAD |awk '/^ref:/ {print $2}'
     - name: Retrieve ccache cache
       uses: actions/cache@v2
       with:
         path: ~/.ccache
         key: ${{ steps.get_ref_keys.outputs.ccache }}-${{ github.ref }}
         restore-keys: |
-          ${{ steps.get_ref_keys.outputs.ccache }}-refs/heads/main
+          ${{ steps.get_ref_keys.outputs.ccache }}-${{ steps.get_ref_keys.outputs.default_branch }}
     - name: Retrieve libabigail cache
       id: libabigail-cache
       uses: actions/cache@v2