aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ci.yml49
-rw-r--r--README.md2
-rw-r--r--tools/win_build.py14
3 files changed, 60 insertions, 5 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 00000000..e600ea8f
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,49 @@
+name: CI
+
+on:
+ push:
+ branches: [master]
+ paths-ignore:
+ - "docs/**"
+ - "drafts/**"
+ - "**/README.md"
+ pull_request:
+ branches: [master]
+ paths-ignore:
+ - "docs/**"
+ - "drafts/**"
+ - "**/README.md"
+
+jobs:
+ build:
+ name: Build
+ runs-on: windows-latest
+ strategy:
+ matrix:
+ buildConfiguration: [Debug, Release]
+ architecture: [x86, x64]
+ include:
+ - architecture: x86
+ triplet: x86-windows
+ - architecture: x64
+ triplet: x64-windows
+ fail-fast: true
+
+ env:
+ vcpkgPackages: "gtest fmt ms-gsl"
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Restore artifacts, or run vcpkg, build and cache artifacts
+ uses: lukka/run-vcpkg@add_triplet_to_cachekey
+ id: runvcpkg
+ with:
+ vcpkgArguments: "${{ matrix.vcpkgPackages }}"
+ vcpkgTriplet: "${{ matrix.triplet }}"
+ vcpkgDirectory: "${{ runner.workspace }}/b/vcpkg"
+ - name: Prints outputs of run-vcpkg task
+ run: echo "'${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}' '${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_TRIPLET_OUT }}' "
+
+ - name: Run build script
+ run: python tools\win_build.py -a ${{ matrix.architecture }} -c ${{ matrix.buildConfiguration }} --skip-install-packages
diff --git a/README.md b/README.md
index c2715745..cd8ea66b 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,5 @@
# CruUI
-[![Build Status](https://dev.azure.com/crupest/CruUI/_apis/build/status/crupest.CruUI?branchName=master)](https://dev.azure.com/crupest/CruUI/_build/latest?definitionId=6&branchName=master)
-
## overview
CruUI is a UI library.
diff --git a/tools/win_build.py b/tools/win_build.py
index 3d6f0591..7332af77 100644
--- a/tools/win_build.py
+++ b/tools/win_build.py
@@ -8,6 +8,8 @@ import sys
parser = argparse.ArgumentParser()
parser.add_argument('command', choices=[
'configure', 'build', 'test'], nargs='?', default='test', help='specify command to execute')
+parser.add_argument('--skip-install-packages', action="store_true",
+ help='skip using vcpkg to install package')
parser.add_argument('-a', '--arch', choices=['x86', 'x64'],
default='x64', help='specify target cpu architecture')
parser.add_argument('-c', '--config', choices=['Debug', 'Release'],
@@ -46,15 +48,17 @@ def init_vc_environment(arch):
os.environ[k] = v
+def install_packages():
+ subprocess.check_call('vcpkg install gtest:{arch}-windows fmt:{arch}-windows ms-gsl:{arch}-windows'.format(arch=args.arch),
+ stdout=sys.stdout, stderr=sys.stderr)
+
+
def configure():
generater_vs_arch_map = {
'x86': 'Win32',
'x64': 'x64'
}
- subprocess.check_call('vcpkg install gtest:{arch}-windows fmt:{arch}-windows ms-gsl:{arch}-windows'.format(arch=args.arch),
- stdout=sys.stdout, stderr=sys.stderr)
-
# -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
subprocess.check_call('cmake -S . -B {build_dir} -G "Visual Studio 16 2019" -A {arch} -T host=x64 -DCMAKE_TOOLCHAIN_FILE={toolchain}'
.format(build_dir=work_dir, arch=generater_vs_arch_map[args.arch], toolchain=cmake_toolchain_path),
@@ -74,7 +78,11 @@ def test():
os.chdir(project_root)
+if not args.skip_install_packages:
+ install_packages()
+
configure()
+
if args.command == 'build' or args.command == 'test':
build()
if args.command == 'test':