Skip to content

Commit 86561e3

Browse files
authored
Improved resuablity, security and introduced best practices in GH WF (#53)
Addressing: #49 The changes include: 1. Refactoring of the workflow and fostering resusability 2. Using a Matrix to run the jobs in parallel and not interfering with each other 3. Adding secure and pinned GitHub actions 4. Added best practices
1 parent f1d4f66 commit 86561e3

File tree

1 file changed

+35
-60
lines changed

1 file changed

+35
-60
lines changed

.github/workflows/Hello-CI.yml

Lines changed: 35 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name: "Hello: Test Build and Execution"
2+
23
on:
34
workflow_dispatch:
45
pull_request:
@@ -14,84 +15,58 @@ on:
1415
schedule:
1516
- cron: '00 20 * * 6'
1617

18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.ref }}
20+
cancel-in-progress: true
21+
22+
permissions: read-all
23+
1724
jobs:
18-
Build:
25+
build-and-test:
1926
runs-on: ubuntu-latest
27+
strategy:
28+
matrix:
29+
toolchain: [AC6, GCC, CLANG]
30+
build_type: [Debug, Release]
2031

2132
steps:
33+
- name: Harden the runner (Audit all outbound calls)
34+
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
35+
with:
36+
egress-policy: audit
37+
2238
- name: Checkout repo
23-
uses: actions/checkout@v4
39+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2440

2541
- name: Install tools
26-
uses: ARM-software/cmsis-actions/vcpkg@v1
42+
uses: ARM-software/cmsis-actions/vcpkg@75fd924d583d17eacdbfaf77f21ca09e335c3c79 # v1
2743
with:
2844
config: ".ci/vcpkg-configuration.json"
2945

3046
- name: Activate Arm tool license
31-
uses: ARM-software/cmsis-actions/armlm@v1
32-
33-
- name: Build Hello with AC6 and all contexts
34-
working-directory: ./Hello/
35-
run: cbuild Hello.csolution.yml --packs --toolchain AC6
47+
uses: ARM-software/cmsis-actions/armlm@75fd924d583d17eacdbfaf77f21ca09e335c3c79 # v1
3648

37-
- name: Run Hello build-type Debug, AC6
49+
- name: Build Hello with ${{ matrix.toolchain }}
3850
working-directory: ./Hello/
3951
run: |
40-
FVP_Corstone_SSE-300 -a ./out/Hello/CS300/Debug/Hello.axf -f ./../FVP/FVP_Corstone_SSE-300/fvp_config.txt \
41-
-C mps3_board.uart0.out_file=./out/Hello/CS300/Debug/AC6_fvp_stdout.log \
42-
--simlimit 60 --stat
43-
echo " Show simulation UART output build with AC6 Debug"
44-
cat ./out/Hello/CS300/Debug/AC6_fvp_stdout.log
52+
echo "Building with toolchain: ${{ matrix.toolchain }}"
53+
cbuild Hello.csolution.yml --packs --toolchain ${{ matrix.toolchain }}
4554
46-
- name: Run Hello build-type Release, AC6
55+
- name: Run Hello Simulation ${{ matrix.toolchain }}-${{ matrix.build_type }}
4756
working-directory: ./Hello/
4857
run: |
49-
FVP_Corstone_SSE-300 -a ./out/Hello/CS300/Release/Hello.axf -f ./../FVP/FVP_Corstone_SSE-300/fvp_config.txt \
50-
-C mps3_board.uart0.out_file=./out/Hello/CS300/Release/AC6_fvp_stdout.log \
51-
--simlimit 60 --stat
52-
echo " Show simulation UART output build with AC6 Release"
53-
cat ./out/Hello/CS300/Release/AC6_fvp_stdout.log
58+
# Determine file extension
59+
EXT="elf"
60+
if [[ "${{ matrix.toolchain }}" == "AC6" ]]; then EXT="axf"; fi
5461
55-
- name: Build Hello with GCC and all contexts
56-
working-directory: ./Hello/
57-
run: cbuild Hello.csolution.yml --packs --toolchain GCC
62+
EXEC=./out/Hello/CS300/${{ matrix.build_type }}/Hello.${EXT}
63+
LOG=./out/Hello/CS300/${{ matrix.build_type }}/${{ matrix.toolchain }}_fvp_stdout.log
5864
59-
- name: Run Hello build-type Debug, GCC
60-
working-directory: ./Hello/
61-
run: |
62-
FVP_Corstone_SSE-300 -a ./out/Hello/CS300/Debug/Hello.elf -f ./../FVP/FVP_Corstone_SSE-300/fvp_config.txt \
63-
-C mps3_board.uart0.out_file=./out/Hello/CS300/Debug/GCC_fvp_stdout.log \
65+
FVP_Corstone_SSE-300 \
66+
-a $EXEC \
67+
-f ./../FVP/FVP_Corstone_SSE-300/fvp_config.txt \
68+
-C mps3_board.uart0.out_file=$LOG \
6469
--simlimit 60 --stat
65-
echo " Show simulation UART output build with GCC Debug"
66-
cat ./out/Hello/CS300/Debug/GCC_fvp_stdout.log
6770
68-
- name: Run Hello build-type Release, GCC
69-
working-directory: ./Hello/
70-
run: |
71-
FVP_Corstone_SSE-300 -a ./out/Hello/CS300/Release/Hello.elf -f ./../FVP/FVP_Corstone_SSE-300/fvp_config.txt \
72-
-C mps3_board.uart0.out_file=./out/Hello/CS300/Release/GCC_fvp_stdout.log \
73-
--simlimit 60 --stat
74-
echo " Show simulation UART output build with GCC Release"
75-
cat ./out/Hello/CS300/Release/GCC_fvp_stdout.log
76-
77-
- name: Build Hello with CLANG and all contexts
78-
working-directory: ./Hello/
79-
run: cbuild Hello.csolution.yml --packs --toolchain CLANG
80-
81-
- name: Run Hello build-type Debug, CLANG
82-
working-directory: ./Hello/
83-
run: |
84-
FVP_Corstone_SSE-300 -a ./out/Hello/CS300/Debug/Hello.elf -f ./../FVP/FVP_Corstone_SSE-300/fvp_config.txt \
85-
-C mps3_board.uart0.out_file=./out/Hello/CS300/Debug/CLANG_fvp_stdout.log \
86-
--simlimit 60 --stat
87-
echo " Show simulation UART output build with CLANG Debug"
88-
cat ./out/Hello/CS300/Debug/CLANG_fvp_stdout.log
89-
90-
- name: Run Hello build-type Release, CLANG
91-
working-directory: ./Hello/
92-
run: |
93-
FVP_Corstone_SSE-300 -a ./out/Hello/CS300/Release/Hello.elf -f ./../FVP/FVP_Corstone_SSE-300/fvp_config.txt \
94-
-C mps3_board.uart0.out_file=./out/Hello/CS300/Release/CLANG_fvp_stdout.log \
95-
--simlimit 60 --stat
96-
echo " Show simulation UART output build with CLANG Release"
97-
cat ./out/Hello/CS300/Release/CLANG_fvp_stdout.log
71+
echo "Show simulation UART output for ${{ matrix.toolchain }} ${{ matrix.build_type }}"
72+
cat $LOG

0 commit comments

Comments
 (0)