Skip to content

Commit dba220d

Browse files
authored
Update IntegrationTest syntax (#56)
1 parent cfdb26d commit dba220d

File tree

4 files changed

+8
-20
lines changed

4 files changed

+8
-20
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ITensorPkgSkeleton"
22
uuid = "3d388ab1-018a-49f4-ae50-18094d5f71ea"
33
authors = ["ITensor developers <support@itensor.org> and contributors"]
4-
version = "0.2.6"
4+
version = "0.3.0"
55

66
[deps]
77
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"

src/ITensorPkgSkeleton.jl

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ end
9696
This processes inputs like:
9797
```julia
9898
ITensorPkgSkeleton.generate("NewPkg"; downstreampkgs=["ITensors"])
99-
ITensorPkgSkeleton.generate("NewPkg"; downstreampkgs=[(ghuser="ITensor", repo="ITensors")])
10099
```
101100
=#
102101
function format_downstreampkgs(user_replacements)
@@ -107,16 +106,8 @@ function format_downstreampkgs(user_replacements)
107106
return delete(user_replacements, :downstreampkgs)
108107
end
109108
downstreampkgs = ""
110-
for ghuser_and_or_repo in user_replacements.downstreampkgs
111-
ghuser, repo = if ghuser_and_or_repo isa AbstractString
112-
# Only the repo was passed as a standalone value.
113-
default_ghuser(), ghuser_and_or_repo
114-
else
115-
# The user and repo were passed in a NamedTuple,
116-
# or just the repo was passed in a NamedTuple.
117-
get(ghuser_and_or_repo, :ghuser, default_ghuser()), ghuser_and_or_repo.repo
118-
end
119-
downstreampkgs *= " - \'$(ghuser)/$(repo).jl\'\n"
109+
for pkg in user_replacements.downstreampkgs
110+
downstreampkgs *= " - \'$(pkg)\'\n"
120111
end
121112
# Remove extraneous trailing newline character.
122113
downstreampkgs = chop(downstreampkgs)
@@ -208,8 +199,6 @@ julia> ITensorPkgSkeleton.generate("NewPkg"; path=mktempdir(), ignore_templates=
208199
julia> ITensorPkgSkeleton.generate("NewPkg"; path=mktempdir(), ghuser="MyOrg");
209200
210201
julia> ITensorPkgSkeleton.generate("NewPkg"; path=mktempdir(), downstreampkgs=["ITensors", "ITensorMPS"]);
211-
212-
julia> ITensorPkgSkeleton.generate("NewPkg"; path=mktempdir(), downstreampkgs=[(ghuser="ITensor", repo="ITensors")]);
213202
```
214203
215204
# Arguments
@@ -221,7 +210,7 @@ julia> ITensorPkgSkeleton.generate("NewPkg"; path=mktempdir(), downstreampkgs=[(
221210
- `path::AbstractString`: Path where the package will be generated. Defaults to the [development directory](https://pkgdocs.julialang.org/v1/api/#Pkg.develop), i.e. `$(default_path())`.
222211
- `templates`: A list of templates to use. Select a subset of `ITensorPkgSkeleton.all_templates() = $(all_templates())`. Defaults to `ITensorPkgSkeleton.default_templates() = $(default_templates())`.
223212
- `ignore_templates`: A list of templates to ignore. This is the same as setting `templates=setdiff(templates, ignore_templates)`.
224-
- `downstreampkgs`: Specify the downstream packages that depend on this package. Setting this will create a workflow where the downstream tests will be run alongside the tests for this package in Github Actions to ensure that changes to your package don't break the specified downstream packages. Specify it as a list of packages, for example `["DownstreamPkg1", "DownstreamPkg2"]`, which assumes the packages are in the `$(default_ghuser())` organization. Alternatively, specify the organization with `[(ghuser="Org1", repo="DownstreamPkg1"), (ghuser="Org2", repo="DownstreamPkg2")]`; . Defaults to an empty list.
213+
- `downstreampkgs`: Specify the downstream packages that depend on this package. Setting this will create a workflow where the downstream tests will be run alongside the tests for this package in Github Actions to ensure that changes to your package don't break the specified downstream packages. Defaults to an empty list.
225214
- `uuid`: Replaces `{UUID}` in the template. Defaults to the existing UUID in the `Project.toml` if the path points to an existing package, otherwise generates one randomly with `UUIDs.uuid4()`.
226215
- `year`: Replaces `{YEAR}` in the template. Year the package/repository was created. Defaults to the current year.
227216
"""

templates/downstreampkgs/.github/workflows/IntegrationTest.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ jobs:
1616
name: "IntegrationTest"
1717
strategy:
1818
matrix:
19-
repo:
19+
pkg:
2020
{DOWNSTREAMPKGS}
2121
uses: "ITensor/ITensorActions/.github/workflows/IntegrationTest.yml@main"
2222
with:
2323
localregistry: "https://github.com/ITensor/ITensorRegistry.git"
24-
repo: "${{ matrix.repo }}"
24+
pkg: "${{ matrix.pkg }}"

test/test_basics.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ using Test: @test, @testset
2424
end
2525
@testset "generate with downstream tests" begin
2626
for templates in (ITensorPkgSkeleton.default_templates(), [])
27-
for (downstreampkgs, ghuser) in
28-
((["DownstreamPkg"], "ITensor"), ([(ghuser="Org", repo="DownstreamPkg")], "Org"))
27+
for downstreampkgs in (["DownstreamPkg"],)
2928
path = mktempdir()
3029
ITensorPkgSkeleton.generate("NewPkg"; path, templates, downstreampkgs)
3130
@test isdir(joinpath(path, "NewPkg"))
@@ -36,7 +35,7 @@ using Test: @test, @testset
3635
@test open(
3736
joinpath(path, "NewPkg", ".github", "workflows", "IntegrationTest.yml"), "r"
3837
) do io
39-
return contains(read(io, String), "- '$(ghuser)/DownstreamPkg.jl'")
38+
return contains(read(io, String), "- 'DownstreamPkg'")
4039
end
4140
for dir in setdiff(pkgdirs, [".github", ".github/workflows"])
4241
@test isdir(joinpath(path, "NewPkg", dir)) == !isempty(templates)

0 commit comments

Comments
 (0)