-
Notifications
You must be signed in to change notification settings - Fork 13
146 lines (132 loc) · 4.36 KB
/
Copy pathBuild.yml
File metadata and controls
146 lines (132 loc) · 4.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: Build
on:
pull_request:
push:
branches:
- '**'
tags-ignore:
- '**'
env:
UNCRUSTIFY_VERSION: 0.83.0
CPPCHECK_VERSION: 2.22.0
jobs:
build:
runs-on: ${{ matrix.os[0] }}
strategy:
matrix:
os: [
[macos-latest, arm64, bash],
[macos-15-intel, x86_64, bash],
[ubuntu-latest, x86_64, bash],
[ubuntu-24.04-arm, arm64, bash]
]
fail-fast: false
defaults:
run:
shell: ${{ matrix.os[2] }} {0}
steps:
- uses: actions/checkout@v7
with:
submodules: 'true'
- &setup_pspdev
name: Setup PSPDEV Environment
run: |
.github/scripts/setup_pspdev.sh "${{ matrix.os[0] }}" "${{ matrix.os[1] }}"
- name: Runs build in shell
run: |
set -euo pipefail
make
make install
- name: Build all samples (Vanilla Makefile)
run: |
set -euo pipefail
for d in samples/*/ ; do
if [ -f "$d/makefile" ] || [ -f "$d/Makefile" ]; then
echo "Building $d"
make -C "$d"
fi
done
- name: Build all samples (CMake)
run: |
set -euo pipefail
for d in samples/*/ ; do
if [ -f "$d/CMakeLists.txt" ]; then
echo "Building (CMake) $d"
(
cd "$d"
cmake --preset psp
cmake --build --preset psp -j
)
fi
done
format:
name: Code format (Uncrustify)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Cache Uncrustify
id: cache-uncrustify
uses: actions/cache@v6
with:
path: ~/.local/bin/uncrustify
key: uncrustify-${{ env.UNCRUSTIFY_VERSION }}-ubuntu-latest
- name: Build Uncrustify ${{ env.UNCRUSTIFY_VERSION }}
if: steps.cache-uncrustify.outputs.cache-hit != 'true'
run: |
set -euo pipefail
git clone --depth 1 --branch "uncrustify-${UNCRUSTIFY_VERSION}" \
https://github.com/uncrustify/uncrustify.git /tmp/uncrustify
cmake -S /tmp/uncrustify -B /tmp/uncrustify/build -DCMAKE_BUILD_TYPE=Release
cmake --build /tmp/uncrustify/build -j"$(nproc)"
mkdir -p ~/.local/bin
install /tmp/uncrustify/build/uncrustify ~/.local/bin/uncrustify
- name: Check formatting
run: |
set -euo pipefail
export PATH="$HOME/.local/bin:$PATH"
uncrustify --version
./run-uncrustify.sh --check
static-analysis:
name: Static analysis (Cppcheck)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
submodules: 'true'
# The anchored step in `build` is matrix-driven, so the arguments are
# spelled out here; passing none would fall back to `linux`/`x86_64` and
# request a release asset that does not exist.
- name: Setup PSPDEV Environment
run: |
.github/scripts/setup_pspdev.sh ubuntu-latest x86_64
- name: Cache Cppcheck
id: cache-cppcheck
uses: actions/cache@v6
with:
path: ~/.local/cppcheck
key: cppcheck-${{ env.CPPCHECK_VERSION }}-ubuntu-latest
- name: Build Cppcheck ${{ env.CPPCHECK_VERSION }}
if: steps.cache-cppcheck.outputs.cache-hit != 'true'
run: |
set -euo pipefail
git clone --depth 1 --branch "${CPPCHECK_VERSION}" \
https://github.com/danmar/cppcheck.git /tmp/cppcheck
cmake -S /tmp/cppcheck -B /tmp/cppcheck/build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$HOME/.local/cppcheck" \
-DUSE_MATCHCOMPILER=ON
cmake --build /tmp/cppcheck/build -j"$(nproc)"
cmake --install /tmp/cppcheck/build
- name: Generate the compilation database
run: |
set -euo pipefail
export PATH="$HOME/.local/cppcheck/bin:$PATH"
cmake --preset psp
- name: Run Cppcheck
run: |
set -euo pipefail
# Named explicitly rather than left to PATH precedence, so the pinned
# build is the one that runs even if a system cppcheck is installed.
CPPCHECK="$HOME/.local/cppcheck/bin/cppcheck"
"$CPPCHECK" --version
./run-cppcheck.sh --cppcheck "$CPPCHECK"