-
Notifications
You must be signed in to change notification settings - Fork 0
Continuous Integration with GitHub Actions
Due to the agile approach and feature-branch-styled GitHub Conventions chosen for the Wedium project, the team wants to ensure features can be automatically tested so no breaking changes are inserted into master
.
The following items have been identified as crucial to test to ensure that existing code does not break:
-
All Wedium API NUnit tests (Due to .NET's inversion of control for API applications, changes to
Startup.cs
may result in breaking existing code. Furthermore, changes in models are very likely to break existing code.)
The following have been identified as crucial times to execute tests for, to ensure that existing code does not break:
-
On pull request into
master
(This is the easiest time to test code to eliminate chances of breaking changes being introduced into themaster
branch). -
On push into
master
(This ensures GitHub's automatic merger (used for pull requests) does not fail and introduce a breaking change. If the tests fail then the pull request that introduced the change will be rolled back).
The testing is completed through the use of the GitHub Actions which have been established (defined in ./.github/workflows
).
GitHub Actions was chosen to complete the testing due to the following reasons:
- It is integrated into GitHub and does not require third party services and the accounts associated with them
- There are a number of base templates to base Wedium's unique action off. As a result, setting the action up to complete the test requirements outlined above is quick and easy to implement.
- A few of the group members have experience writing GitHub Actions (as part of another course)
- It can be configured easily to make use of GitHub Secrets (detailed below)).
As Wedium's database is live and the repository inevitably will be made public upon completion, it is important to not include the connection string in any file (or in any commit) to prevent foreign users gaining access to sensitive information. GitHub Secrets have to be utilised to provide the connection string to GitHub Actions to allow all unit tests to connect to the database and complete successfully.
Ultimately, GitHub Secrets allows the unit tests to be run easily when executed by GitHub Actions (by getting the connection string from the test machine's environment variables
) and developers (by temporarily inserting the connection string into appsettings.json
).
Jainal Gandhi | Harman Lamba | Eric Leung | Salma Sanad
Made with love 👨👨👧👦💖