diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 462237e..7f1e548 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,12 +13,19 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macOS-latest] + os: [ubuntu-latest, macOS-latest, windows-latest] + + defaults: + run: + shell: bash + + env: + DEPOT_TOOLS_WIN_TOOLCHAIN: 0 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - - uses: actions/setup-python@v5 + - uses: actions/setup-python@v6 with: python-version: '3.10' @@ -26,7 +33,7 @@ jobs: run: | pip install setuptools - - uses: actions/cache@v4 + - uses: actions/cache@v5 with: path: | .cipd/ @@ -39,7 +46,7 @@ jobs: - name: Set up PATH run: | - echo "`pwd`/depot_tools" >> $GITHUB_PATH + echo "${{ github.workspace }}/depot_tools" >> "$GITHUB_PATH" - name: Sync run: | @@ -48,9 +55,15 @@ jobs: - name: Build and run tests run: | - gn gen out + gnargs="" + ext="" + if [ "$RUNNER_OS" = "Windows" ]; then + # Use the runner's MSVC (cl.exe) instead of fetching a clang package. + gnargs='--args=mini_chromium_is_clang=false' + ext=".exe" + fi + gn gen out $gnargs autoninja -C out hello - ./out/hello + "./out/hello$ext" autoninja -C out hello_unittest - ./out/hello_unittest - + "./out/hello_unittest$ext" diff --git a/DEPS b/DEPS index 20cd6bb..e64bbd9 100644 --- a/DEPS +++ b/DEPS @@ -41,6 +41,17 @@ deps = { 'condition': 'host_os == "linux"', }, + 'buildtools/win': { + 'packages': [ + { + 'package': 'gn/gn/windows-amd64', + 'version': Var('gn_version'), + } + ], + 'dep_type': 'cipd', + 'condition': 'host_os == "win"', + }, + 'third_party/googletest/src': Var('chromium_git') + '/external/github.com/google/googletest.git@' + '4fe3307fb2d9f86d19777c7eb0e4809e9694dde7', diff --git a/build/BUILDCONFIG.gn b/build/BUILDCONFIG.gn index 1456e6a..1f42a53 100644 --- a/build/BUILDCONFIG.gn +++ b/build/BUILDCONFIG.gn @@ -14,8 +14,13 @@ if (current_cpu == "") { current_cpu = target_cpu } -set_default_toolchain( - "//third_party/mini_chromium/src/build/config:gcc_like_toolchain") +if (current_os == "win") { + set_default_toolchain( + "//third_party/mini_chromium/src/build/config:msvc_toolchain_$current_cpu") +} else { + set_default_toolchain( + "//third_party/mini_chromium/src/build/config:gcc_like_toolchain") +} declare_args() { is_debug = true