diff --git a/.ci/test_and_change_uuid.jl b/.ci/test_and_change_uuid.jl new file mode 100644 index 0000000..e108b11 --- /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 = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21" +const new_uuid = "c27032c2-a3e7-50c8-80cd-2d36dbcbfd21" + +# `@__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 884d354..214b800 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,11 +43,9 @@ jobs: ${{ runner.os }}-test-${{ env.cache-name }}- ${{ runner.os }}-test- ${{ runner.os }}- + - run: julia --color=yes .ci/test_and_change_uuid.jl - uses: julia-actions/julia-buildpkg@v1 - - name: Run tests - run: | - julia --project --color=yes -e 'using UUIDs; write("Project.toml", replace(read("Project.toml", String), r"uuid = .*?\n" =>"uuid = \"$(uuid4())\"\n"));' - julia --project --color=yes --check-bounds=yes -e 'import Pkg; Pkg.build(); Pkg.test(; coverage=true)' + - uses: julia-actions/julia-runtest@v1 - uses: julia-actions/julia-processcoverage@v1 - uses: codecov/codecov-action@v1 with: