-
Notifications
You must be signed in to change notification settings - Fork 3
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
unit testing #3
unit testing #3
Conversation
0a0874e
to
9d527cb
Compare
- Unit tests testing all function if the package itself - The SetupEnv script add the develop version of all QED packages to julia environment. - Run unit-test in the CI
7dc9388
to
ec24176
Compare
Testing the PRTo test the PR, we need an unconventional setup. I added unit tests in the QEDfields project. Afterwards I created a feature branch, which implements an new function In a third commit, I added the unit test dependency verification. Therefore the unit tests passes, but the CI failes. |
f406741
to
c7afa2a
Compare
@szabo137 Time for review 😎 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice PR, thanks! The only thing, which could be considered changing is the proper error handling to replace exit(0)
and exit(1)
entirely. However, maybe this would be a bit of overengineering 🤷♂️.
- use logger instead println - use custom error in verify_env.jl
9c23042
to
9b01697
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything is fine :-)
After PR #3 I recognized, that lines starting with `CI_UNIT_PKG_URL_` exist in the commit message of the merge request. This triggers accidentally custom URLs for packages in the `SetupDevEnv.jl` script. Because it does not make any sense to use custom URLs on the `main` and `dev` branch, this PR disable the feature for this branches. Add also gitlab CI attribute `interruptible: true` that CI can be aborted if a new commit was pushed to the same branch.
The PR adds the tool `integTestGen`. The `integTestGen.jl` creates jobs for the CI, which checks if the changes in PR does a API or behavior break which causes that other QED packages which use the package of PR does not work anymore. A detailed documentation is part of the PR. The doc also provides the documentation for the unit tests, introduced in PR #3.
The PR add the tool SetupEnv and enable unit testing for QED.jl.
About SetupEnv
SetupEnv
creates an environment for the unit tests. It reads theProject.toml
of the project and installs all QED dependencies as development version from the currentdev
branch by default. All other dependencies are normally installed.SetupEnv
also allows to install QED dependencies from other repositories and branches.CI_UNIT_PKG_URL_<QED_package>=https://github.com/User/<QED_package>#<branch>
. For example, if I want to use my fork ofQEDbase
and the feature branchfooFunction
I have to set the environment variableCI_UNIT_PKG_URL_QEDbase=https://github.com/SimeonEhrig/QEDbase.jl.git#fooFunction
.Example Git commit message:
Pipeline behavior
The pipeline has two stages for unit test. The first stage does the actual unit tests. If the stages passes, you code is fine. The second stage checks, if
SetupEnv
use custom URLs for QED packages. If this happens, the test will fail. The reason is, that no code should be merged, which rely on non merged functions. The solution is merging the code in the depending package first and than trigger the CI withCI_UNIT_PKG_URL_<package>
in the message again.Local unit tests
Local unit tests are enable in the
.gitlab-ci.yml
. ActualQED.jl
will not have functionality, but with the unit tests, we can test the functionality of theSetupEnv
.unit testing in sub packages
Sub packages needs to clone this repository to get the
SetupEnv
tool, see QEDjl-project/QEDfields.jl#3Documentation
Documentation is coming, when the integration tests are implement. I decided to split up the unit and integration tests in two separate PR for better review. Compare to it, it is better to write the documentation of the unit and integration test together. So, the unit test documentation is coming together with the integration test PR. A initial version can be found here: https://github.com/SimeonEhrig/GitlabCIMain/blob/master/docs/src/index.md