summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/test.yml66
-rw-r--r--scripts/gen-test-compile.py52
2 files changed, 118 insertions, 0 deletions
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 0000000..4a576d1
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,66 @@
+#
+# Copyright (C) 2021 Reiko Asakura. All Rights Reserved.
+#
+# Vita Development Suite Libraries
+#
+
+name: Test
+
+on:
+ push:
+ schedule:
+ - cron: '0 10 * * *'
+
+env:
+ SCE_ROOT_DIR: ${{ github.workspace }}/ci-base/SCE
+ SCE_PSP2_SDK_DIR: ${{ github.workspace }}/ci-base/sdk
+ PSP2SNC: ${{ github.workspace }}/ci-base/sdk/host_tools/build/bin/psp2snc.exe
+
+jobs:
+
+ test:
+ name: Test
+ runs-on: windows-latest
+ steps:
+
+ - name: Checkout
+ uses: actions/checkout@v2
+
+ - name: Checkout CI base
+ uses: actions/checkout@v2
+ with:
+ repository: Vita-Development-Suite/ci-base
+ path: ci-base
+ token: ${{ secrets.PRIVATE_REPO_TOKEN }}
+
+ - name: Compile
+ run: |
+ python3 scripts/gen-test-compile.py
+ if ($LastExitCode -ne 0) { exit $LastExitCode }
+ Get-ChildItem -File common-*.cpp
+ | ForEach-Object {
+ echo "Compiling $_"
+ ${{ env.PSP2SNC }} $_ -I include/common
+ if ($LastExitCode -ne 0) { exit $LastExitCode }
+ }
+ Get-ChildItem -File user-*.cpp
+ | ForEach-Object {
+ echo "Compiling $_"
+ ${{ env.PSP2SNC }} $_ -I include/user -I include/common
+ if ($LastExitCode -ne 0) { exit $LastExitCode }
+ }
+ Get-ChildItem -File kernel-*.cpp
+ | ForEach-Object {
+ echo "Compiling $_"
+ ${{ env.PSP2SNC }} $_ -I include/kernel -I include/common
+ if ($LastExitCode -ne 0) { exit $LastExitCode }
+ }
+ echo "Compiling all-common.cpp"
+ ${{ env.PSP2SNC }} all-common.cpp -I include/common
+ if ($LastExitCode -ne 0) { exit $LastExitCode }
+ echo "Compiling all-user.cpp"
+ ${{ env.PSP2SNC }} all-user.cpp -I include/user -I include/common
+ if ($LastExitCode -ne 0) { exit $LastExitCode }
+ echo "Compiling all-kernel.cpp"
+ ${{ env.PSP2SNC }} all-kernel.cpp -I include/kernel -I include/common
+ if ($LastExitCode -ne 0) { exit $LastExitCode }
diff --git a/scripts/gen-test-compile.py b/scripts/gen-test-compile.py
new file mode 100644
index 0000000..595e4e1
--- /dev/null
+++ b/scripts/gen-test-compile.py
@@ -0,0 +1,52 @@
+#!/usr/bin/env python3
+
+#
+# Copyright (C) 2021 Reiko Asakura. All Rights Reserved.
+#
+# Vita Development Suite Libraries
+#
+
+from pathlib import Path
+
+def collect_headers(base, acc):
+ headers = []
+ for c in (base / acc).iterdir():
+ if c.is_file():
+ headers.append(acc / c.name)
+ elif c.is_dir():
+ headers.extend(collect_headers(base, acc / c.name))
+ else:
+ sys.exit("Unexpected file type")
+ return headers
+
+def write_one(prefix, p):
+ q = str(p).replace("/", "-").replace("\\", "-")
+ q = f'{prefix}-{q}.cpp'
+ with open(q, 'w') as f:
+ f.write(f'#include <{p}>\n')
+ f.write('int main(void) { return 0; }\n')
+
+incl_template = '#include <{}> // IWYU pragma: keep\n'
+main_template = 'int main(void) { return 0; }\n'
+
+with open('all-common.cpp', 'w') as f:
+ for p in collect_headers(Path('include/common'), Path('')):
+ write_one('common', p)
+ f.write(incl_template.format(p))
+ f.write(main_template)
+
+with open('all-user.cpp', 'w') as f:
+ for p in collect_headers(Path('include/user'), Path('')):
+ write_one('user', p)
+ f.write(incl_template.format(p))
+ for p in collect_headers(Path('include/common'), Path('')):
+ f.write(incl_template.format(p))
+ f.write(main_template)
+
+with open('all-kernel.cpp', 'w') as f:
+ for p in collect_headers(Path('include/kernel'), Path('')):
+ write_one('kernel', p)
+ f.write(incl_template.format(p))
+ for p in collect_headers(Path('include/common'), Path('')):
+ f.write(incl_template.format(p))
+ f.write(main_template)