Skip to content

Commit

Permalink
Add CICD
Browse files Browse the repository at this point in the history
  • Loading branch information
cone-forest committed Nov 14, 2024
1 parent a739949 commit 5cb0feb
Show file tree
Hide file tree
Showing 2 changed files with 121 additions and 0 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Ubuntu CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: true
matrix:
os: [ubuntu-24.04]
build_type: [Release, Debug]
cpp_compiler: [g++, clang++]

steps:
- uses: actions/checkout@v3

- name: Set reusable strings
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- name: Setup ccache
uses: Chocobo1/setup-ccache-action@v1

- name: Set up cache
id: cache-cpm
uses: actions/cache@v2
with:
path: ~/cpm-cache
key: ${{ runner.os }}-cpm-${{ hashFiles('**/') }}
restore-keys: |
${{ runner.os }}-cpm-a
# Download GLFW dependencies
- name: Setup GLFW deps
run: |
sudo sed -i 's/^Types: deb$/Types: deb deb-src/' /etc/apt/sources.list.d/ubuntu.sources
sudo apt-get update
sudo apt-get build-dep glfw3
- name: Configure CMake (GCC)
if: ${{ matrix.cpp_compiler == 'g++' }}
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCPM_SOURCE_CACHE=~/cpm-cache
-DCMAKE_CXX_COMPILER=g++
-DCMAKE_C_COMPILER=gcc
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }}
- name: Configure CMake (Clang)
if: ${{ matrix.cpp_compiler == 'clang++' }}
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCPM_SOURCE_CACHE=~/cpm-cache
-DCMAKE_CXX_COMPILER=clang++
-DCMAKE_C_COMPILER=clang
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }}
- name: Build
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
51 changes: 51 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Windows CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: true
matrix:
os: [windows-latest]
build_type: [Release, Debug]
c_compiler: [cl]

steps:
- uses: actions/checkout@v3

- name: Set reusable strings
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- name: Setup ccache
uses: Chocobo1/setup-ccache-action@v1

- name: Set up cache
id: cache-cpm
uses: actions/cache@v2
with:
path: ~/cpm-cache
key: ${{ runner.os }}-cpm-${{ hashFiles('**/') }}
restore-keys: |
${{ runner.os }}-cpm-a
- name: Configure CMake
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCPM_SOURCE_CACHE=~/cpm-cache
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }}
- name: Build
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}

0 comments on commit 5cb0feb

Please sign in to comment.