|
| 1 | +--- |
| 2 | +title: Automate the Build of Windows Applications |
| 3 | + |
| 4 | +weight: 3 |
| 5 | + |
| 6 | +### FIXED, DO NOT MODIFY |
| 7 | +layout: learningpathall |
| 8 | +--- |
| 9 | +In this section, you will learn how to automate the build process of a Windows application using GitHub Arm-hosted runners. You will use the application in the [Optimize Windows applications using Arm Performance Libraries Learning Path](/learning-paths/laptops-and-desktops/windows_armpl/). |
| 10 | + |
| 11 | +### Overview of the Windows Application |
| 12 | + |
| 13 | +A basic overview of the application is provided here but for details on building the application refer to the [Optimize Windows applications using Arm Performance Libraries Learning Path](/learning-paths/laptops-and-desktops/windows_armpl/2-multithreading/). |
| 14 | + |
| 15 | +The source code for the application that renders a rotating 3D cube to perform the calculations using different programming options is provided in this GitHub repository. |
| 16 | + |
| 17 | +```console |
| 18 | +https://github.com/odincodeshen/SpinTheCubeInGDI.git |
| 19 | +``` |
| 20 | + |
| 21 | +The application implements a spinning cube and consists of four key components: |
| 22 | +- **Shape Generation**: Generates vertices for a sphere using a golden ratio-based algorithm. |
| 23 | +- **Rotation Calculation**: Uses a rotation matrix to rotate the 3D shape around the X, Y, and Z axes. |
| 24 | +- **Drawing**: Draws the transformed vertices of the shapes on the screen using a Windows API. |
| 25 | +- **Performance Measurement**: Measures and displays the number of transforms per second. |
| 26 | + |
| 27 | +The code has two options to calculate the rotation: |
| 28 | + |
| 29 | +1. Multithreading: the application utilizes multithreading to improve performance by distributing the rotation calculations across multiple threads. |
| 30 | +2. Arm Performance Libraries: the application utilizes optimized math library functions for the rotation calculations. |
| 31 | + |
| 32 | +You will learn how to automate the build process for this application by using GitHub Actions that leverages the Arm-hosted Windows runners. |
| 33 | + |
| 34 | +### Automate the Build Process |
| 35 | + |
| 36 | +This GitHub Actions workflow [`msbuild.yml`](https://github.com/odincodeshen/SpinTheCubeInGDI/blob/main/.github/workflows/msbuild.yml) that automates the build process for this project using MSBuild for Windows on Arm is included in this repository. |
| 37 | + |
| 38 | +Below is an explanation of the steps in the workflow: |
| 39 | + |
| 40 | + |
| 41 | + **Trigger Events**: The workflow runs when there is a push or pull_request event on the main branch. |
| 42 | + |
| 43 | + **Job Definition**: A single job named build is defined. It runs on the GitHub Arm-hosted Windows runner (`windows-11-arm`) as shown: |
| 44 | + |
| 45 | +```console |
| 46 | +jobs: |
| 47 | + build: |
| 48 | + runs-on: windows-11-arm |
| 49 | +``` |
| 50 | + **Checkout Repository**: Uses the `actions/checkout@v4` action to fetch the code. |
| 51 | + |
| 52 | + **Add MSBuild to PATH **: Adds MSBuild tools for the build process using `microsoft/[email protected]`. |
| 53 | + |
| 54 | + **Restore Dependencies**: Runs `nuget restore` to restore NuGet packages required by the solution. |
| 55 | + |
| 56 | + **Create Download Directory**: Creates a directory to store downloaded files and verifies the Python version. |
| 57 | + |
| 58 | + **Download ARM Performance Libraries**: Downloads the Windows installer for ARM Performance Libraries (APL) and verifies the downloaded files. |
| 59 | + |
| 60 | + **Install ARM Performance Libraries**: Installs the downloaded ARM Performance Libraries using `msiexec.exe` with a quiet mode and logs the process. |
| 61 | + |
| 62 | + **Check Installation Success**: Verifies the success of the APL installation by checking the exit code and logs. |
| 63 | + |
| 64 | + **Build the Solution**: Runs MSBuild to build the solution with the specified configuration (Debug) and platform (ARM64). |
| 65 | + |
| 66 | + **Upload Build Artifact**: Uploads the built executable as an artifact using `actions/upload-artifact@v4`. |
| 67 | + |
| 68 | +This workflow automates the process of dependency management, environment setup, building your Windows on Arm project, and storing the final artifact all using GitHub Arm-hosted runner. You can view the `Actions` logs on the repository for each step. |
| 69 | + |
| 70 | + |
| 71 | +You have successfully built your Windows application and uploaded the application as an artifact of your workflow using the GitHub Arm-hosted Windows runner. |
0 commit comments