Skip to content
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 tests #3

Merged
merged 1 commit into from
Aug 21, 2023
Merged

Unit tests #3

merged 1 commit into from
Aug 21, 2023

Conversation

SimeonEhrig
Copy link
Member

@SimeonEhrig SimeonEhrig commented Jul 5, 2023

Setup CI for unit tests. Use SetupDevEnv.jl project to setup test environment. The script setups all QED dependencies to the current dev branch.

@SimeonEhrig SimeonEhrig force-pushed the initialGitlabCI branch 2 times, most recently from 5400895 to 25c576b Compare July 5, 2023 12:46
szabo137 pushed a commit to QEDjl-project/QuantumElectrodynamics.jl that referenced this pull request Jul 10, 2023
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 the
`Project.toml` of the project and installs all QED dependencies as
development version from the current `dev` branch by default. All other
dependencies are normally installed.
`SetupEnv` also allows to install QED dependencies from other
repositories and branches.
- On a local system, you can set the environment variable
`CI_UNIT_PKG_URL_<QED_package>=https://github.com/User/<QED_package>#<branch>`.
For example, if I want to use my fork of `QEDbase` and the feature
branch `fooFunction` I have to set the environment variable
`CI_UNIT_PKG_URL_QEDbase=https://github.com/SimeonEhrig/QEDbase.jl.git#fooFunction`.
- In the CI, the dependency can set via commit message:

Example Git commit message:
 ```
 Add function bar

- function bar uses the function foo from the QEDbase packge 

CI_UNIT_PKG_URL_QEDbase:
https://github.com/SimeonEhrig/QEDbase.jl.git#fooFunction
 ``` 

# 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 with
`CI_UNIT_PKG_URL_<package>` in the message again.

# Local unit tests

Local unit tests are enable in the `.gitlab-ci.yml`. Actual `QED.jl`
will not have functionality, but with the unit tests, we can test the
functionality of the `SetupEnv`.

# unit testing in sub packages

Sub packages needs to clone this repository to get the `SetupEnv` tool,
see QEDjl-project/QEDfields.jl#3

# Documentation

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
@SimeonEhrig SimeonEhrig changed the title initial .gitlab-ci.yml Unit tests Jul 11, 2023
@SimeonEhrig SimeonEhrig requested a review from szabo137 July 11, 2023 14:23
@SimeonEhrig SimeonEhrig marked this pull request as ready for review July 11, 2023 14:23
- use SetupDevEnv.jl script from QED.jl repository to setup test environment
@SimeonEhrig
Copy link
Member Author

@szabo137 ready for review

Copy link
Member

@szabo137 szabo137 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR.
No concerns from my side.

ready for merging!

@szabo137 szabo137 merged commit ec6eaf5 into QEDjl-project:dev Aug 21, 2023
@AntonReinhard AntonReinhard added this to the Release-0.1.0 milestone Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants