< Previous Challenge - Home - Next Challenge >
With our Azure resources created we have laid the foundations resources for our application. Now, we must connect our source code and its destination. The first step in this journey is called Continuous Integration (CI).
Continuous integration is the process of merging local code changes into source control and may include steps to automatically build and/or test the code. When done effectively, Continuous Integration allows developers to rapidly iterate and collaborate, and it helps ensure that newly added code does not break the current application.
Review the following articles:
In this challenge, you will build and test the .NET Core application.
Create a new .NET
workflow.
NOTE: To get a new scaffold workflow, in your repo click on Actions in the top menu > New Workflow (button) > scroll down to the ‘Continuous integration workflows’ section and select the configure button on the ‘.NET’ example.
Review the layout of the workflow. There is a single job (named ‘build’) with multiple steps (restore, build, test).
NOTE: There are some new events for the workflow we haven’t used before for ‘push’ and ‘pull_request’.
In your workflow, under the “Setup .NET Core” step, check the .NET version is 6.0.x
to match the version defined by the application.
Ensure the workflow is configured to trigger on both pushes and pull requests.
Configure both these triggers with path filters to only trigger this workflow for changes in the /Application
folder.
Update the predefined steps used to build the .NET Core application
NOTE: For each step below, you will need to update each command to pass the relative path to the .csproj
as an argument):
restore
- will get all the dependencies. Update with an argument to the application csproj file.build
- will actually compile our code. Update with an argument to the application csproj file.test
- will execute all our unit tests. Update with an argument to the unit test csproj file.Test the workflow by making a small change to the application code (i.e., add a comment). Commit, push and ensure the workflow completes successfully.
At this point, any changes pushed to the /Application
folder automatically triggers the workflow…and that is Continuous Integration!
/Application
folder automatically triggers the workflow