Skip to content

Commit ade564f

Browse files
committed
GitHub actions: Update checkout version and use safe.directory
1 parent 8511458 commit ade564f

File tree

3 files changed

+50
-46
lines changed

3 files changed

+50
-46
lines changed

.github/workflows/basic_checks.yml

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,17 @@ jobs:
1818

1919
steps:
2020
- name: Checkout repo
21-
uses: actions/checkout@v2
21+
uses: actions/checkout@v3
2222
with:
2323
fetch-depth: 0
2424

25-
-
26-
name: license check
25+
-
26+
name: license check
2727
run: |
2828
set -x
2929
mkdir -p SCANCODE
30-
30+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
31+
3132
git diff --name-only --diff-filter=d origin/${GITHUB_BASE_REF} \
3233
| ( grep '.\(c\|cpp\|h\|hpp\|py\)$' || true )
3334
echo $?
@@ -56,11 +57,12 @@ jobs:
5657

5758
steps:
5859
- name: Checkout repo
59-
uses: actions/checkout@v2
60+
uses: actions/checkout@v3
6061

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

7375
steps:
7476
- name: Checkout repo
75-
uses: actions/checkout@v2
77+
uses: actions/checkout@v3
7678

77-
-
79+
-
7880
name: spell checks
7981
run: |
8082
./tools/test/ci/doxy-spellchecker/spell.sh drivers
@@ -83,7 +85,7 @@ jobs:
8385
./tools/test/ci/doxy-spellchecker/spell.sh rtos
8486
./tools/test/ci/doxy-spellchecker/spell.sh connectivity/netsocket
8587
86-
-
88+
-
8789
name: doxygen
8890
run: |
8991
mkdir BUILD
@@ -104,7 +106,7 @@ jobs:
104106
# that do end with .s
105107
find -name "*.s" | tee BUILD/badasm |
106108
sed -e "s/^/Bad Assembler file name found: /" && [ ! -s BUILD/badasm ]
107-
109+
108110
109111
style-check:
110112
runs-on: ubuntu-latest
@@ -113,22 +115,24 @@ jobs:
113115

114116
steps:
115117
- name: Checkout repo
116-
uses: actions/checkout@v2
118+
uses: actions/checkout@v3
117119
with:
118120
fetch-depth: 0
119121

120-
-
122+
-
121123
name: astyle checks
122124
run: |
125+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
123126
git diff --name-only --diff-filter=d origin/${GITHUB_BASE_REF} \
124127
| ( grep '.*\.\(c\|cpp\|h\|hpp\)$' || true ) \
125128
| ( grep -v -f .astyleignore || true ) \
126129
| while read file; do astyle -n --options=.astylerc "${file}"; done
127130
git diff --exit-code --diff-filter=d --color
128131
129-
-
132+
-
130133
name: "UTF-8 Check"
131134
run: |
135+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
132136
# Make sure we're not introducing any text which is not UTF-8 encoded
133137
git diff origin/${GITHUB_BASE_REF} -U0 | ( grep -a '^+' || true ) | ( ! grep -axv '.*' )
134138
@@ -139,11 +143,11 @@ jobs:
139143
strategy:
140144
matrix:
141145
python-version: [ '3.5', '3.6', '3.7' ]
142-
146+
143147
steps:
144148
-
145149
name: Checkout repo
146-
uses: actions/checkout@v2
150+
uses: actions/checkout@v3
147151

148152

149153
- uses: actions/setup-python@v2
@@ -153,12 +157,12 @@ jobs:
153157
-
154158
name: install dependencies
155159
run: |
156-
pip install -r requirements.txt
160+
pip install -r requirements.txt
157161
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'
158162
-
159163
name: pytest
160164
run: |
161-
# PYTHONPATH=.
165+
# PYTHONPATH=.
162166
coverage run -a -m pytest tools/test
163167
python tools/test/pylint.py
164168
coverage run -a tools/project.py -S | sed -n '/^Total/p'
@@ -173,7 +177,7 @@ jobs:
173177

174178
-
175179
name: Checkout repo
176-
uses: actions/checkout@v2
180+
uses: actions/checkout@v3
177181
with:
178182
fetch-depth: 0
179183

.github/workflows/docker_management.publish.yml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,34 @@ name: Publish or Update docker image for mbed-os-5.15
33

44
on:
55
push:
6-
branches:
6+
branches:
77
- mbed-os-5.15
88

