Skip to content

GitHub actions: Update checkout version and use safe.directory #15275

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 24 additions & 20 deletions .github/workflows/basic_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,17 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

-
name: license check
-
name: license check
run: |
set -x
mkdir -p SCANCODE

git config --global --add safe.directory "$GITHUB_WORKSPACE"

git diff --name-only --diff-filter=d origin/${GITHUB_BASE_REF} \
| ( grep '.\(c\|cpp\|h\|hpp\|py\)$' || true )
echo $?
Expand Down Expand Up @@ -56,11 +57,12 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v3

-
-
name: "include check"
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
! git grep '^#include\s["'"']mbed.h['"'"]$' -- '*.c' '*.h' '*.cpp' '*.hpp' \
':!*platform_mbed.h' ':!*TESTS/*' ':!TEST_APPS/' ':!UNITTESTS/' \
':!*tests/*' ':!*targets/*' ':!*TARGET_*' ':!*unsupported/*'
Expand All @@ -72,9 +74,9 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v3

-
-
name: spell checks
run: |
./tools/test/ci/doxy-spellchecker/spell.sh drivers
Expand All @@ -83,7 +85,7 @@ jobs:
./tools/test/ci/doxy-spellchecker/spell.sh rtos
./tools/test/ci/doxy-spellchecker/spell.sh connectivity/netsocket

-
-
name: doxygen
run: |
mkdir BUILD
Expand All @@ -104,7 +106,7 @@ jobs:
# that do end with .s
find -name "*.s" | tee BUILD/badasm |
sed -e "s/^/Bad Assembler file name found: /" && [ ! -s BUILD/badasm ]


style-check:
runs-on: ubuntu-latest
Expand All @@ -113,22 +115,24 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

-
-
name: astyle checks
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git diff --name-only --diff-filter=d origin/${GITHUB_BASE_REF} \
| ( grep '.*\.\(c\|cpp\|h\|hpp\)$' || true ) \
| ( grep -v -f .astyleignore || true ) \
| while read file; do astyle -n --options=.astylerc "${file}"; done
git diff --exit-code --diff-filter=d --color

-
-
name: "UTF-8 Check"
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
# 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 '.*' )

Expand All @@ -138,12 +142,12 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.5', '3.6', '3.7' ]
python-version: [ '3.7' ]

steps:
-
name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v3


- uses: actions/setup-python@v2
Expand All @@ -153,12 +157,12 @@ jobs:
-
name: install dependencies
run: |
pip install -r requirements.txt
pip install mock==2.0.0 attrs==19.1.0 pytest==3.3.0 'pylint>=1.9,<2' 'hypothesis>=3,<4' 'coverage>=4.5,<5'
pip install -r requirements.txt
pip install mock==2.0.0 attrs==19.1.0 pytest==3.3.0 'pylint>=1.9,<2' 'hypothesis>=3,<4' 'coverage>=4.5,<5' MarkupSafe==2.0.1
-
name: pytest
run: |
# PYTHONPATH=.
# PYTHONPATH=.
coverage run -a -m pytest tools/test
python tools/test/pylint.py
coverage run -a tools/project.py -S | sed -n '/^Total/p'
Expand All @@ -173,7 +177,7 @@ jobs:

-
name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

Expand Down
40 changes: 20 additions & 20 deletions .github/workflows/docker_management.publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,34 @@ name: Publish or Update docker image for mbed-os-5.15

on:
push:
branches:
branches:
- mbed-os-5.15

paths:
- requirements.txt
- docker_images/mbed-os-env/**
- .github/workflows/docker_management.publish.yml

# manual trigger when needed
workflow_dispatch:
# manual trigger when needed
workflow_dispatch:

jobs:
prepare-tags:
runs-on: ubuntu-latest
steps:
-
-
name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch

-
name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

-
-
name: Set UUID
id: generate-uuid
uses: filipstefansson/uuid-action@v1
Expand All @@ -39,7 +39,7 @@ jobs:
# dev-tag is temporary for testing purpose. This should be considered as unstable.
# dated-tag is created for versioning purpose
# prod-tag-latest could be used by customers, CI etc for keeping up to date
-
-
name: Get build information
shell: bash
run: |
Expand All @@ -50,27 +50,27 @@ jobs:
echo ${{ steps.extract_branch.outputs.branch }}-latest > build_info/prod_tag_latest
echo ${{ steps.extract_branch.outputs.branch }} > build_info/mbed_os_version
echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]' > build_info/repository_owner
-
name: Archive information

-
name: Archive information
uses: actions/upload-artifact@v2
with:
name: build-info
path: build_info


build-container:
runs-on: ubuntu-latest
needs: prepare-tags

steps:
-
-
name: unarchive artefacts
uses: actions/download-artifact@v2
with:
name: build-info
-

-
name: Get build info from archive
shell: bash
id: build_info
Expand All @@ -86,21 +86,21 @@ jobs:
echo "PROD TAG is $value"
value=`cat repository_owner`
echo "::set-output name=REPO_OWNER::$value"
-
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

-
-
name: Login to ghcr.io
uses: docker/login-action@v1
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

-
name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

-
name: Build docker containers
Expand All @@ -113,9 +113,9 @@ jobs:
file: ./docker_images/mbed-os-env/Dockerfile
tags: ghcr.io/${{ steps.build_info.outputs.REPO_OWNER }}/mbed-os-env:${{ steps.build_info.outputs.DOCKER_PROD_TAG_LATEST }}

# as docker tags are reused, copy also to a "fixed tag"
# as docker tags are reused, copy also to a "fixed tag"
# for troubleshooting purpose if needed
-
-
name: copy tag to fixed tag
run: |
docker run quay.io/skopeo/stable --src-creds=${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }} --dest-creds=${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }} copy --all docker://ghcr.io/${{ steps.build_info.outputs.REPO_OWNER }}/mbed-os-env:${{ steps.build_info.outputs.DOCKER_PROD_TAG_LATEST }} docker://ghcr.io/${{ steps.build_info.outputs.REPO_OWNER }}/mbed-os-env:${{ steps.build_info.outputs.DOCKER_PROD_TAG_DATED }}
16 changes: 8 additions & 8 deletions .github/workflows/docker_management.test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and test docker image
name: Build and test docker image

# This workflow is triggered when Dockerfile related or github action itself changes are made in a PR
# The workflow is quite simple - builds and test the image. Release of newer version is done only when PR is merged.
Expand All @@ -21,14 +21,14 @@ jobs:
platform: [linux/amd64]

steps:
-
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

# use mbed-os-5.15 branch of blinky
-
-
name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: ARMmbed/mbed-os-example-blinky
path: mbed-os-example-blinky
Expand All @@ -42,10 +42,10 @@ jobs:
rm -rf mbed-os
-
name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: mbed-os-example-blinky/mbed-os

-
name: Build container
uses: docker/build-push-action@v2
Expand All @@ -56,8 +56,8 @@ jobs:
file: ./mbed-os-example-blinky/mbed-os/docker_images/mbed-os-env/Dockerfile
load: true
tags: mbed-os-env:a_pr_test
-

-
name: test the container
id: test
uses: addnab/docker-run-action@v2
Expand Down