Closed SimeonEhrig closed 1 year ago
To 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 bar
with a dependency to the function QEDbase::foo()
. foo
is not merged in dev branch and exists only on a feature branch on my fork. Like expected, the unit test fails, because the CI test against the dev branch, see this commit. In a second commit, I added CI_UNIT_PKG_URL_QEDbase: https://github.com/SimeonEhrig/QEDbase.jl.git#fooFunction
at the end of the commit message. Now the CI is testing the unit tests with my feature branch and the CI passes.
In a third commit, I added the unit test dependency verification. Therefore the unit tests passes, but the CI failes.
@szabo137 Time for review :sunglasses:
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 https://github.com/QEDjl-project/QEDfields.jl/pull/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