Skip to content

Commit ff803e6

Browse files
committed
Add CI and autotests infrastructure
1 parent 15f02eb commit ff803e6

27 files changed

Lines changed: 1713 additions & 150 deletions

.clangd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CompileFlags:
22
# Use the compile_commands.json from native build
3-
CompilationDatabase: build
3+
CompilationDatabase: build/native
44

55
# Remove problematic flags
66
Remove: [-std=c++20, -std=c++17]

.github/workflows/ci.yml

Lines changed: 226 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, master, ci-setup]
6+
pull_request:
7+
branches: [main, master]
8+
9+
env:
10+
AUTOTESTER_ROM: ${{github.workspace}}/secrets/83pce_515_530.rom
11+
CEDEV: ${{github.workspace}}/CEdev
12+
CEDEV_BIN: ${{github.workspace}}/CEdev/bin
13+
CEMU_PATH: ${{github.workspace}}/CEmu
14+
15+
jobs:
16+
native-tests:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
with:
22+
submodules: recursive
23+
24+
- name: Install Dependencies
25+
run: |
26+
sudo apt-get update
27+
sudo apt-get install -y libsdl2-dev libsdl2-mixer-dev clang ninja-build
28+
29+
- name: Configure CMake
30+
run: cmake --preset native
31+
32+
- name: Build
33+
run: cmake --build build/native
34+
35+
- name: Run Tests
36+
run: ctest --test-dir build/native --output-on-failure
37+
38+
autotests-stable:
39+
runs-on: ubuntu-22.04
40+
environment: Autotester
41+
env:
42+
FASMG_PATH: ${{github.workspace}}/fasmg
43+
steps:
44+
- name: Install Clang 20 for C23 support
45+
run: |
46+
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
47+
echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-20 main" | sudo tee /etc/apt/sources.list.d/llvm.list
48+
sudo apt-get update
49+
sudo apt-get install -y clang-20 libpng-dev libfreetype6-dev libfontconfig1-dev fonts-dejavu-core pkg-config
50+
echo "CC=clang-20" >> $GITHUB_ENV
51+
echo "CXX=clang++-20" >> $GITHUB_ENV
52+
53+
- name: Download CE Toolchain v14.2
54+
run: |
55+
curl -L -o CEdev-Linux.tar.gz https://github.com/CE-Programming/toolchain/releases/download/v14.2/CEdev-Linux.tar.gz
56+
tar -xzf CEdev-Linux.tar.gz
57+
echo "${{env.CEDEV_BIN}}" >> $GITHUB_PATH
58+
59+
- name: Download and Install Fasmg
60+
run: |
61+
FASMG_PAGE=$(curl -s https://flatassembler.net/download.php)
62+
FASMG_HREF=$(echo "$FASMG_PAGE" | grep -oP 'href="\K[^"]*fasmg[^"]*\.zip' | head -1)
63+
echo "Downloading fasmg from: https://flatassembler.net/$FASMG_HREF"
64+
curl -L -o fasmg.zip "https://flatassembler.net/$FASMG_HREF"
65+
mkdir -p ${{env.FASMG_PATH}}
66+
unzip fasmg.zip -d ${{env.FASMG_PATH}}
67+
cp ${{env.FASMG_PATH}}/fasmg.x64 ${{env.CEDEV_BIN}}/fasmg
68+
chmod +x ${{env.CEDEV_BIN}}/fasmg
69+
70+
- name: Checkout CEmu
71+
uses: actions/checkout@v4
72+
with:
73+
repository: CE-Programming/CEmu
74+
ref: master
75+
path: ${{env.CEMU_PATH}}
76+
persist-credentials: false
77+
78+
- name: Build CEmu Core
79+
run: make -j4 -C ${{env.CEMU_PATH}}/core
80+
81+
- name: Build Autotester CLI
82+
run: make -j4 -C ${{env.CEMU_PATH}}/tests/autotester
83+
84+
- name: Install Autotester CLI
85+
run: |
86+
cp ${{env.CEMU_PATH}}/tests/autotester/autotester ${{env.CEDEV_BIN}}/autotester
87+
chmod +x ${{env.CEDEV_BIN}}/*
88+
89+
- name: Test Build Dependencies
90+
run: |
91+
ez80-clang --version
92+
ez80-link --version
93+
fasmg /dev/null /dev/null
94+
cedev-config --makefile
95+
96+
- name: Checkout libtexce
97+
uses: actions/checkout@v4
98+
with:
99+
path: libtexce
100+
submodules: recursive
101+
102+
- name: Download CI test secrets
103+
uses: actions/checkout@v4
104+
with:
105+
repository: CE-Programming/ci-test-secrets
106+
token: ${{ secrets.GH_PAT_CI_SECRETS }}
107+
path: secrets
108+
109+
- name: Generate Test Cases
110+
run: make -C libtexce/autotests generate
111+
112+
- name: Build Autotests
113+
run: make -j$(nproc) -C libtexce/autotests build
114+
115+
- name: Run Autotests
116+
env:
117+
AUTOTESTER_ROM: ${{github.workspace}}/secrets/83pce_515_530.rom
118+
AUTOTESTER_FLAGS: "-s"
119+
run: make -C libtexce/autotests test-all
120+
121+
- name: Export Screenshots
122+
if: always()
123+
run: |
124+
make -C libtexce/autotests export-images
125+
libtexce/autotests/export_images --generated libtexce/autotests/generated --output libtexce/autotests/artifact
126+
127+
- name: Upload Screenshots Artifact
128+
if: always()
129+
uses: actions/upload-artifact@v4
130+
with:
131+
name: autotest-screenshots-stable
132+
path: libtexce/autotests/artifact/
133+
134+
- name: Remove Secrets
135+
if: always()
136+
run: rm -rf ${{github.workspace}}/secrets
137+
138+
autotests-nightly:
139+
runs-on: ubuntu-22.04
140+
environment: Autotester
141+
env:
142+
CEDEV_BINUTILS_BIN: ${{github.workspace}}/CEdev/binutils/bin
143+
steps:
144+
- name: Install Clang 20 for C23 support
145+
run: |
146+
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
147+
echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-20 main" | sudo tee /etc/apt/sources.list.d/llvm.list
148+
sudo apt-get update
149+
sudo apt-get install -y clang-20 libpng-dev libfreetype6-dev libfontconfig1-dev fonts-dejavu-core pkg-config
150+
echo "CC=clang-20" >> $GITHUB_ENV
151+
echo "CXX=clang++-20" >> $GITHUB_ENV
152+
153+
- name: Download CE Toolchain Nightly
154+
run: |
155+
curl -L -o CEdev-Linux.tar.gz https://github.com/CE-Programming/toolchain/releases/download/nightly/CEdev-Linux-nightly.tar.gz
156+
tar -xzf CEdev-Linux.tar.gz
157+
echo "${{env.CEDEV_BIN}}" >> $GITHUB_PATH
158+
echo "${{env.CEDEV_BINUTILS_BIN}}" >> $GITHUB_PATH
159+
160+
- name: Checkout CEmu
161+
uses: actions/checkout@v4
162+
with:
163+
repository: CE-Programming/CEmu
164+
ref: master
165+
path: ${{env.CEMU_PATH}}
166+
persist-credentials: false
167+
168+
- name: Build CEmu Core
169+
run: make -j4 -C ${{env.CEMU_PATH}}/core
170+
171+
- name: Build Autotester CLI
172+
run: make -j4 -C ${{env.CEMU_PATH}}/tests/autotester
173+
174+
- name: Install Autotester CLI
175+
run: |
176+
cp ${{env.CEMU_PATH}}/tests/autotester/autotester ${{env.CEDEV_BIN}}/autotester
177+
chmod +x ${{env.CEDEV_BIN}}/*
178+
179+
- name: Test Build Dependencies
180+
run: |
181+
ez80-clang --version
182+
ez80-link --version
183+
z80-none-elf-as --version
184+
cedev-config --makefile
185+
186+
- name: Checkout libtexce
187+
uses: actions/checkout@v4
188+
with:
189+
path: libtexce
190+
submodules: recursive
191+
192+
- name: Download CI test secrets
193+
uses: actions/checkout@v4
194+
with:
195+
repository: CE-Programming/ci-test-secrets
196+
token: ${{ secrets.GH_PAT_CI_SECRETS }}
197+
path: secrets
198+
199+
- name: Generate Test Cases
200+
run: make -C libtexce/autotests generate
201+
202+
- name: Build Autotests
203+
run: make -j$(nproc) -C libtexce/autotests build
204+
205+
- name: Run Autotests
206+
env:
207+
AUTOTESTER_ROM: ${{github.workspace}}/secrets/83pce_515_530.rom
208+
AUTOTESTER_FLAGS: "-s"
209+
run: make -C libtexce/autotests test-all
210+
211+
- name: Export Screenshots
212+
if: always()
213+
run: |
214+
make -C libtexce/autotests export-images
215+
libtexce/autotests/export_images --generated libtexce/autotests/generated --output libtexce/autotests/artifact
216+
217+
- name: Upload Screenshots Artifact
218+
if: always()
219+
uses: actions/upload-artifact@v4
220+
with:
221+
name: autotest-screenshots-nightly
222+
path: libtexce/autotests/artifact/
223+
224+
- name: Remove Secrets
225+
if: always()
226+
run: rm -rf ${{github.workspace}}/secrets

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
# Primary build directory
88
build/
9-
build-ce/
109
**/build-v*/
1110

1211
# Archives
@@ -17,6 +16,7 @@ CMakeFiles/
1716
CMakeCache.txt
1817
cmake_install.cmake
1918
Makefile
19+
!autotests/Makefile
2020
compile_commands.json
2121

2222
# Nested build output folders (if additional build trees or presets created)
@@ -54,6 +54,9 @@ compile_commands.json
5454
*.8xk
5555
*.8x*
5656

57+
!assets/*.8xv
58+
!assets/*.8xg
59+
5760
# Graphics converter outputs (if used)
5861
src/gfx/**
5962

.gitmodules

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
[submodule "portce"]
22
path = portce
3-
url = /home/sightem/projects/PortCE
3+
url = https://github.com/adriweb/PortCE.git
4+
branch = portce_v3
5+
[submodule "cemu"]
6+
path = cemu
7+
url = https://github.com/CE-Programming/CEmu.git
8+
branch = latest-stable

0 commit comments

Comments
 (0)