mirror of
https://github.com/thepigeongenerator/mcaselector-lite.git
synced 2025-12-17 07:35:45 +01:00
add vcpkg.json, and modify ci.yaml to improve usage vcpkg
Now we utilise storing dependencies in `vcpkg.json`, we can use this to more easily install the dependencies. Furthermore, we moved cloning vcpkg to `checkout`, which creates clones with `--depth=1` by default.
This commit is contained in:
58
.github/workflows/ci.yaml
vendored
58
.github/workflows/ci.yaml
vendored
@@ -11,7 +11,6 @@ on:
|
|||||||
env:
|
env:
|
||||||
VCPKG_DISABLE_METRICS: 1
|
VCPKG_DISABLE_METRICS: 1
|
||||||
VCPKG_ROOT: ${{github.workspace}}/.vcpkg
|
VCPKG_ROOT: ${{github.workspace}}/.vcpkg
|
||||||
DEPS_VCPKG: glfw3:x64-linux-dynamic glfw3:x64-mingw-static libarchive:x64-linux-dynamic libarchive:x64-mingw-static
|
|
||||||
WINEPREFIX: /tmp/wineprefix
|
WINEPREFIX: /tmp/wineprefix
|
||||||
jobs:
|
jobs:
|
||||||
#
|
#
|
||||||
@@ -19,37 +18,40 @@ jobs:
|
|||||||
#
|
#
|
||||||
exec-ci-tasks:
|
exec-ci-tasks:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: ghcr.io/thepigeongenerator/mcaselector-lite:latest
|
|
||||||
steps:
|
steps:
|
||||||
#
|
|
||||||
# general setup
|
# general setup
|
||||||
#
|
- name: checkout main branch
|
||||||
- uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
#
|
- name: checkout vcpkg
|
||||||
# VCPKG setup
|
uses: actions/checkout@v4
|
||||||
#
|
with:
|
||||||
- id: gen-keys
|
repository: microsoft/vcpkg
|
||||||
run: echo "HASH_VCPKG=vcpkg-$(echo "$DEPS_VCPKG" | sha256sum | cut -d ' ' -f1)" >>"$GITHUB_OUTPUT"
|
path: ${{env.VCPKG_ROOT}}
|
||||||
# load the vcpkg cache
|
- run: . "$VCPKG_ROOT/bootstrap-vcpkg.sh"
|
||||||
|
|
||||||
|
- name: get library data
|
||||||
|
id: libdat
|
||||||
|
run: echo "LIBS_HASH=vcpkg_installed-$(cat vcpkg.json | sha256sum | cut -d ' ' -f1)" >>"$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
# restore the cache
|
||||||
- uses: actions/cache@v4
|
- uses: actions/cache@v4
|
||||||
id: vcpkg-cache
|
id: vcpkg-cache
|
||||||
with:
|
with:
|
||||||
path: ${{env.VCPKG_ROOT}}
|
path: vcpkg_installed
|
||||||
key: ${{steps.gen-keys.outputs.HASH_VCPKG}}
|
key: ${{steps.libdat.outputs.LIBS_HASH}}
|
||||||
restore-keys: vcpkg-
|
restore-keys: vcpkg_installed-
|
||||||
|
|
||||||
# setup vcpkg if the cache didn't hit
|
# setup vcpkg if the cache didn't hit
|
||||||
- if: steps.vcpkg-cache.outputs.cache-hit != 'true'
|
- name: install vcpkg dependencies
|
||||||
|
if: steps.vcpkg-cache.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
if [ -d "$VCPKG_ROOT" ]; then
|
"$VCPKG_ROOT/vcpkg" install --triplet=x64-linux-dynamic
|
||||||
cd "$VCPKG_ROOT"
|
"$VCPKG_ROOT/vcpkg" install --triplet=x64-mingw-static
|
||||||
git pull -f
|
|
||||||
cd -
|
# perform continuous integration actions
|
||||||
else
|
- run: make x86_64-linux-gnu-gcc CALL=compile -j
|
||||||
git clone https://github.com/microsoft/vcpkg.git "$VCPKG_ROOT"
|
- run: make x86_64-w64-mingw32-gcc CALL=compile -j
|
||||||
fi
|
- run: make x86_64-linux-gnu-gcc CALL=run DEBUG=test -j
|
||||||
"$VCPKG_ROOT/bootstrap-vcpkg.sh"
|
- run: make x86_64-w64-mingw32-gcc CALL=run DEBUG=test -j
|
||||||
"$VCPKG_ROOT/vcpkg" install $DEPS_VCPKG
|
|
||||||
- name: compilation (using bulk compilation)
|
|
||||||
run: make all CALL=compile -j
|
|
||||||
- name: unit tests (using bulk flags)
|
|
||||||
run: make all CALL=run DEBUG=test -j
|
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -19,4 +19,5 @@
|
|||||||
/test/bin/
|
/test/bin/
|
||||||
/test/obj/
|
/test/obj/
|
||||||
*.lock
|
*.lock
|
||||||
|
/vcpkg_installed/
|
||||||
compile_commands.json
|
compile_commands.json
|
||||||
|
|||||||
7
vcpkg.json
Normal file
7
vcpkg.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
|
||||||
|
"dependencies": [
|
||||||
|
"glfw3",
|
||||||
|
"libarchive"
|
||||||
|
]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user