Skip to content

Commit 7791be4

Browse files
Add comprehensive test suite with CI integration and optimized environment variables
- Updated .github/workflows/CI_1.10.yml: Full test suite integration with dual coverage reporting - Updated .github/workflows/CI_1.11.yml: Mirror of 1.10 with comprehensive CI features - Removed unused environment variables: MERA_SKIP_EXPERIMENTAL, MERA_ADVANCED_HISTOGRAM - Added optimized environment variables: MERA_CI_MODE, MERA_TEST_TIMEOUT, MERA_DOWNLOAD_RETRIES - Cross-platform testing (Ubuntu + macOS) with fail-fast disabled for robustness - Dual coverage reporting to Codecov.io and Coveralls.io - Robust test data download with CI-aware fallback handling
1 parent a6ec0a1 commit 7791be4

File tree

7 files changed

+523
-225
lines changed

7 files changed

+523
-225
lines changed

.github/workflows/CI_1.10.yml

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ jobs:
1212
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
1313
runs-on: ${{ matrix.os }}
1414
strategy:
15+
fail-fast: false
1516
matrix:
1617
version:
1718
- '1.10'
@@ -21,29 +22,54 @@ jobs:
2122
arch:
2223
- x64
2324
steps:
24-
- uses: actions/checkout@v4
25-
- uses: julia-actions/setup-julia@v2
25+
- name: Checkout code
26+
uses: actions/checkout@v4
27+
28+
- name: Setup Julia
29+
uses: julia-actions/setup-julia@v2
2630
with:
2731
version: ${{ matrix.version }}
2832
arch: ${{ matrix.arch }}
29-
- uses: julia-actions/cache@v2
33+
34+
- name: Cache Julia packages
35+
uses: julia-actions/cache@v2
3036

31-
- name: Set single-threaded environment
37+
- name: Set CI environment variables
3238
run: |
3339
echo "JULIA_NUM_THREADS=1" >> $GITHUB_ENV
3440
echo "MERA_CI_MODE=true" >> $GITHUB_ENV
35-
echo "MERA_SKIP_EXPERIMENTAL=true" >> $GITHUB_ENV
36-
echo "MERA_ADVANCED_HISTOGRAM=false" >> $GITHUB_ENV
41+
echo "MERA_TEST_TIMEOUT=1800" >> $GITHUB_ENV
42+
echo "MERA_DOWNLOAD_RETRIES=3" >> $GITHUB_ENV
3743
3844
- name: Build package
3945
uses: julia-actions/julia-buildpkg@v1
4046

41-
- name: Run CI-compatible tests
47+
- name: Run comprehensive test suite
4248
uses: julia-actions/julia-runtest@v1
4349
with:
50+
coverage: true
4451
test_args: '--threads=1'
4552
env:
4653
JULIA_NUM_THREADS: 1
4754
MERA_CI_MODE: true
48-
MERA_SKIP_EXPERIMENTAL: true
49-
MERA_ADVANCED_HISTOGRAM: false
55+
MERA_TEST_TIMEOUT: 1800
56+
MERA_DOWNLOAD_RETRIES: 3
57+
58+
- name: Process coverage
59+
uses: julia-actions/julia-processcoverage@v1
60+
if: matrix.version == '1.10' && matrix.os == 'ubuntu-latest'
61+
62+
- name: Upload coverage to Codecov
63+
uses: codecov/codecov-action@v4
64+
if: matrix.version == '1.10' && matrix.os == 'ubuntu-latest'
65+
with:
66+
files: lcov.info
67+
token: ${{ secrets.CODECOV_TOKEN }}
68+
fail_ci_if_error: false
69+
verbose: true
70+
71+
- name: Upload coverage to Coveralls
72+
uses: julia-actions/julia-uploadcoveralls@v1
73+
if: matrix.version == '1.10' && matrix.os == 'ubuntu-latest'
74+
env:
75+
COVERALLS_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}

