mirror of
https://github.com/thepigeongenerator/mcaselector-lite.git
synced 2025-12-17 09:35:46 +01:00
improve vcpkg generation / caching
This commit is contained in:
36
.github/workflows/ci.yaml
vendored
36
.github/workflows/ci.yaml
vendored
@@ -9,30 +9,29 @@ on:
|
|||||||
env:
|
env:
|
||||||
VCPKG_DISABLE_METRICS: 1
|
VCPKG_DISABLE_METRICS: 1
|
||||||
VCPKG_ROOT: /opt/vcpkg
|
VCPKG_ROOT: /opt/vcpkg
|
||||||
|
DEPS_VCPKG: glfw3:x64-linux-dynamic glfw3:x64-mingw-static
|
||||||
jobs:
|
jobs:
|
||||||
setup-vcpkg:
|
setup-vcpkg:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: ghcr.io/thepigeongenerator/mcaselector-lite:latest
|
container: ghcr.io/thepigeongenerator/mcaselector-lite:latest
|
||||||
|
outputs:
|
||||||
|
CACHE_KEY_VCPKG: ${{steps.gen-keys.outputs.HASH_VCPKG}}
|
||||||
steps:
|
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
|
- uses: actions/cache@v4
|
||||||
id: vcpkg-cache
|
id: vcpkg-cache
|
||||||
with:
|
with:
|
||||||
path: ${{env.VCPKG_ROOT}}
|
path: ${{env.VCPKG_ROOT}}
|
||||||
key: vcpkg-${{runner.os}}
|
key: ${{steps.gen-keys.outputs.HASH_VCPKG}}
|
||||||
restore-keys: vcpkg-${{runner.os}}
|
restore-keys: vcpkg-
|
||||||
|
# setup vcpkg if the cache didn't hit
|
||||||
- if: steps.vcpkg-cache.outputs.cache-hit != 'true'
|
- if: steps.vcpkg-cache.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
git clone https://github.com/microsoft/vcpkg.git "$VCPKG_ROOT"
|
git clone https://github.com/microsoft/vcpkg.git "$VCPKG_ROOT"
|
||||||
$VCPKG_ROOT/bootstrap-vcpkg.sh
|
"$VCPKG_ROOT/bootstrap-vcpkg.sh"
|
||||||
- if: steps.vcpkg-cache.outputs.cache-hit == 'true'
|
"$VCPKG_ROOT/vcpkg" install $DEPS_VCPKG
|
||||||
run: |
|
|
||||||
cd "$VCPKG_ROOT"
|
|
||||||
git fetch
|
|
||||||
git checkout master
|
|
||||||
git reset --hard origin/master
|
|
||||||
./bootstrap-vcpkg.sh
|
|
||||||
- name: install vcpkg packages
|
|
||||||
run: $VCPKG_ROOT/vcpkg install glfw3:x64-linux-dynamic glfw3:x64-mingw-static;
|
|
||||||
compile:
|
compile:
|
||||||
needs: setup-vcpkg
|
needs: setup-vcpkg
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -47,10 +46,14 @@ jobs:
|
|||||||
march: x86_64
|
march: x86_64
|
||||||
cc: x86_64-w64-mingw32-gcc
|
cc: x86_64-w64-mingw32-gcc
|
||||||
steps:
|
steps:
|
||||||
|
# load the vcpkg cache
|
||||||
- uses: actions/cache@v4
|
- uses: actions/cache@v4
|
||||||
|
id: cache-vcpkg
|
||||||
with:
|
with:
|
||||||
path: ${{env.VCPKG_ROOT}}
|
path: ${{env.VCPKG_ROOT}}
|
||||||
key: vcpkg-${{runner.os}}
|
key: ${{needs.setup-vcpkg.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
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
# compile
|
# compile
|
||||||
- name: compile ${{matrix.march}}-${{matrix.kernel}}
|
- name: compile ${{matrix.march}}-${{matrix.kernel}}
|
||||||
@@ -67,10 +70,15 @@ jobs:
|
|||||||
cc: x86_64-linux-gnu-gcc
|
cc: x86_64-linux-gnu-gcc
|
||||||
# WARN: not testing win-x86_64... Probably a good idea to do that
|
# WARN: not testing win-x86_64... Probably a good idea to do that
|
||||||
steps:
|
steps:
|
||||||
|
# load the vcpkg cache
|
||||||
- uses: actions/cache@v4
|
- uses: actions/cache@v4
|
||||||
|
id: cache-vcpkg
|
||||||
with:
|
with:
|
||||||
path: ${{env.VCPKG_ROOT}}
|
path: ${{env.VCPKG_ROOT}}
|
||||||
key: vcpkg-${{runner.os}}
|
key: ${{needs.setup-vcpkg.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
|
||||||
|
# compile and execute tests
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: execute tests for ${{matrix.march}}-${{matrix.kernel}}
|
- name: execute tests for ${{matrix.march}}-${{matrix.kernel}}
|
||||||
run: make DEBUG=test run MARCH=${{matrix.march}} KERNEL=${{matrix.kernel}} CC=${{matrix.cc}} -j
|
run: make DEBUG=test run MARCH=${{matrix.march}} KERNEL=${{matrix.kernel}} CC=${{matrix.cc}} -j
|
||||||
|
|||||||
Reference in New Issue
Block a user