-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Upgrade to .NET Core v3.1 (and many, many other things!) #17
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Difference from `v3.1-lts` branch: in this branch the structure will not change much. The app will remain monolithic (hence the branch name) with typical Razor pages. There will be two Blazor components in two pages. WIP.
Prior to this change, comparison elements in `Inputs` page were hard-coded for each criterionm, along with the IDs of the elements. This change leverages the goodness of Razor syntax by looping through the criteria and generating HTML elements for each of them.
- Gitignore is fixed: unnecessary lines are removed. - Stickers for build status (GitHub Actions) in readme are added. - SDK version is updated in readme, global.json files and CI/CD configs. - Some packages in csproj file of the test project have been upgraded.
TODO: fix e2e tests for ReST API endpoints
- Update end year in footer of page layout - Add relevant badges and remove unnecessary ones in Readme
Also, formatting is fixed in two test files.
From now on, with every push of commits, CI/CD will run on Travis (on Ubuntu and macOS) and AppVeyor (on Windows). Each pipeline will build both projects and run unit tests. After that, Travis will deploy the app on Heroku; and AppVeyor will collect unit test coverage and upload it on Codecov, and then deploy the app on Azure App Service. GitHub Actions are removed, since running more than two CI/CD pipelines seem unnecessary.
It was also removed from its implementations.
- Configurations of helper scripts for VS Code have been added. - Version of .NET Core SDK has been upgraded for both projects.
Prior to this change, in order to access the browser session, page models directly called `HttpContext.Session.Get[type]()` methods. This change adds dependency injection of `HttpContextAccessor` from Startup to the three main page models to achieve the same result. However, this is more streamlined, and easier to test by mocking.
Moq library was used to mock IHttpContextAccessor. A mock session class, `MockSession`, was used as the drop-in session property of the mocked object. This commit also enables the tests that used to be skipped on CI/CD.
- `SchoolService` is excluded from coverage (by filename). - 'Analysis' and 'Error' pages are included in E2E (page load) test.
- Badges for Docker pulls and .NET Core SDK version are removed. - A badge linking to the Docker image on Docker Hub is added. - Code Climate maintainability (percentage) badge is added, - For each badge link, `target="_blank"` is added.
Prior to this change, the responsibility of accessing the database was carried out by a Node.js application deployed as a ReST API on Heroku (see my project `konschool-mlab-host` on GitHub). It was set up in this way due to issues with the old MongoDB driver and/or mLab. With this set up, `SchoolService` would make a GET request to that app to get all the details of the schools (responses were parsed with `Newtonsoft.Json`). This change implements `SchoolService` with MongoDB driver, so that this app can connect directly with MongoDB Atlas (switched from mLab), with a few environment variables. This commit undoes part of what 50f8f8e had done.
- Mock classes are now in a separate folder with a separate namespace. - Mock objects are now injected in unit/e2e tests when necessary. - Conditional DI of ISchoolService in Startup is removed.
How did I miss that!!
The `.env` file should be at the root directory with the `sln` file. Also, logger is added via DI for logging info and errors.
ApiControllerTests were failing due to e537857.
- Link to docs directory is fixed. - Badge for Travis CI is shortened.
These tests check whether the values are set according to inputs.
The script runs the unit tests via OpenCover, which also generates a report in XML format. Then some HTML files are generated by parsing the XML file, which are then served by `dotnet serve` tool. The script is pretty self-explanatory. It depends on a few CLI tools: xUnit, OpenCover (portable), codecov. These are available on Chocolatey. It also requires a .NET Core global tool (which can be installed via .NET Core CLI): `dotnet-reportgenerator-globaltool`. These are explained in the script in the comments at the top. The script is, unfortunately, for Windows only. This is due to OpenCover being available only for Windows. I have tried some cross-platform coverage tools (for example, @coverlet-coverage), but was not satisfied. The problem with Coverlet is that after generating coverage for tests covering multiple namespaces, it calculates the coverage by calculating the simple arithmetic mean — not a weighted arithmetic mean, which would take the number of LOC of each namespace into account.
This is due to OpenCover generating inconsistent reports: some LOCs were shown not covered by tests, despite actually being covered. For example, some edge cases in Models were covered by 0846e27 — but the coverage did not go up for some unknown reason(s). The global CLI tool, `coverlet.console`, has been used for this project. There are now separate scripts for generating reports and uploading test coverage — for Windows and Unix-like platforms.
Also, linting/formatting CI/CD yml files.
Codecov Report
@@ Coverage Diff @@
## master #17 +/- ##
===========================================
+ Coverage 61.06% 95.17% +34.10%
===========================================
Files 31 29 -2
Lines 637 622 -15
Branches 127 103 -24
===========================================
+ Hits 389 592 +203
+ Misses 235 19 -216
+ Partials 13 11 -2
Continue to review full report at Codecov.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
docs