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

[DO NOT MERGE] Test integration tests #3

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
stages:
- linter
- unit-test
- generate_integration_test
- run_integration_test
- verify-unit-test-deps

format:
Expand Down Expand Up @@ -37,6 +39,48 @@ unit_tests_julia1.9:
tags:
- cpuonly

generate_integration_tests:
image: julia:1.9
stage: generate_integration_test
script:
# extract package name
- export CI_DEPENDENCY_NAME=$(cat $CI_PROJECT_DIR/Project.toml | grep name | awk '{ print $3 }' | tr -d '"')
- echo "CI_DEPENDENCY_NAME -> $CI_DEPENDENCY_NAME"
- apt update && apt install -y git
# TODO: use upstream repo
#- git clone --depth 1 -b dev https://github.com/QEDjl-project/QED.jl.git /QEDjl
- git clone --depth 1 -b integrationTests https://github.com/SimeonEhrig/QED.jl.git /QEDjl
- cd /QEDjl/.ci/integTestGen/
# use local registry of the QED project
- julia --project=. -e 'import Pkg; Pkg.Registry.add(Pkg.RegistrySpec(url="https://github.com/QEDjl-project/registry.git"));'
# needs to add General registry again, if local registry was added
- julia --project=. -e 'import Pkg; Pkg.Registry.add(Pkg.RegistrySpec(url="https://github.com/JuliaRegistries/General"));'
- julia --project=. -e 'import Pkg; Pkg.instantiate()'
# paths of artifacts are relative to CI_PROJECT_DIR
- >
if [[ $CI_COMMIT_BRANCH == "main" || $CI_COMMIT_REF_NAME == "main" || $CI_COMMIT_BRANCH == "dev" || $CI_COMMIT_REF_NAME == "dev" ]]; then
# set name of the commit message from CI_COMMIT_MESSAGE to NO_MESSAGE, that the script does not read accidentally custom packages from the commit message of a merge commit
julia --project=. src/integTestGen.jl NO_MESSAGE > $CI_PROJECT_DIR/integrationjobs.yaml
else
julia --project=. src/integTestGen.jl > $CI_PROJECT_DIR/integrationjobs.yaml
fi
- cat $CI_PROJECT_DIR/integrationjobs.yaml
artifacts:
paths:
- integrationjobs.yaml
expire_in: 1 week
interruptible: true
tags:
- cpuonly

run_integration_tests:
stage: run_integration_test
trigger:
include:
- artifact: integrationjobs.yaml
job: generate_integration_tests
strategy: depend

verify-unit-test-deps_julia1.9:
image: julia:1.9
stage: verify-unit-test-deps
Expand Down
10 changes: 7 additions & 3 deletions src/four_momentum.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ struct SFourMomentum <: AbstractFourMomentum

"`z` component"
pz::Float64

pk::Float64
end

"""
Expand All @@ -40,7 +42,7 @@ The interface transforms each number-like input to float64:
$(TYPEDSIGNATURES)
"""
function SFourMomentum(t::T, x::T, y::T, z::T) where {T<:Union{Integer,Rational,Irrational}}
return SFourMomentum(float(t), x, y, z)
return SFourMomentum(float(t), x, y, z, z)
end

function similar_type(::Type{A}, ::Type{T}, ::Size{S}) where {A<:SFourMomentum,T<:Real,S}
Expand Down Expand Up @@ -82,6 +84,8 @@ mutable struct MFourMomentum <: AbstractFourMomentum

"`z` component"
pz::Float64

pk::Float64
end

"""
Expand All @@ -91,8 +95,8 @@ The interface transforms each number-like input to float64:

$(TYPEDSIGNATURES)
"""
function MFourMomentum(t::T, x::T, y::T, z::T) where {T<:Union{Integer,Rational,Irrational}}
return MFourMomentum(float(t), x, y, z)
function MFourMomentum(t::T, x::T, y::T, z::T, k::T) where {T<:Union{Integer,Rational,Irrational}}
return MFourMomentum(float(t), x, y, z, k)
end

function similar_type(::Type{A}, ::Type{T}, ::Size{S}) where {A<:MFourMomentum,T<:Real,S}
Expand Down
13 changes: 7 additions & 6 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ using QEDbase
using Test

@testset "QEDbase.jl" begin
include("dirac_tensor.jl")
include("lorentz_vector.jl")
include("lorentz_interface.jl")
@test true
# include("dirac_tensor.jl")
# include("lorentz_vector.jl")
# include("lorentz_interface.jl")

include("gamma_matrices.jl")
# include("gamma_matrices.jl")

include("particle_spinors.jl")
include("four_momentum.jl")
# include("particle_spinors.jl")
# include("four_momentum.jl")
end