Merge pull request #15270 from 0xc0170/fix-test-github-action-git-failure

Github actions: use safe.directory for actions invoking git
pull/15268/head
Martin Kojtal 2022-04-20 14:20:08 +02:00 committed by GitHub
commit decc6d022c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 32 additions and 26 deletions

View File

@ -17,10 +17,11 @@ jobs:
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v2 uses: actions/checkout@v3
with: with:
fetch-depth: 0 fetch-depth: 0
- -
name: install dependencies name: install dependencies
shell: bash shell: bash
@ -32,7 +33,7 @@ jobs:
run: | run: |
set -x set -x
mkdir -p SCANCODE mkdir -p SCANCODE
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git diff --name-only --diff-filter=d origin/${GITHUB_BASE_REF} \ git diff --name-only --diff-filter=d origin/${GITHUB_BASE_REF} \
| ( grep '.\(c\|cpp\|h\|hpp\|py\)$' || true ) | ( grep '.\(c\|cpp\|h\|hpp\|py\)$' || true )
echo $? echo $?
@ -60,13 +61,14 @@ jobs:
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v2 uses: actions/checkout@v3
with: with:
fetch-depth: 0 fetch-depth: 0
- -
name: include check name: include check
run: | run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
# checks mbed.h is not included in MbedOS files except in tests # checks mbed.h is not included in MbedOS files except in tests
! git grep '^#include\s["'"']mbed.h['"'"]$' -- '*.c' '*.h' '*.cpp' '*.hpp' \ ! git grep '^#include\s["'"']mbed.h['"'"]$' -- '*.c' '*.h' '*.cpp' '*.hpp' \
':!*platform_mbed.h' ':!*TESTS/*' ':!TEST_APPS/' ':!UNITTESTS/' \ ':!*platform_mbed.h' ':!*TESTS/*' ':!TEST_APPS/' ':!UNITTESTS/' \
@ -81,13 +83,14 @@ jobs:
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v2 uses: actions/checkout@v3
with: with:
fetch-depth: 0 fetch-depth: 0
- -
name: UTF-8 Check name: UTF-8 Check
run: | run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
# Make sure we're not introducing any text which is not UTF-8 encoded # Make sure we're not introducing any text which is not UTF-8 encoded
git diff origin/${GITHUB_BASE_REF} -U0 | ( grep -a '^+' || true ) | ( ! grep -axv '.*' ) git diff origin/${GITHUB_BASE_REF} -U0 | ( grep -a '^+' || true ) | ( ! grep -axv '.*' )
@ -96,6 +99,7 @@ jobs:
name: astyle checks name: astyle checks
run: | run: |
set -x set -x
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git diff --name-only --diff-filter=d origin/${GITHUB_BASE_REF} \ git diff --name-only --diff-filter=d origin/${GITHUB_BASE_REF} \
| ( grep '.*\.\(c\|cpp\|h\|hpp\)$' || true ) \ | ( grep '.*\.\(c\|cpp\|h\|hpp\)$' || true ) \
| ( grep -v -f .codecheckignore || true ) \ | ( grep -v -f .codecheckignore || true ) \
@ -111,7 +115,7 @@ jobs:
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v2 uses: actions/checkout@v3
with: with:
fetch-depth: 0 fetch-depth: 0
@ -155,7 +159,7 @@ jobs:
steps: steps:
- -
name: Checkout repo name: Checkout repo
uses: actions/checkout@v2 uses: actions/checkout@v3
- uses: actions/setup-python@v2 - uses: actions/setup-python@v2
@ -184,7 +188,7 @@ jobs:
steps: steps:
- -
name: Checkout repo name: Checkout repo
uses: actions/checkout@v2 uses: actions/checkout@v3
with: with:
fetch-depth: 0 fetch-depth: 0
@ -192,6 +196,7 @@ jobs:
name: validate pins name: validate pins
run: | run: |
set -x set -x
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git diff --name-only --diff-filter=d origin/${GITHUB_BASE_REF} \ git diff --name-only --diff-filter=d origin/${GITHUB_BASE_REF} \
| ( grep '.*[\\|\/]PinNames.h$' || true ) \ | ( grep '.*[\\|\/]PinNames.h$' || true ) \
| while read file; do python ./hal/tests/pinvalidate/pinvalidate.py -vvvfp "${file}"; done | while read file; do python ./hal/tests/pinvalidate/pinvalidate.py -vvvfp "${file}"; done
@ -210,7 +215,7 @@ jobs:
steps: steps:
- -
name: Checkout repo name: Checkout repo
uses: actions/checkout@v2 uses: actions/checkout@v3
- -
name: cmake build name: cmake build
@ -237,7 +242,7 @@ jobs:
steps: steps:
- -
name: Checkout repo name: Checkout repo
uses: actions/checkout@v2 uses: actions/checkout@v3
with: with:
fetch-depth: 0 fetch-depth: 0
@ -245,6 +250,7 @@ jobs:
name: frozen tool check name: frozen tool check
run: | run: |
set -x set -x
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git diff --name-only origin/${GITHUB_BASE_REF} \ git diff --name-only origin/${GITHUB_BASE_REF} \
| egrep \ | egrep \
-e "^tools/build_api*" \ -e "^tools/build_api*" \

View File

@ -35,7 +35,7 @@ jobs:
- -
name: Checkout name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
with: with:
fetch-depth: 0 fetch-depth: 0
@ -117,7 +117,7 @@ jobs:
- -
name: Checkout name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- -
name: Build docker containers name: Build docker containers
@ -164,7 +164,7 @@ jobs:
- -
name: Checkout name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- -
name: Find DEV DOCKER DIGEST name: Find DEV DOCKER DIGEST
@ -178,7 +178,7 @@ jobs:
# development branch of blinky # development branch of blinky
- -
name: Checkout name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
with: with:
repository: ARMmbed/mbed-os-example-blinky repository: ARMmbed/mbed-os-example-blinky
path: mbed-os-example-blinky path: mbed-os-example-blinky

View File

@ -13,7 +13,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- -
name: Delete old temporary images name: Delete old temporary images

View File

@ -24,7 +24,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
with: with:
fetch-depth: 0 fetch-depth: 0
@ -134,7 +134,7 @@ jobs:
- -
name: Checkout name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
with: with:
ref: refs/tags/${{ steps.build_info.outputs.MBED_OS_VERSION }} ref: refs/tags/${{ steps.build_info.outputs.MBED_OS_VERSION }}
@ -198,7 +198,7 @@ jobs:
# development branch of blinky # development branch of blinky
- -
name: Checkout example blinky name: Checkout example blinky
uses: actions/checkout@v2 uses: actions/checkout@v3
with: with:
repository: ARMmbed/mbed-os-example-blinky repository: ARMmbed/mbed-os-example-blinky
path: mbed-os-example-blinky path: mbed-os-example-blinky
@ -224,7 +224,7 @@ jobs:
- -
name: Checkout name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
with: with:
ref: refs/tags/${{ steps.build_info.outputs.MBED_OS_VERSION }} ref: refs/tags/${{ steps.build_info.outputs.MBED_OS_VERSION }}
path: mbed-os-example-blinky/mbed-os path: mbed-os-example-blinky/mbed-os

View File

@ -34,7 +34,7 @@ jobs:
# for PR tests, development branch of blinky is used # for PR tests, development branch of blinky is used
- -
name: Checkout name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
with: with:
repository: ARMmbed/mbed-os-example-blinky repository: ARMmbed/mbed-os-example-blinky
path: mbed-os-example-blinky path: mbed-os-example-blinky
@ -49,7 +49,7 @@ jobs:
- -
name: Checkout name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
with: with:
path: mbed-os-example-blinky/mbed-os path: mbed-os-example-blinky/mbed-os

View File

@ -8,7 +8,7 @@ jobs:
container: ghcr.io/armmbed/mbed-os-env:master-latest container: ghcr.io/armmbed/mbed-os-env:master-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Install the latest mbed-tools - name: Install the latest mbed-tools
run: | run: |

View File

@ -8,7 +8,7 @@ jobs:
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Install Python environment - name: Install Python environment
uses: actions/setup-python@v2 uses: actions/setup-python@v2
@ -16,7 +16,7 @@ jobs:
python-version: 3.8 python-version: 3.8
- name: Checkout mbed-os-scripts repo (This repo is currently private) - name: Checkout mbed-os-scripts repo (This repo is currently private)
uses: actions/checkout@v2 uses: actions/checkout@v3
with: with:
repository: ARMmbed/mbed-os-ci-scripts repository: ARMmbed/mbed-os-ci-scripts
token: ${{ secrets.ISSUE_TRIAGING_PERMS }} token: ${{ secrets.ISSUE_TRIAGING_PERMS }}

View File

@ -11,7 +11,7 @@ jobs:
container: mbedos/mbed-os-env:latest container: mbedos/mbed-os-env:latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
with: with:
path: mbed-os path: mbed-os

View File

@ -8,7 +8,7 @@ jobs:
container: ghcr.io/armmbed/mbed-os-env:master-latest container: ghcr.io/armmbed/mbed-os-env:master-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Build the multiple_executables example - name: Build the multiple_executables example
run: | run: |