Skip to content

Commit 84a0323

Browse files
committed
Create a Libretro Core CI for Linux and Windows
1 parent dea5093 commit 84a0323

File tree

1 file changed

+91
-0
lines changed

1 file changed

+91
-0
lines changed
+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
2+
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
3+
name: Libretro Core CI
4+
5+
on:
6+
push:
7+
branches: [ "master" ]
8+
pull_request:
9+
branches: [ "master" ]
10+
11+
workflow_dispatch:
12+
13+
jobs:
14+
build:
15+
runs-on: ${{ matrix.os }}
16+
17+
strategy:
18+
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
19+
fail-fast: false
20+
21+
# Set up a matrix to run the following 3 configurations:
22+
# 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
23+
# 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
24+
# 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
25+
#
26+
# To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
27+
matrix:
28+
os: [ubuntu-latest, windows-latest]
29+
build_type: [Release]
30+
c_compiler: [gcc, clang, cl]
31+
include:
32+
- os: windows-latest
33+
c_compiler: cl
34+
cpp_compiler: cl
35+
- os: ubuntu-latest
36+
c_compiler: gcc
37+
cpp_compiler: g++
38+
- os: ubuntu-latest
39+
c_compiler: clang
40+
cpp_compiler: clang++
41+
exclude:
42+
- os: windows-latest
43+
c_compiler: gcc
44+
- os: windows-latest
45+
c_compiler: clang
46+
- os: ubuntu-latest
47+
c_compiler: cl
48+
49+
steps:
50+
- uses: actions/checkout@v4
51+
52+
- name: Set reusable strings
53+
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
54+
id: strings
55+
shell: bash
56+
run: |
57+
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
58+
59+
- name: Configure CMake
60+
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
61+
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
62+
run: >
63+
cmake -B ${{ steps.strings.outputs.build-output-dir }}
64+
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
65+
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
66+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
67+
-S ${{ github.workspace }/src/libretro}
68+
69+
- name: Build
70+
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
71+
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
72+
73+
- name: Test
74+
working-directory: ${{ steps.strings.outputs.build-output-dir }}
75+
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
76+
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
77+
run: ctest --build-config ${{ matrix.build_type }}
78+
79+
- name: Compute commit short SHA
80+
id: shortsha
81+
run: |
82+
echo "sha_short=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
83+
echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> "$GITHUB_ENV"
84+
85+
- name: Publish artifacts
86+
uses: actions/upload-artifact@v4
87+
with:
88+
name: freej2me-${{ env.branch }}-${{ env.sha_short }}
89+
path: |
90+
build/freej2me_libretro.so
91+
build/freej2me_libretro.dll

0 commit comments

Comments
 (0)