diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index 1b143b01..89578c7c 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -1,10 +1,9 @@ -name: Tests +name: CI + on: push: branches: - - 'master' - 'main' - - 'release-' tags: '*' paths-ignore: - 'docs/**' @@ -14,71 +13,15 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.ref }} - # Cancel intermediate builds: only if it is a pull request build. cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} -jobs: - setup-matrix: - runs-on: ubuntu-latest - outputs: - groups: ${{ steps.mk.outputs.groups }} - version: ${{ steps.mk.outputs.version }} - os: ${{ steps.mk.outputs.os }} - steps: - - uses: actions/checkout@v6 - - id: mk - shell: bash - run: | - # Auto-discover test groups from all subdirectory names. - groups=$(find test -mindepth 1 -maxdepth 1 -type d \ - | xargs -I{} basename {} | sort \ - | jq -R -s -c '[split("\n")[] | select(length > 0) | select(.!= "testsuite")]') - - echo "groups=${groups}" >> "$GITHUB_OUTPUT" - # Draft PR: only run ubuntu-latest + version=1 - if [[ "${{ github.event_name }}" == "pull_request" && "${{ github.event.pull_request.draft }}" == "true" ]]; then - echo 'version=["1"]' >> "$GITHUB_OUTPUT" - echo 'os=["ubuntu-latest"]' >> "$GITHUB_OUTPUT" - else - echo 'version=["min","1"]' >> "$GITHUB_OUTPUT" - echo 'os=["ubuntu-latest","macOS-latest","windows-latest"]' >> "$GITHUB_OUTPUT" - fi - - test: - name: "Tests (${{ matrix.group }}, ${{ matrix.os }}, Julia ${{ matrix.version }})" - needs: setup-matrix - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup-matrix.outputs.version) }} - os: ${{ fromJSON(needs.setup-matrix.outputs.os) }} - group: ${{ fromJSON(needs.setup-matrix.outputs.groups) }} - exclude: - - os: macos-latest - version: 1 - group: enzyme - - os: macos-latest - version: "min" - group: enzyme - runs-on: ${{ matrix.os }} - timeout-minutes: 120 - steps: - - uses: actions/checkout@v6 - - uses: julia-actions/setup-julia@v3 - with: - version: ${{ matrix.version }} - - uses: julia-actions/cache@v3 - - uses: julia-actions/julia-buildpkg@v1 - - uses: julia-actions/julia-runtest@v1 - with: - test_args: '${{ matrix.group }}${{ github.event.pull_request.draft == true && '' --fast'' || '''' }}' - env: - JULIA_NUM_THREADS: "4" - - uses: julia-actions/julia-processcoverage@v1 - with: - directories: 'src,ext' - - uses: codecov/codecov-action@v6 - with: - files: lcov.info - token: ${{ secrets.CODECOV_TOKEN }} - fail_ci_if_error: false +jobs: + tests: + name: "Tests" + uses: "QuantumKitHub/QuantumKitHubActions/.github/workflows/TestGroups.yml@main" + with: + fast: "${{ github.event.pull_request.draft == true }}" + exclude: '["testsuite"]' + timeout-minutes: 120 + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/test/decompositions/eig.jl b/test/decompositions/eig.jl index 6c6636e6..b07551bb 100644 --- a/test/decompositions/eig.jl +++ b/test/decompositions/eig.jl @@ -6,8 +6,13 @@ using LinearAlgebra: Diagonal using MatrixAlgebraKit: TruncatedAlgorithm, diagview, norm, GS using CUDA, AMDGPU -BLASFloats = (Float32, Float64, ComplexF32, ComplexF64) -GenericFloats = (BigFloat, Complex{BigFloat}) +if @isdefined(fast_tests) && fast_tests + BLASFloats = (Float64, ComplexF64) + GenericFloats = (BigFloat, Complex{BigFloat}) +else + BLASFloats = (Float32, Float64, ComplexF32, ComplexF64) + GenericFloats = (BigFloat, Complex{BigFloat}) +end @isdefined(TestSuite) || include("../testsuite/TestSuite.jl") using .TestSuite diff --git a/test/decompositions/eigh.jl b/test/decompositions/eigh.jl index 0181e481..2f7bf9a4 100644 --- a/test/decompositions/eigh.jl +++ b/test/decompositions/eigh.jl @@ -5,8 +5,13 @@ using StableRNGs using LinearAlgebra: LinearAlgebra, Diagonal, I using CUDA, AMDGPU -BLASFloats = (Float32, Float64, ComplexF32, ComplexF64) -GenericFloats = (BigFloat, Complex{BigFloat}) +if @isdefined(fast_tests) && fast_tests + BLASFloats = (Float64, ComplexF64) + GenericFloats = (BigFloat, Complex{BigFloat}) +else + BLASFloats = (Float32, Float64, ComplexF32, ComplexF64) + GenericFloats = (BigFloat, Complex{BigFloat}) +end @isdefined(TestSuite) || include("../testsuite/TestSuite.jl") using .TestSuite diff --git a/test/decompositions/gen_eig.jl b/test/decompositions/gen_eig.jl index 8f905b77..8485c574 100644 --- a/test/decompositions/gen_eig.jl +++ b/test/decompositions/gen_eig.jl @@ -4,7 +4,13 @@ using TestExtras using StableRNGs using LinearAlgebra: Diagonal -@testset "gen_eig_full! for T = $T" for T in (Float32, Float64, ComplexF32, ComplexF64) +if @isdefined(fast_tests) && fast_tests + BLASFloats = (Float64, ComplexF64) +else + BLASFloats = (Float32, Float64, ComplexF32, ComplexF64) +end + +@testset "gen_eig_full! for T = $T" for T in BLASFloats rng = StableRNG(123) m = 54 for alg in (LAPACK_Simple(), :LAPACK_Simple, LAPACK_Simple) diff --git a/test/decompositions/lq.jl b/test/decompositions/lq.jl index ce38f42f..c5c2f047 100644 --- a/test/decompositions/lq.jl +++ b/test/decompositions/lq.jl @@ -6,8 +6,13 @@ using LinearAlgebra: diag, I, Diagonal using MatrixAlgebraKit: LQViaTransposedQR, LAPACK_HouseholderLQ using CUDA, AMDGPU, GenericLinearAlgebra -BLASFloats = (Float32, Float64, ComplexF32, ComplexF64) -GenericFloats = (Float16, BigFloat, Complex{BigFloat}) +if @isdefined(fast_tests) && fast_tests + BLASFloats = (Float64, ComplexF64) + GenericFloats = (Float16, Complex{BigFloat}) +else + BLASFloats = (Float32, Float64, ComplexF32, ComplexF64) + GenericFloats = (Float16, BigFloat, Complex{BigFloat}) +end @isdefined(TestSuite) || include("../testsuite/TestSuite.jl") using .TestSuite diff --git a/test/decompositions/orthnull.jl b/test/decompositions/orthnull.jl index 6d37dba1..594f0a39 100644 --- a/test/decompositions/orthnull.jl +++ b/test/decompositions/orthnull.jl @@ -5,8 +5,13 @@ using StableRNGs using LinearAlgebra: LinearAlgebra, I, Diagonal using CUDA, AMDGPU -BLASFloats = (Float32, Float64, ComplexF32, ComplexF64) -GenericFloats = (BigFloat, Complex{BigFloat}) +if @isdefined(fast_tests) && fast_tests + BLASFloats = (Float64, ComplexF64) + GenericFloats = (BigFloat, Complex{BigFloat}) +else + BLASFloats = (Float32, Float64, ComplexF32, ComplexF64) + GenericFloats = (BigFloat, Complex{BigFloat}) +end @isdefined(TestSuite) || include("../testsuite/TestSuite.jl") using .TestSuite diff --git a/test/decompositions/polar.jl b/test/decompositions/polar.jl index a259386e..d70f71b6 100644 --- a/test/decompositions/polar.jl +++ b/test/decompositions/polar.jl @@ -4,8 +4,13 @@ using StableRNGs using LinearAlgebra: Diagonal, LAPACK using CUDA, AMDGPU -BLASFloats = (Float32, Float64, ComplexF32, ComplexF64) -GenericFloats = (BigFloat, Complex{BigFloat}) +if @isdefined(fast_tests) && fast_tests + BLASFloats = (Float64, ComplexF64) + GenericFloats = (BigFloat, Complex{BigFloat}) +else + BLASFloats = (Float32, Float64, ComplexF32, ComplexF64) + GenericFloats = (BigFloat, Complex{BigFloat}) +end @isdefined(TestSuite) || include("../testsuite/TestSuite.jl") using .TestSuite diff --git a/test/decompositions/qr.jl b/test/decompositions/qr.jl index 3a7c2f86..666d641c 100644 --- a/test/decompositions/qr.jl +++ b/test/decompositions/qr.jl @@ -5,8 +5,13 @@ using StableRNGs using LinearAlgebra: diag, I, Diagonal using CUDA, AMDGPU, GenericLinearAlgebra -BLASFloats = (Float32, Float64, ComplexF32, ComplexF64) -GenericFloats = (Float16, BigFloat, Complex{BigFloat}) +if @isdefined(fast_tests) && fast_tests + BLASFloats = (Float64, ComplexF64) + GenericFloats = (Float16, Complex{BigFloat}) +else + BLASFloats = (Float32, Float64, ComplexF32, ComplexF64) + GenericFloats = (Float16, BigFloat, Complex{BigFloat}) +end @isdefined(TestSuite) || include("../testsuite/TestSuite.jl") using .TestSuite diff --git a/test/decompositions/schur.jl b/test/decompositions/schur.jl index ec879314..c8d93664 100644 --- a/test/decompositions/schur.jl +++ b/test/decompositions/schur.jl @@ -4,8 +4,13 @@ using TestExtras using StableRNGs using LinearAlgebra: I, Diagonal -BLASFloats = (Float32, Float64, ComplexF32, ComplexF64) -GenericFloats = (BigFloat, Complex{BigFloat}) +if @isdefined(fast_tests) && fast_tests + BLASFloats = (Float64, ComplexF64) + GenericFloats = (BigFloat, Complex{BigFloat}) +else + BLASFloats = (Float32, Float64, ComplexF32, ComplexF64) + GenericFloats = (BigFloat, Complex{BigFloat}) +end @isdefined(TestSuite) || include("../testsuite/TestSuite.jl") using .TestSuite diff --git a/test/decompositions/svd.jl b/test/decompositions/svd.jl index 8cf34d83..c69ed3a0 100644 --- a/test/decompositions/svd.jl +++ b/test/decompositions/svd.jl @@ -2,8 +2,13 @@ using MatrixAlgebraKit using LinearAlgebra: Diagonal using CUDA, AMDGPU -BLASFloats = (Float32, Float64, ComplexF32, ComplexF64) -GenericFloats = (BigFloat, Complex{BigFloat}) +if @isdefined(fast_tests) && fast_tests + BLASFloats = (Float64, ComplexF64) + GenericFloats = (BigFloat, Complex{BigFloat}) +else + BLASFloats = (Float32, Float64, ComplexF32, ComplexF64) + GenericFloats = (BigFloat, Complex{BigFloat}) +end @isdefined(TestSuite) || include("../testsuite/TestSuite.jl") using .TestSuite diff --git a/test/runtests.jl b/test/runtests.jl index 95e43137..cc2b4b1d 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -12,7 +12,10 @@ delete!(testsuite, "utilities") delete!(testsuite, "linearmap") # Parse arguments -args = parse_args(ARGS) +args = parse_args(ARGS; custom = ["fast"]) + +fast = !isnothing(args.custom["fast"]) +fast && @info "Selected fast tests" if filter_tests!(testsuite, args) # don't run all tests on GPU, only the GPU specific ones @@ -25,13 +28,13 @@ if filter_tests!(testsuite, args) delete!(testsuite, "codequality") else is_apple_ci = Sys.isapple() && get(ENV, "CI", "false") == "true" - is_windows_ci = Sys.isapple() && get(ENV, "CI", "false") == "true" + is_windows_ci = Sys.iswindows() && get(ENV, "CI", "false") == "true" if is_apple_ci filter!(p -> !startswith(first(p), "mooncake/"), testsuite) - delete!(testsuite, "chainrules") + filter!(p -> !startswith(first(p), "chainrules/"), testsuite) end (is_windows_ci || is_apple_ci) && filter!(p -> !startswith(first(p), "enzyme/"), testsuite) end end -runtests(MatrixAlgebraKit, args; testsuite) +runtests(MatrixAlgebraKit, args; testsuite, init_code = :(const fast_tests = $fast))