Skip to content

Commit 5224000

Browse files
madebrmupfdev
authored andcommitted
ci: add minimum N-Gage ci
[sdl-ci-filter ngage]
1 parent 1741765 commit 5224000

File tree

4 files changed

+130
-0
lines changed

4 files changed

+130
-0
lines changed
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: 'Setup Nonka N-Gage SDK'
2+
description: 'Download and setup Nokia N-Gage SDK'
3+
inputs:
4+
path:
5+
description: 'Installation path'
6+
default: 'default'
7+
runs:
8+
using: 'composite'
9+
steps:
10+
- uses: actions/setup-python@v5
11+
with:
12+
python-version: '3.x'
13+
- name: 'Verify platform'
14+
id: calc
15+
shell: sh
16+
run: |
17+
case "${{ runner.os }}-${{ runner.arch }}" in
18+
"Windows-X86" | "Windows-X64")
19+
echo "ok!"
20+
echo "cache-key=ngage-sdk-windows" >> ${GITHUB_OUTPUT}
21+
default_install_path="C:/ngagesdk"
22+
;;
23+
*)
24+
echo "Unsupported ${{ runner.os }}-${{ runner.arch }}"
25+
exit 1;
26+
;;
27+
esac
28+
install_path="${{ inputs.path }}"
29+
if [ "x$install_path" = "xdefault" ]; then
30+
install_path="$default_install_path"
31+
fi
32+
echo "install-path=$install_path" >> ${GITHUB_OUTPUT}
33+
34+
toolchain_repo="https://github.com/ngagesdk/ngage-toolchain"
35+
toolchain_branch="main"
36+
echo "toolchain-repo=${toolchain_repo}" >> ${GITHUB_OUTPUT}
37+
echo "toolchain-branch=${toolchain_branch}" >> ${GITHUB_OUTPUT}
38+
39+
sdk_repo="https://github.com/ngagesdk/sdk"
40+
sdk_branch="main"
41+
echo "sdk-repo=${sdk_repo}" >> ${GITHUB_OUTPUT}
42+
echo "sdk-branch=${sdk_branch}" >> ${GITHUB_OUTPUT}
43+
44+
tools_repo="https://github.com/ngagesdk/tools"
45+
tools_branch="main"
46+
echo "tools-repo=${tools_repo}" >> ${GITHUB_OUTPUT}
47+
echo "tools-branch=${tools_branch}" >> ${GITHUB_OUTPUT}
48+
49+
extras_repo="https://github.com/ngagesdk/extras"
50+
extras_branch="main"
51+
echo "extras-repo=${extras_repo}" >> ${GITHUB_OUTPUT}
52+
echo "extras-branch=${extras_branch}" >> ${GITHUB_OUTPUT}
53+
# - name: 'Restore cached ${{ steps.calc.outputs.archive }}'
54+
# id: cache-restore
55+
# uses: actions/cache/restore@v4
56+
# with:
57+
# path: '${{ runner.temp }}'
58+
# key: ${{ steps.calc.outputs.cache-key }}
59+
- name: 'Download N-Gage SDK'
60+
# if: ${{ !steps.cache-restore.outputs.cache-hit || steps.cache-restore.outputs.cache-hit == 'false' }}
61+
shell: pwsh
62+
run: |
63+
64+
Invoke-WebRequest "${{ steps.calc.outputs.toolchain-repo }}/archive/refs/heads/${{ steps.calc.outputs.toolchain-branch }}.zip" -OutFile "${{ runner.temp }}/ngage-toolchain.zip"
65+
Invoke-WebRequest "${{ steps.calc.outputs.sdk-repo }}/archive/refs/heads/${{ steps.calc.outputs.sdk-branch }}.zip" -OutFile "${{ runner.temp }}/sdk.zip"
66+
Invoke-WebRequest "${{ steps.calc.outputs.tools-repo }}/archive/refs/heads/${{ steps.calc.outputs.tools-branch }}.zip" -OutFile "${{ runner.temp }}/tools.zip"
67+
Invoke-WebRequest "${{ steps.calc.outputs.extras-repo }}/archive/refs/heads/${{ steps.calc.outputs.extras-branch }}.zip" -OutFile "${{ runner.temp }}/extras.zip"
68+
69+
# - name: 'Cache ${{ steps.calc.outputs.archive }}'
70+
# if: ${{ !steps.cache-restore.outputs.cache-hit || steps.cache-restore.outputs.cache-hit == 'false' }}
71+
# uses: actions/cache/save@v4
72+
# with:
73+
# path: |
74+
# ${{ runner.temp }}/apps.zip
75+
# ${{ runner.temp }}/sdk.zip
76+
# ${{ runner.temp }}/tools.zip
77+
# key: ${{ steps.calc.outputs.cache-key }}
78+
- name: 'Extract N-Gage SDK'
79+
shell: pwsh
80+
run: |
81+
New-Item -ItemType Directory -Path "${{ steps.calc.outputs.install-path }}" -Force
82+
83+
New-Item -ItemType Directory -Path "${{ runner.temp }}/ngage-toolchain-temp" -Force
84+
7z "-o${{ runner.temp }}/ngage-toolchain-temp" x "${{ runner.temp }}/ngage-toolchain.zip"
85+
Move-Item -Path "${{ runner.temp }}/ngage-toolchain-temp/ngage-toolchain-${{ steps.calc.outputs.toolchain-branch }}/*" -Destination "${{ steps.calc.outputs.install-path }}"
86+
87+
7z "-o${{ steps.calc.outputs.install-path }}/sdk" x "${{ runner.temp }}/sdk.zip"
88+
Move-Item -Path "${{ steps.calc.outputs.install-path }}/sdk/sdk-${{ steps.calc.outputs.sdk-branch }}" -Destination "${{ steps.calc.outputs.install-path }}/sdk/sdk"
89+
90+
7z "-o${{ steps.calc.outputs.install-path }}/sdk" x "${{ runner.temp }}/tools.zip"
91+
Move-Item -Path "${{ steps.calc.outputs.install-path }}/sdk/tools-${{ steps.calc.outputs.tools-branch }}" -Destination "${{ steps.calc.outputs.install-path }}/sdk/tools"
92+
93+
7z "-o${{ steps.calc.outputs.install-path }}/sdk" x "${{ runner.temp }}/extras.zip"
94+
Move-Item -Path "${{ steps.calc.outputs.install-path }}/sdk/extras-${{ steps.calc.outputs.extras-branch }}" -Destination "${{ steps.calc.outputs.install-path }}/sdk/extras"
95+
- name: 'Set output variables'
96+
id: final
97+
shell: sh
98+
run: |
99+
echo "${{ steps.calc.outputs.install-path }}/sdk/sdk/6.1/Shared/EPOC32/gcc/bin" >> $GITHUB_PATH
100+
echo "${{ steps.calc.outputs.install-path }}/sdk/sdk/6.1/Shared/EPOC32/ngagesdk/bin" >> $GITHUB_PATH
101+
echo "NGAGESDK=${{ steps.calc.outputs.install-path }}" >> $GITHUB_ENV
102+
echo "CMAKE_TOOLCHAIN_FILE=${{ steps.calc.outputs.install-path }}/cmake/ngage-toolchain.cmake" >> $GITHUB_ENV