.github/workflows/CI_1.11.yml

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ jobs:
1212
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
1313
runs-on: ${{ matrix.os }}
1414
strategy:
15+
fail-fast: false
1516
matrix:
1617
version:
1718
- '1.11'
@@ -21,43 +22,54 @@ jobs:
2122
arch:
2223
- x64
2324
steps:
24-
- uses: actions/checkout@v4
25-
- uses: julia-actions/setup-julia@v2
25+
- name: Checkout code
26+
uses: actions/checkout@v4
27+
28+
- name: Setup Julia
29+
uses: julia-actions/setup-julia@v2
2630
with:
2731
version: ${{ matrix.version }}
2832
arch: ${{ matrix.arch }}
29-
- uses: julia-actions/cache@v2
33+
34+
- name: Cache Julia packages
35+
uses: julia-actions/cache@v2
3036

31-
- name: Set single-threaded environment
37+
- name: Set CI environment variables
3238
run: |
3339
echo "JULIA_NUM_THREADS=1" >> $GITHUB_ENV
3440
echo "MERA_CI_MODE=true" >> $GITHUB_ENV
35-
echo "MERA_SKIP_EXPERIMENTAL=true" >> $GITHUB_ENV
36-
echo "MERA_ADVANCED_HISTOGRAM=false" >> $GITHUB_ENV
41+
echo "MERA_TEST_TIMEOUT=1800" >> $GITHUB_ENV
42+
echo "MERA_DOWNLOAD_RETRIES=3" >> $GITHUB_ENV
3743
3844
- name: Build package
3945
uses: julia-actions/julia-buildpkg@v1
40-
41-
- name: Run CI-compatible tests
46+
47+
- name: Run comprehensive test suite
4248
uses: julia-actions/julia-runtest@v1
4349
with:
50+
coverage: true
4451
test_args: '--threads=1'
4552
env:
4653
JULIA_NUM_THREADS: 1
4754
MERA_CI_MODE: true
48-
MERA_SKIP_EXPERIMENTAL: true
49-
MERA_ADVANCED_HISTOGRAM: false
55+
MERA_TEST_TIMEOUT: 1800
56+
MERA_DOWNLOAD_RETRIES: 3
5057

51-
- uses: julia-actions/julia-processcoverage@v1
58+
- name: Process coverage
59+
uses: julia-actions/julia-processcoverage@v1
5260
if: matrix.version == '1.11' && matrix.os == 'ubuntu-latest'
5361

54-
- uses: codecov/codecov-action@v4
62+
- name: Upload coverage to Codecov
63+
uses: codecov/codecov-action@v4
5564
if: matrix.version == '1.11' && matrix.os == 'ubuntu-latest'
5665
with:
5766
files: lcov.info
5867
token: ${{ secrets.CODECOV_TOKEN }}
5968
fail_ci_if_error: false
60-
- uses: julia-actions/julia-uploadcoveralls@v1
69+
verbose: true
70+
71+
- name: Upload coverage to Coveralls
72+
uses: julia-actions/julia-uploadcoveralls@v1
6173
if: matrix.version == '1.11' && matrix.os == 'ubuntu-latest'
6274
env:
6375
COVERALLS_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}

Project.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ TranscodingStreams = "3bb67fe8-82b1-5028-8e26-92a6c54297fa"
3333
WAV = "8149f6b0-98f6-5db9-b78f-408fbbb8ef88"
3434
WriteVTK = "64499a7a-5c06-52f2-abe2-ccb03c286192"
3535

36+
[extras]
37+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
38+
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
39+
Tar = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e"
40+
41+
[targets]
42+
test = ["Test", "Downloads", "Tar"]
43+
3644
[compat]
3745
CSV = "= 0.10.15"
3846
CodecBzip2 = "= 0.8.5"
@@ -55,3 +63,6 @@ TimerOutputs = "= 0.5.29"
5563
WAV = "= 1.2.0"
5664
WriteVTK = "1.21.2"
5765
julia = "1.10"
66+
Test = "1"
67+
Downloads = "1"
68+
Tar = "1"

