In this section you will run the CI/CD pipeline to verify that you are able to build and run the .NET application on your Windows Sandbox self-hosted runner.
The CI/CD pipeline is declared under the .github/workflows/dotnet_sandbox.yml
file. This YAML configuration defines a CI/CD pipeline for an .NET core project using GitHub Actions. It specifies actions to be triggered manually or on push to the main branch. This is indicated at the top of the YAML declaration:
on:
push:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
The pipeline consists of one job: build. This job runs on the self-hosted runner as shown in the file below:
jobs:
build:
runs-on: self-hosted
The job includes the following steps:
steps:
- name: Checkout
uses: actions/checkout@v4
# Install the .NET Core workload
- name: Install .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- run: dotnet restore ${{ env.Project_Path }}
- run: dotnet build ${{ env.Project_Path }} -c Release --no-restore
- run: dotnet publish ${{ env.Project_Path }} -c Release --self-contained -r win-arm64
This pipeline automates the process of building the .NET application and publishing it on your self-hosted runner.
To run the above pipeline, you can either make modifications to the source code and commit these changes to the main branch, or you can trigger the pipeline manually.
Follow the steps below to trigger the pipeline manually:
This triggers the CI/CD pipeline. You can monitor the progress of this pipeline under the Actions tab of your GitHub repository:
To check that your application has been published correctly in the last step, you can go to the location of the application inside Windows Sandbox and run it.
The application should be published in your runner folder under **actions-runner_work\sandbox-ci-cd-net\sandbox-ci-cd-net\TSP.WPF\bin\Release\net8.0-windows7.0\win-arm64\publish**.
Double-click TSP.WPF to run the application. The application starts as shown:
This process demonstrates how you can seamlessly integrate Windows Sandbox with GitHub Actions to automate the build and deployment of your application.