.github/workflows/create-test-plan.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class SdlPlatform(Enum):
5454
Riscos = "riscos"
5555
FreeBSD = "freebsd"
5656
NetBSD = "netbsd"
57+
NGage = "ngage"
5758

5859

5960
class Msys2Platform(Enum):
@@ -138,6 +139,7 @@ class JobSpec:
138139
"riscos": JobSpec(name="RISC OS", os=JobOs.UbuntuLatest, platform=SdlPlatform.Riscos, artifact="SDL-riscos", container="riscosdotinfo/riscos-gccsdk-4.7:latest", ),
139140
"netbsd": JobSpec(name="NetBSD", os=JobOs.UbuntuLatest, platform=SdlPlatform.NetBSD, artifact="SDL-netbsd-x64", ),
140141
"freebsd": JobSpec(name="FreeBSD", os=JobOs.UbuntuLatest, platform=SdlPlatform.FreeBSD, artifact="SDL-freebsd-x64", ),
142+
"ngage": JobSpec(name="N-Gage", os=JobOs.WindowsLatest, platform=SdlPlatform.NGage, artifact="SDL-ngage", ),
141143
}
142144

143145

@@ -163,6 +165,7 @@ class JobDetails:
163165
artifact: str
164166
no_cmake: bool
165167
ccache: bool = False
168+
continue_on_error: bool = False
166169
build_tests: bool = True
167170
container: str = ""
168171
cmake_build_type: str = "RelWithDebInfo"
@@ -222,6 +225,7 @@ class JobDetails:
222225
check_sources: bool = False
223226
setup_python: bool = False
224227
pypi_packages: list[str] = dataclasses.field(default_factory=list)
228+
setup_gage_sdk_path: str = ""
225229