test/Project.toml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
name = "MeraTests"
2+
version = "0.1.0"
3+
14
[deps]
5+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
26
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
3-
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
47
Tar = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e"
5-
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
8+
9+
[compat]
10+
julia = "1.10"

test/basic_module_tests.jl

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Basic Module Loading Tests for Mera.jl
2+
# Tests core module functionality and imports
3+
4+
using Test
5+
6+
# Add parent directory to path to find Mera
7+
parent_dir = dirname(@__DIR__)
8+
if !(parent_dir in LOAD_PATH)
9+
pushfirst!(LOAD_PATH, parent_dir)
10+
end
11+
12+
# Load Mera at the top level
13+
using Mera
14+
15+
function run_basic_module_tests()
16+
17+
@testset "Core Module Loading" begin
18+
@testset "Mera Module Import" begin
19+
# Test that module is loaded
20+
@test Mera isa Module
21+
@test isdefined(Main, :Mera)
22+
println("✓ Mera module loaded successfully")
23+
end
24+
25+
@testset "Core Functions Available" begin
26+
# Test that main functions are available after import
27+
@test isdefined(Mera, :getinfo)
28+
@test isdefined(Mera, :gethydro)
29+
@test isdefined(Mera, :getgravity)
30+
@test isdefined(Mera, :getparticles)
31+
@test isdefined(Mera, :getvar)
32+
@test isdefined(Mera, :projection)
33+
println("✓ Core functions are available")
34+
end
35+
36+
@testset "Type Definitions Available" begin
37+
# Test that core types are defined
38+
@test isdefined(Mera, :InfoType)
39+
@test isdefined(Mera, :HydroDataType)
40+
@test isdefined(Mera, :GravDataType)
41+
@test isdefined(Mera, :PartDataType)
42+
@test isdefined(Mera, :ClumpDataType)
43+
@test isdefined(Mera, :HydroMapsType)
44+
@test isdefined(Mera, :ScalesType001)
45+
println("✓ Core data types are available")
46+
end
47+
48+
@testset "Constants and Scales" begin
49+
# Test that physical constants are available
50+
@test isdefined(Mera, :createscales)
51+
@test isdefined(Mera, :humanize)
52+
println("✓ Constants and scale functions are available")
53+
end
54+
end
55+
56+
@testset "Function Type Validation" begin
57+
@testset "Core Function Types" begin
58+
# Verify functions are callable
59+
@test isa(Mera.getinfo, Function)
60+
@test isa(Mera.gethydro, Function)
61+
@test isa(Mera.getgravity, Function)
62+
@test isa(Mera.getparticles, Function)
63+
@test isa(Mera.getvar, Function)
64+
@test isa(Mera.projection, Function)
65+
println("✓ Core functions are callable")
66+
end
67+
68+
@testset "Utility Function Types" begin
69+
@test isa(Mera.createscales, Function)
70+
@test isa(Mera.humanize, Function)
71+
@test isa(Mera.viewmodule, Function)
72+
println("✓ Utility functions are callable")
73+
end
74+
end
75+
76+
@testset "Help and Documentation" begin
77+
@testset "Help Functions Available" begin
78+
# Test help system works
79+
@test_nowarn Mera.getvar() # Should show help
80+
println("✓ Help system is functional")
81+
end
82+
83+
@testset "Module Documentation" begin
84+
# Test that main module exports work
85+
module_list = Mera.viewmodule(Mera)
86+
@test isa(module_list, Vector)
87+
@test length(module_list) > 10 # Should have many exported symbols
88+
println("✓ Module exports $(length(module_list)) symbols")
89+
end
90+
end
91+
92+
end

0 commit comments

Comments
 (0)