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

Parallelize CI by splitting Unit Tests and Integration Tests on different Github actions #288

Merged
merged 13 commits into from
Jan 15, 2025
Merged
10 changes: 8 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@ concurrency:
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
name: Julia ${{ matrix.version }} - ${{ matrix.test_group }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
jofrevalles marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- '1.10'
- '1.11'
test_group:
- unit
- integration
os:
- ubuntu-latest
arch:
Expand All @@ -45,13 +48,16 @@ jobs:
include-all-prereleases: true
- uses: julia-actions/cache@v1
with:
cache-name: CI - Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
cache-name: Unit Tests CI - Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
- name: Add Julia registries
run: |
using Pkg
pkg"registry add https://github.com/bsc-quantic/Registry.git"
pkg"registry add General"
shell: julia --color=yes {0}
id: run_tests
env:
TENET_TEST_GROUP: ${{matrix.test_group}}
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
Expand Down
2 changes: 2 additions & 0 deletions test/integration/Reactant_test.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using Reactant

@testset "Reactant" begin
# TODO test `make_tracer`
# TODO test `create_result`
Expand Down
63 changes: 35 additions & 28 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,41 +1,48 @@
using Test
using Tenet
using OMEinsum
using Reactant
using Adapt

include("Utils.jl")

@testset "Unit tests" verbose = true begin
include("Helpers_test.jl")
include("Tensor_test.jl")
include("Numerics_test.jl")
include("TensorNetwork_test.jl")
include("Transformations_test.jl")
include("Site_test.jl")
include("Quantum_test.jl")
include("Lattice_test.jl")
include("Ansatz_test.jl")
include("Product_test.jl")
include("MPS_test.jl")
include("MPO_test.jl")
const TENET_TEST_GROUP = lowercase(get(ENV, "TENET_TEST_GROUP", "all"))

println("Running tests for group: $TENET_TEST_GROUP")
Copy link
Member

Choose a reason for hiding this comment

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

if you use @info we can get nice colors in the logs

Suggested change
println("Running tests for group: $TENET_TEST_GROUP")
@info "Running tests for group: $TENET_TEST_GROUP"

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure! I think I will remove that, I am putting this now since I think this ENV is not properly set by CI.yml.


if TENET_TEST_GROUP == "all" || TENET_TEST_GROUP == "unit"
@testset "Unit tests" verbose = true begin
include("Helpers_test.jl")
include("Tensor_test.jl")
include("Numerics_test.jl")
include("TensorNetwork_test.jl")
include("Transformations_test.jl")
include("Site_test.jl")
include("Quantum_test.jl")
include("Lattice_test.jl")
include("Ansatz_test.jl")
include("Product_test.jl")
include("MPS_test.jl")
include("MPO_test.jl")
end
end

@testset "Integration tests" verbose = true begin
include("integration/Reactant_test.jl")
include("integration/ChainRules_test.jl")
# include("integration/BlockArray_test.jl")
include("integration/Dagger_test.jl")
include("integration/Makie_test.jl")
include("integration/KrylovKit_test.jl")
include("integration/Quac_test.jl")
include("integration/ITensors_test.jl")
include("integration/ITensorNetworks_test.jl")
if TENET_TEST_GROUP == "all" || TENET_TEST_GROUP == "integration"
@testset "Integration tests" verbose = true begin
include("integration/Reactant_test.jl")
include("integration/ChainRules_test.jl")
# include("integration/BlockArray_test.jl")
include("integration/Dagger_test.jl")
include("integration/Makie_test.jl")
include("integration/KrylovKit_test.jl")
include("integration/Quac_test.jl")
include("integration/ITensors_test.jl")
include("integration/ITensorNetworks_test.jl")

@testset "Python" begin
include("integration/python/test_quimb.jl")
include("integration/python/test_qiskit.jl")
include("integration/python/test_qibo.jl")
@testset "Python" begin
include("integration/python/test_quimb.jl")
include("integration/python/test_qiskit.jl")
include("integration/python/test_qibo.jl")
end
end
end

Expand Down
Loading