226230
def to_workflow(self, enable_artifacts: bool) -> dict[str, str|bool]:
227231
data = {
@@ -231,6 +235,7 @@ def to_workflow(self, enable_artifacts: bool) -> dict[str, str|bool]:
231235
"ccache": self.ccache,
232236
"container": self.container if self.container else "",
233237
"platform": self.platform,
238+
"continue-on-error": self.continue_on_error,
234239
"artifact": self.artifact,
235240
"enable-artifacts": enable_artifacts,
236241
"shell": self.shell,
@@ -289,6 +294,7 @@ def to_workflow(self, enable_artifacts: bool) -> dict[str, str|bool]:
289294
"check-sources": self.check_sources,
290295
"setup-python": self.setup_python,
291296
"pypi-packages": my_shlex_join(self.pypi_packages),
297+
"setup-ngage-sdk-path": self.setup_gage_sdk_path,
292298
}
293299
return {k: v for k, v in data.items() if v != ""}
294300

@@ -737,6 +743,20 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
737743
job.cpactions_arch = "x86-64"
738744
job.cpactions_setup_cmd = "export PATH=\"/usr/pkg/sbin:/usr/pkg/bin:/sbin:$PATH\"; export PKG_CONFIG_PATH=\"/usr/pkg/lib/pkgconfig\";export PKG_PATH=\"https://cdn.netBSD.org/pub/pkgsrc/packages/NetBSD/$(uname -p)/$(uname -r|cut -f \"1 2\" -d.)/All/\";echo \"PKG_PATH=$PKG_PATH\";echo \"uname -a -> \"$(uname -a)\"\";sudo -E sysctl -w security.pax.aslr.enabled=0;sudo -E sysctl -w security.pax.aslr.global=0;sudo -E pkgin clean;sudo -E pkgin update"
739745
job.cpactions_install_cmd = "sudo -E pkgin -y install cmake dbus pkgconf ninja-build pulseaudio libxkbcommon wayland wayland-protocols libinotify libusb1"
746+
case SdlPlatform.NGage:
747+
job.cmake_arguments.extend([
748+
"-DBUILD_FOR_NOKIA_NGAGE=ON", # FIXME: remove this
749+
])
750+
job.continue_on_error = True # FIXME: remove this
751+
job.setup_ninja = True
752+
job.static_lib = None # FIXME: should be StaticLibType.A
753+
job.shared_lib = None
754+
job.clang_tidy = False
755+
job.werror = False # FIXME: enable SDL_WERROR
756+
job.shared = False
757+
job.run_tests = False
758+
job.setup_gage_sdk_path = "C:/ngagesdk"
759+
job.cmake_toolchain_file = "C:/ngagesdk/cmake/ngage-toolchain.cmake"
740760
case _:
741761
raise ValueError(f"Unsupported platform={spec.platform}")
742762

.github/workflows/generic.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ jobs:
1414
name: ${{ matrix.platform.name }}
1515
runs-on: ${{ matrix.platform.os }}
1616
container: ${{ matrix.platform.container }}
17+
continue-on-error: ${{ matrix.platform.continue-on-error }}
1718
defaults:
1819
run:
1920
shell: ${{ matrix.platform.shell }}
@@ -93,6 +94,11 @@ jobs:
9394
with:
9495
arch: ${{ matrix.platform.msvc-vcvars-arch }}
9596
sdk: ${{ matrix.platform.msvc-vcvars-sdk }}
97+
- name: 'Set up Nokia N-Gage SDK'
98+
uses: ./.github/actions/setup-ngage-sdk
99+
if: ${{ matrix.platform.setup-ngage-sdk-path != '' }}
100+
with:
101+
path: '${{ matrix.platform.setup-ngage-sdk-path }}'
96102
- name: 'Set up Windows GDK Desktop'
97103
uses: ./.github/actions/setup-gdk-desktop
98104
if: ${{ matrix.platform.setup-gdk-folder != '' }}

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ if(NOT DEFINED CMAKE_BUILD_TYPE)
44
set(cmake_build_type_undefined 1)
55
endif()
66

7+
# FIXME: remove this
78
option(BUILD_FOR_NOKIA_NGAGE "Build for Nokia N-Gage" OFF)
89

910
# See docs/release_checklist.md
1011
project(SDL3 LANGUAGES C VERSION "3.3.0")
1112

13+
# FIXME: remove this
1214
if (BUILD_FOR_NOKIA_NGAGE)
1315
include(cmake/nokia_ngage.cmake)
1416
return()

0 commit comments

Comments
 (0)