diff --git a/.ci/change-uuid.jl b/.ci/change-uuid.jl deleted file mode 100644 index 45f529f..0000000 --- a/.ci/change-uuid.jl +++ /dev/null @@ -1,5 +0,0 @@ -using UUIDs - -project_filename = joinpath(dirname(@__DIR__), "Project.toml") - -write("Project.toml", replace(read("Project.toml", String), r"uuid = .*?\n" =>"uuid = \"$(uuid4())\"\n")) diff --git a/.ci/test_and_change_uuid.jl b/.ci/test_and_change_uuid.jl new file mode 100644 index 0000000..2175e52 --- /dev/null +++ b/.ci/test_and_change_uuid.jl @@ -0,0 +1,28 @@ +@static if Base.VERSION >= v"1.6" + using TOML + using Test +else + using Pkg: TOML + using Test +end + +# To generate the new UUID, we simply modify the first character of the original UUID +const original_uuid = "4607b0f0-06f3-5cda-b6b1-a6196a1729e9" +const new_uuid = "5607b0f0-06f3-5cda-b6b1-a6196a1729e9" + +# `@__DIR__` is the `.ci/` folder. +# Therefore, `dirname(@__DIR__)` is the repository root. +const project_filename = joinpath(dirname(@__DIR__), "Project.toml") + +@testset "Test that the UUID is unchanged" begin + project_dict = TOML.parsefile(project_filename) + @test project_dict["uuid"] == original_uuid +end + +write( + project_filename, + replace( + read(project_filename, String), + r"uuid = .*?\n" => "uuid = \"$(new_uuid)\"\n", + ), +) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d405621..8271df9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,8 +45,7 @@ jobs: ${{ runner.os }}-test-${{ env.cache-name }}- ${{ runner.os }}-test-${{ matrix.os }} ${{ runner.os }}- - - run: julia --color=yes test/suitesparse_uuid.jl - - run: julia --color=yes .ci/change-uuid.jl + - run: julia --color=yes .ci/test_and_change_uuid.jl - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 - uses: julia-actions/julia-processcoverage@v1 diff --git a/test/suitesparse_uuid.jl b/test/suitesparse_uuid.jl deleted file mode 100644 index a0bf14e..0000000 --- a/test/suitesparse_uuid.jl +++ /dev/null @@ -1,10 +0,0 @@ -using Pkg -using Test - -@testset "SuiteSparse UUID" begin - project_filename = joinpath(dirname(@__DIR__), "Project.toml") - project = Pkg.TOML.parsefile(project_filename) - uuid = project["uuid"] - correct_uuid = "4607b0f0-06f3-5cda-b6b1-a6196a1729e9" - @test uuid == correct_uuid -end