-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcmakeFetchContentVersusGitSubmodule.yml
More file actions
127 lines (109 loc) · 4.91 KB
/
Copy pathcmakeFetchContentVersusGitSubmodule.yml
File metadata and controls
127 lines (109 loc) · 4.91 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
# SPDX-FileCopyrightText: 2026 Marcel Petrick
#
# SPDX-License-Identifier: GPL-3.0-or-later
# -----------------------------------------------------------------------------
# cmakeFetchContentVersusGitSubmodule CI
#
# Proves the project's claim on a clean runner: a normal checkout without
# submodules is enough, CMake fetches LVGL itself during configure, the demo
# links against it, and changing LVGL_GIT_TAG in the same build directory makes
# FetchContent switch the checkout. Git is only used read-only, to inspect
# which revision CMake checked out.
#
# No build/ or _deps/ cache on purpose: a warm cache would hide the first fetch.
# The job only runs when this project or this workflow changes, so the other
# projects in this repository do not trigger it.
# -----------------------------------------------------------------------------
name: cmakeFetchContentVersusGitSubmodule
on:
push:
paths:
- "cmakeFetchContentVersusGitSubmodule/**"
- ".github/workflows/cmakeFetchContentVersusGitSubmodule.yml"
pull_request:
paths:
- "cmakeFetchContentVersusGitSubmodule/**"
- ".github/workflows/cmakeFetchContentVersusGitSubmodule.yml"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: cmake-fetchcontent-lvgl-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
working-directory: cmakeFetchContentVersusGitSubmodule
env:
# Second LVGL release used to prove the revision switch.
SWITCH_TAG: v9.4.0
jobs:
fetchcontent:
name: FetchContent fetch, build and tag switch
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Check out this repository only (submodules disabled)
uses: actions/checkout@v7.0.1
with:
submodules: false
- name: Confirm there are no submodules and no vendored LVGL
run: |
test ! -e "$GITHUB_WORKSPACE/.gitmodules"
test ! -e .gitmodules
test -z "$(git -C "$GITHUB_WORKSPACE" ls-files -- '*lvgl.h' '*lv_obj.c')"
echo "No .gitmodules and no LVGL sources tracked by this repository."
- name: Install host prerequisites (SDL2, Ninja) - LVGL is not installed
run: |
sudo apt-get update
sudo apt-get install -y libsdl2-dev ninja-build
cmake --version
ninja --version
- name: Read the default LVGL tag from CMakeLists.txt
run: |
default_tag=$(sed -n 's/^ *set(LVGL_GIT_TAG "\(.*\)")$/\1/p' CMakeLists.txt)
echo "Default LVGL_GIT_TAG: $default_tag"
test -n "$default_tag"
test "$default_tag" != "$SWITCH_TAG"
echo "DEFAULT_TAG=$default_tag" >> "$GITHUB_ENV"
{
echo '### LVGL checkout in build/_deps/lvgl-src'
echo
echo '| Step | Requested tag | Checked-out commit |'
echo '| --- | --- | --- |'
} >> "$GITHUB_STEP_SUMMARY"
- name: Configure with default LVGL tag (CMake FetchContent clones LVGL into build/_deps)
run: |
test ! -e build
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DFETCHCONTENT_QUIET=OFF
- name: Verify FetchContent checked out the default tag
run: |
head=$(git -C build/_deps/lvgl-src rev-parse HEAD)
want=$(git -C build/_deps/lvgl-src rev-parse "$DEFAULT_TAG^{commit}")
echo "build/_deps/lvgl-src is at $head ($(git -C build/_deps/lvgl-src describe --tags))"
test "$head" = "$want"
echo "| Configure (default) | \`$DEFAULT_TAG\` | \`$head\` |" >> "$GITHUB_STEP_SUMMARY"
- name: Build the demo against the fetched LVGL
run: |
cmake --build build
test -x build/hello_lvgl
- name: Reconfigure same build directory with another LVGL tag
run: cmake -S . -B build -DLVGL_GIT_TAG="$SWITCH_TAG"
- name: Verify FetchContent changed the LVGL checkout
run: |
head=$(git -C build/_deps/lvgl-src rev-parse HEAD)
want=$(git -C build/_deps/lvgl-src rev-parse "$SWITCH_TAG^{commit}")
echo "build/_deps/lvgl-src is at $head ($(git -C build/_deps/lvgl-src describe --tags))"
test "$head" = "$want"
echo "| Reconfigure with \`-DLVGL_GIT_TAG=$SWITCH_TAG\` | \`$SWITCH_TAG\` | \`$head\` |" >> "$GITHUB_STEP_SUMMARY"
- name: Build the demo against the switched LVGL release
run: cmake --build build
- name: Remove the cached tag override with -U and reconfigure
run: cmake -S . -B build -U LVGL_GIT_TAG
- name: Verify FetchContent returned to the default tag
run: |
head=$(git -C build/_deps/lvgl-src rev-parse HEAD)
want=$(git -C build/_deps/lvgl-src rev-parse "$DEFAULT_TAG^{commit}")
echo "build/_deps/lvgl-src is at $head ($(git -C build/_deps/lvgl-src describe --tags))"
test "$head" = "$want"
echo "| Reconfigure with \`-U LVGL_GIT_TAG\` | \`$DEFAULT_TAG\` | \`$head\` |" >> "$GITHUB_STEP_SUMMARY"