Skip to content

Commit

Permalink
CI: Standardize the workflow for testing and changing the UUID (Julia…
Browse files Browse the repository at this point in the history
  • Loading branch information
DilumAluthge authored Jun 7, 2021
1 parent 21843d0 commit cd002c3
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 17 deletions.
5 changes: 0 additions & 5 deletions .ci/change_uuid.jl

This file was deleted.

28 changes: 28 additions & 0 deletions .ci/test_and_change_uuid.jl
Original file line number Diff line number Diff line change
@@ -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 = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
const new_uuid = "e43a241f-c20a-4ad4-852c-f6b1247861c6"

# `@__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",
),
)
10 changes: 0 additions & 10 deletions .ci/test_uuid_is_unchanged.jl

This file was deleted.

3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ jobs:
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-${{ matrix.os }}
${{ runner.os }}-
- run: julia --color=yes .ci/test_uuid_is_unchanged.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
Expand Down

0 comments on commit cd002c3

Please sign in to comment.