From 170cf5d1c4714319663b71175d3c636c8de36d64 Mon Sep 17 00:00:00 2001 From: Tim Niederhausen Date: Mon, 11 Mar 2024 22:18:03 +0100 Subject: [PATCH] chore(ci): Switch Windows to GitHub actions --- .appveyor.yml | 59 --------------------- .github/workflows/windows.yml | 97 +++++++++++++++++++++++++++++++++++ README.md | 3 -- 3 files changed, 97 insertions(+), 62 deletions(-) delete mode 100644 .appveyor.yml create mode 100644 .github/workflows/windows.yml diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index 70ba3d0..0000000 --- a/.appveyor.yml +++ /dev/null @@ -1,59 +0,0 @@ -clone_folder: c:\projects\gn-build\build - -shallow_clone: true - -environment: - GN_WIN_URL: https://github.com/timniederhausen/gn/releases/download/2021.03/gn-win-amd64.zip - - matrix: - - GN_ARGS: "visual_studio_version=\\\"2013\\\"" - - GN_ARGS: "visual_studio_version=\\\"2013\\\" is_debug=false" - - GN_ARGS: "visual_studio_version=\\\"2013\\\" is_official_build=true" - - GN_ARGS: "visual_studio_version=\\\"2013\\\" clang_base_path=\\\"C:\\Program Files\\LLVM\\\" is_clang=true" - - GN_ARGS: "visual_studio_version=\\\"2013\\\" clang_base_path=\\\"C:\\Program Files\\LLVM\\\" is_clang=true is_debug=false" - - GN_ARGS: "visual_studio_version=\\\"2013\\\" clang_base_path=\\\"C:\\Program Files\\LLVM\\\" is_clang=true is_official_build=true" - - GN_ARGS: "visual_studio_version=\\\"2015\\\"" - - GN_ARGS: "visual_studio_version=\\\"2015\\\" is_debug=false" - - GN_ARGS: "visual_studio_version=\\\"2015\\\" is_official_build=true" - - GN_ARGS: "visual_studio_version=\\\"2015\\\" clang_base_path=\\\"C:\\Program Files\\LLVM\\\" is_clang=true" - - GN_ARGS: "visual_studio_version=\\\"2015\\\" clang_base_path=\\\"C:\\Program Files\\LLVM\\\" is_clang=true is_debug=false" - - GN_ARGS: "visual_studio_version=\\\"2015\\\" clang_base_path=\\\"C:\\Program Files\\LLVM\\\" is_clang=true is_official_build=true" - - GN_ARGS: "visual_studio_version=\\\"2017\\\"" - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - - GN_ARGS: "visual_studio_version=\\\"2019\\\"" - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - -matrix: - fast_finish: true - -install: - # All external dependencies are installed in C:\projects\deps - - mkdir C:\projects\deps - - set PATH=C:\projects\deps;%PATH% - - # Install the current GN version - - appveyor DownloadFile %GN_WIN_URL% -FileName C:\projects\deps\gn.zip - - 7z x C:\projects\deps\gn.zip -oC:\projects\deps > nul - - gn --version - - # Install Ninja - - set NINJA_URL="https://github.com/ninja-build/ninja/releases/download/v1.7.2/ninja-win.zip" - - appveyor DownloadFile %NINJA_URL% -FileName C:\projects\deps\ninja.zip - - 7z x C:\projects\deps\ninja.zip -oC:\projects\deps > nul - - ninja --version - -before_build: - - cd c:\projects\gn-build - - git init - - git remote add origin https://github.com/timniederhausen/gn-build.git - - git fetch - - git checkout -t origin/testsrc - -build_script: - - gn gen out --args="%GN_ARGS%" - - type out\args.gn - - ninja -C out - -test_script: - - py -3 build\gn_helpers_unittest.py - - out\hello diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml new file mode 100644 index 0000000..a062ba7 --- /dev/null +++ b/.github/workflows/windows.yml @@ -0,0 +1,97 @@ +name: Windows + +on: + pull_request: + branches: + - master + - develop + - feature/** + push: + branches: + - master + - develop + - feature/** + workflow_dispatch: + release: + types: published + +env: + NINJA_BASE_URL: https://github.com/ninja-build/ninja/releases/download/ + GN_BASE_URL: https://github.com/timniederhausen/gn/releases/download/2021.03/ + +jobs: + windows: + strategy: + fail-fast: false + matrix: + include: + # 2019 + - slug: windows-2019 debug + gen_args: 'is_official_build = false' + os: windows-2019 + ninja_release_name: v1.7.2/ninja-win.zip + gn_release_name: gn-win-amd64.zip + + - slug: windows-2019 official + gen_args: 'is_official_build = true' + os: windows-2019 + ninja_release_name: v1.7.2/ninja-win.zip + gn_release_name: gn-win-amd64.zip + + # 2022 + - slug: windows-2022 debug + gen_args: 'is_official_build = false' + os: windows-2022 + ninja_release_name: v1.7.2/ninja-win.zip + gn_release_name: gn-win-amd64.zip + + - slug: windows-2022 official + gen_args: 'is_official_build = true' + os: windows-2022 + ninja_release_name: v1.7.2/ninja-win.zip + gn_release_name: gn-win-amd64.zip + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + with: + # we need all everything for `git describe` to work correctly + fetch-depth: 0 + + - name: Install recent Ninja + run: | + Invoke-WebRequest -OutFile ninja.zip -Uri "${NINJA_BASE_URL}${{ matrix.ninja_release_name }}" + python -c 'import sys,zipfile;zipfile.ZipFile(sys.argv[1]).extractall()' ninja.zip + + - name: Install GN + run: | + Invoke-WebRequest -OutFile gn.zip -Uri "${GN_BASE_URL}${{ matrix.gn_release_name }}" + python -c 'import sys,zipfile;zipfile.ZipFile(sys.argv[1]).extractall()' gn.zip + + # Run gn_helpers unittests first - this should fail if we have an unsupported Python version + # Only support Python3+ for now, otherwise we have to ship the mocking lib + - name: Test gn_helpers + run: | + python3 gn_helpers_unittest.py + + # Setup test project for our //build + - name: Setup test project + run: | + source .env + git clone --branch=testsrc --depth=1 https://github.com/timniederhausen/gn-build.git testsrc + mkdir testsrc/build + mv config testsrc/build/ + mv toolchain testsrc/build/ + + # Try to generate ninja files with different python versions + - name: gen with python3 + run: | + .\gn.exe gen out --args='${{ matrix.gen_args }}' --root=testsrc + + # Try to build the test project + - name: Build + run: | + cat out/args.gn + .\ninja.exe -C out + cd out && ./hello diff --git a/README.md b/README.md index 2672bd1..341cb8f 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,6 @@ The toolchains have been tested on the following platforms: * Linux (GCC 6, Clang 3.8) * OS X (Xcode 7.3.1) -[![Build Status](https://travis-ci.org/timniederhausen/gn-build.svg?branch=master)](https://travis-ci.org/timniederhausen/gn-build) -[![Build status](https://ci.appveyor.com/api/projects/status/jpot0c7wp6e78lkk/branch/master?svg=true)](https://ci.appveyor.com/project/timniederhausen/gn-build) - The [testsrc](https://github.com/timniederhausen/gn-build/tree/testsrc) branch contains the test/example project used by the CI tests.