99
paths:
1010
- requirements.txt
1111
- docker_images/mbed-os-env/**
1212
- .github/workflows/docker_management.publish.yml
1313

14-
# manual trigger when needed
15-
workflow_dispatch:
14+
# manual trigger when needed
15+
workflow_dispatch:
1616

1717
jobs:
1818
prepare-tags:
1919
runs-on: ubuntu-latest
2020
steps:
21-
-
21+
-
2222
name: Extract branch name
2323
shell: bash
2424
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
2525
id: extract_branch
2626

2727
-
2828
name: Checkout
29-
uses: actions/checkout@v2
29+
uses: actions/checkout@v3
3030
with:
3131
fetch-depth: 0
3232

33-
-
33+
-
3434
name: Set UUID
3535
id: generate-uuid
3636
uses: filipstefansson/uuid-action@v1
@@ -39,7 +39,7 @@ jobs:
3939
# dev-tag is temporary for testing purpose. This should be considered as unstable.
4040
# dated-tag is created for versioning purpose
4141
# prod-tag-latest could be used by customers, CI etc for keeping up to date
42-
-
42+
-
4343
name: Get build information
4444
shell: bash
4545
run: |
@@ -50,27 +50,27 @@ jobs:
5050
echo ${{ steps.extract_branch.outputs.branch }}-latest > build_info/prod_tag_latest
5151
echo ${{ steps.extract_branch.outputs.branch }} > build_info/mbed_os_version
5252
echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]' > build_info/repository_owner
53-
54-
-
55-
name: Archive information
53+
54+
-
55+
name: Archive information
5656
uses: actions/upload-artifact@v2
5757
with:
5858
name: build-info
5959
path: build_info
6060

61-
61+
6262
build-container:
6363
runs-on: ubuntu-latest
6464
needs: prepare-tags
6565

6666
steps:
67-
-
67+
-
6868
name: unarchive artefacts
6969
uses: actions/download-artifact@v2
7070
with:
7171
name: build-info
72-
73-
-
72+
73+
-
7474
name: Get build info from archive
7575
shell: bash
7676
id: build_info
@@ -86,21 +86,21 @@ jobs:
8686
echo "PROD TAG is $value"
8787
value=`cat repository_owner`
8888
echo "::set-output name=REPO_OWNER::$value"
89-
-
89+
-
9090
name: Set up Docker Buildx
9191
uses: docker/setup-buildx-action@v1
9292

93-
-
93+
-
9494
name: Login to ghcr.io
95-
uses: docker/login-action@v1
95+
uses: docker/login-action@v1
9696
with:
9797
registry: ghcr.io
9898
username: ${{ github.repository_owner }}
9999
password: ${{ secrets.GITHUB_TOKEN }}
100100

101101
-
102102
name: Checkout
103-
uses: actions/checkout@v2
103+
uses: actions/checkout@v3
104104

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

116-
# as docker tags are reused, copy also to a "fixed tag"
116+
# as docker tags are reused, copy also to a "fixed tag"
117117
# for troubleshooting purpose if needed
118-
-
118+
-
119119
name: copy tag to fixed tag
120120
run: |
121121
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 }}

.github/workflows/docker_management.test.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and test docker image
1+
name: Build and test docker image
22

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

2323
steps:
24-
-
24+
-
2525
name: Set up Docker Buildx
2626
uses: docker/setup-buildx-action@v1
2727

2828
# use mbed-os-5.15 branch of blinky
29-
-
29+
-
3030
name: Checkout
31-
uses: actions/checkout@v2
31+
uses: actions/checkout@v3
3232
with:
3333
repository: ARMmbed/mbed-os-example-blinky
3434
path: mbed-os-example-blinky
@@ -42,10 +42,10 @@ jobs:
4242
rm -rf mbed-os
4343
-
4444
name: Checkout
45-
uses: actions/checkout@v2
45+
uses: actions/checkout@v3
4646
with:
4747
path: mbed-os-example-blinky/mbed-os
48-
48+
4949
-
5050
name: Build container
5151
uses: docker/build-push-action@v2
@@ -56,8 +56,8 @@ jobs:
5656
file: ./mbed-os-example-blinky/mbed-os/docker_images/mbed-os-env/Dockerfile
5757
load: true
5858
tags: mbed-os-env:a_pr_test
59-
60-
-
59+
60+
-
6161
name: test the container
6262
id: test
6363
uses: addnab/docker-run-action@v2

0 commit comments

Comments
 (0)