Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to build this project in github action #2290

Closed
lindexi opened this issue Dec 8, 2019 · 5 comments
Closed

How to build this project in github action #2290

lindexi opened this issue Dec 8, 2019 · 5 comments
Labels
Question General question, not a problem in source code or documentation (yet)

Comments

@lindexi
Copy link
Member

lindexi commented Dec 8, 2019

I create a github action and call the build.cmd but build failed.

This is my action file https://github.com/dotnet-campus/wpf/pull/1/files

And this is the build info: https://github.com/dotnet-campus/wpf/pull/1/checks?check_run_id=338492387

Could you help me to build WPF project

@vatsan-madhavan
Copy link
Member

I'm not going to analyze your GitHub actions yml here - that's your project ;-) If you figure it out, we'll be happy to use your work some day in the future 😁. But I'll try to help you achieve your goal by explaining how to structure the build process and then you can implement it in a way that works within the GitHub Actions framework.

  1. Start by cloning the repo.
    • You always want to run something like git clean -xdf at the start of each build. This helps ensure that any crud from previous builds is removed. The build process generates files under the repository root (generally, under .tools, artifacts, .dotnet\ etc.)
  2. The build itself should be run 4 times.
    • Configuration={Release, Debug} x Platform={x86, x64}
    • The repo is designed to treat Platform=x86 as the default platform. This this is the only platform that generates reference assembly packages (or any packages that are architecture neutral).
    • Put differently, Platform=Any CPU is functionally equivalent to x86.
    • In Azure Pipelines, we use a matrix strategy to distribute the tasks 4 times over.
  3. The build command to use is something like this:
    • build.cmd -pack -ci -configuration $(Configuration) -prepareMachine /p:Platform=$(Platform)
    • If you can generate an official build ID, then add one more argument like this: /p:OfficialBuildId=$(BuildId)
    • The BuildId value $(BUILD.BUILDNUMBER) in Azure Pipelines usually looks something like this: 20191208.1
    • -ci is an important switch for CI/PR builds. It changes the behavior of builds in a significant way. You may want to peruse the implications of this switch in https://github.com/dotnet/arcade and also look for ContinuousIntegrationBuild in various Arcade build targets. You can also try building with -ci locally to see how it behaves.
  4. Once the build is done, you can gather the logs and upload them.
    • The logs are always in .binlog formate, under artifacts\logs\**\*
  5. You can also publish or upload nuget packages optionally if you want to produce a true build system.
    • The nuget packages would be produced under artifacts\packages.
    • A set of nuget packages would require (a) architecture neutral packages from x86 builds, win-x86 specific packages from the same x86 build, and win-x64 RID specific packages from a matching x64 build.

As tooling, you'll need VS2019 16.4 on the build machines. Close to a full install would be ideal.

Once you get going and if you need additional help or want to tweak something a bit differently, we can try to help further.

@vatsan-madhavan vatsan-madhavan added the Question General question, not a problem in source code or documentation (yet) label Dec 10, 2019
@lindexi
Copy link
Member Author

lindexi commented Dec 10, 2019

@vatsan-madhavan Thank you very much

@lindexi
Copy link
Member Author

lindexi commented Apr 23, 2020

Now it says LINK : fatal error LNK1104: cannot open file 'MSVCURTD_netcore.LIB' [D:\a\wpf\wpf\src\Microsoft.DotNet.Wpf\src\DirectWriteForwarder\DirectWriteForwarder.vcxproj]

@lindexi
Copy link
Member Author

lindexi commented Apr 23, 2020

Now it says LINK : fatal error LNK1104: cannot open file 'MSVCURTD_netcore.LIB' [D:\a\wpf\wpf\src\Microsoft.DotNet.Wpf\src\DirectWriteForwarder\DirectWriteForwarder.vcxproj]

Why Link error? Because the cpp project should use x86 or x64 to compile.

@lindexi
Copy link
Member Author

lindexi commented Apr 23, 2020

The simplest configuration files are as follows

name: .NET Core

on: [push]

jobs:
  build:

    runs-on: windows-latest

    steps:
    - uses: actions/checkout@v1
    - name: Install Nuget
      uses: nuget/setup-nuget@v1
      with:
        nuget-version: '5.x'
      
    - name: Setup MSBuild.exe
      uses: warrenbuckley/Setup-MSBuild@v1
      
    - name: Build
      run: .\build.cmd -pack -ci -configuration Release -prepareMachine /p:Platform=x86

See: dotnet-campus#1

Thank you @vatsan-madhavan

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Question General question, not a problem in source code or documentation (yet)
Projects
None yet
Development

No branches or pull requests

2 participants