mirror of
https://github.com/thepigeongenerator/mcaselector-lite.git
synced 2025-12-17 06:15:47 +01:00
it's more logical to have the DEBUG arument at the end, to be on-par with `compile` job
87 lines
3.0 KiB
YAML
87 lines
3.0 KiB
YAML
name: CI
|
|
on:
|
|
push:
|
|
branches:
|
|
- '**'
|
|
pull_request:
|
|
branches:
|
|
- '**'
|
|
env:
|
|
VCPKG_DISABLE_METRICS: 1
|
|
VCPKG_ROOT: /opt/vcpkg
|
|
DEPS_VCPKG: glfw3:x64-linux-dynamic glfw3:x64-mingw-static
|
|
jobs:
|
|
setup-deps:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
CACHE_KEY_VCPKG: ${{steps.gen-keys.outputs.HASH_VCPKG}}
|
|
steps:
|
|
- id: gen-keys
|
|
run: echo "HASH_VCPKG=vcpkg-$(echo "$DEPS_VCPKG" | sha256sum | cut -d ' ' -f1)" >>"$GITHUB_OUTPUT"
|
|
# load the vcpkg cache
|
|
- uses: actions/cache@v4
|
|
id: vcpkg-cache
|
|
with:
|
|
path: ${{env.VCPKG_ROOT}}
|
|
key: ${{steps.gen-keys.outputs.HASH_VCPKG}}
|
|
restore-keys: vcpkg-
|
|
# setup vcpkg if the cache didn't hit
|
|
- if: steps.vcpkg-cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
sudo apt update && sudo apt install -y --no-install-recommends gcc-multilib mingw-w64 libxinerama-dev libxcursor-dev xorg-dev libglu1-mesa-dev
|
|
git clone https://github.com/microsoft/vcpkg.git "$VCPKG_ROOT"
|
|
"$VCPKG_ROOT/bootstrap-vcpkg.sh"
|
|
"$VCPKG_ROOT/vcpkg" install $DEPS_VCPKG
|
|
compile:
|
|
needs: setup-deps
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- kernel: linux
|
|
march: x86_64
|
|
cc: x86_64-linux-gnu-gcc
|
|
- kernel: mingw
|
|
march: x86_64
|
|
cc: x86_64-w64-mingw32-gcc
|
|
steps:
|
|
# load the vcpkg cache
|
|
- uses: actions/cache@v4
|
|
id: cache-vcpkg
|
|
with:
|
|
path: ${{env.VCPKG_ROOT}}
|
|
key: ${{needs.setup-deps.outputs.CACHE_KEY_VCPKG}}
|
|
- if: steps.cache-vcpkg.outputs.cache-hit != 'true'
|
|
run: echo -e "\033[31mcache failed to load!\033[0m" >&2; exit 1
|
|
# install APT deps
|
|
- run: sudo apt update && sudo apt install -y --no-install-recommends gcc-multilib mingw-w64
|
|
- uses: actions/checkout@v4
|
|
# compile
|
|
- name: compile ${{matrix.march}}-${{matrix.kernel}}
|
|
run: make compile MARCH=${{matrix.march}} KERNEL=${{matrix.kernel}} CC=${{matrix.cc}} -j
|
|
test:
|
|
needs: setup-deps
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- kernel: linux
|
|
march: x86_64
|
|
cc: x86_64-linux-gnu-gcc
|
|
# WARN: not testing win-x86_64... Probably a good idea to do that
|
|
steps:
|
|
# load the vcpkg cache
|
|
- uses: actions/cache@v4
|
|
id: cache-vcpkg
|
|
with:
|
|
path: ${{env.VCPKG_ROOT}}
|
|
key: ${{needs.setup-deps.outputs.CACHE_KEY_VCPKG}}
|
|
- if: steps.cache-vcpkg.outputs.cache-hit != 'true'
|
|
run: echo -e "\033[31mcache failed to load!\033[0m" >&2; exit 1
|
|
# install APT deps
|
|
- run: sudo apt update && sudo apt install -y --no-install-recommends gcc-multilib mingw-w64 libglfw3
|
|
# compile and execute tests
|
|
- uses: actions/checkout@v4
|
|
- name: execute tests for ${{matrix.march}}-${{matrix.kernel}}
|
|
run: make KERNEL=${{matrix.kernel}} CC=${{matrix.cc}} DEBUG=test run MARCH=${{matrix.march}} -j
|