Skip to content

Commit

Permalink
Merge pull request #7 from oscar-system/th/include
Browse files Browse the repository at this point in the history
Handle empty includes
benlorenz authored Mar 16, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents 3b7fa50 + 2d5ed7a commit 4fa7620
Showing 4 changed files with 119 additions and 16 deletions.
88 changes: 88 additions & 0 deletions .github/workflows/oscar-noinclude.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: OscarCI (no include block)

on:
pull_request:
branches:
- master

jobs:
generatematrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
env:
PR_NUMBER: ${{github.event.number}}
steps:
- uses: actions/[email protected]
- name: "Set up Julia"
uses: julia-actions/setup-julia@v1
with:
version: '~1.6.0-0'
- name: OscarDevTools - CI
if: github.repository == 'oscar-system/OscarDevTools.jl'
run: |
julia --project=oscar-dev -e "using Pkg;
Pkg.add(path=\".\");
Pkg.instantiate();"
- name: fetch OscarDevTools
if: github.repository != 'oscar-system/OscarDevTools.jl'
run: |
julia --project=oscar-dev -e "using Pkg;
Pkg.add(\"OscarDevTools\");
Pkg.instantiate();"
- id: set-matrix
run: |
julia --project=oscar-dev -e "using OscarDevTools.OscarCI;
ciprefs = parse_meta(\"test/meta/OscarCI-noinclude.toml\");
cimat = ci_matrix(ciprefs;
pr=${PR_NUMBER},
active_repo=\"${GITHUB_REPOSITORY}\");
@show cimat;
println(github_json(cimat));"
test-oscar:
needs: generatematrix
name: ${{ join(matrix.*.name) }} - ${{ matrix.os }}, julia ${{ matrix.julia-version}}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.julia-version == 'nightly' }}
env:
PR_NUMBER: ${{github.event.number}}
strategy:
matrix: ${{fromJSON(needs.generatematrix.outputs.matrix)}}
fail-fast: false

steps:
- uses: actions/[email protected]
- name: "Set up Julia"
uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.julia-version }}
- name: re-using OscarDevTools checkout
if: github.repository == 'oscar-system/OscarDevTools.jl'
run: |
julia --project=oscar-dev -e "using Pkg;
Pkg.add(path=\".\");
Pkg.instantiate();"
- name: fetch OscarDevTools
if: github.repository != 'oscar-system/OscarDevTools.jl'
run: |
julia --project=oscar-dev -e "using Pkg;
Pkg.add(url=\"https://github.com/oscar-system/OscarDevTools.jl\");
Pkg.instantiate();"
- name: "Set up Oscar-dev configuration"
env:
MATRIX_CONTEXT: ${{ toJSON(matrix) }}
run: |
echo "$MATRIX_CONTEXT"
julia --project=oscar-dev -e "using OscarDevTools, OscarDevTools.OscarCI;
meta = job_meta_env(\"MATRIX_CONTEXT\");
oscar_develop(job_pkgs(meta);
dir=\"oscar-dev\",
active_repo=\"${GITHUB_REPOSITORY}\");
github_env_runtests(meta;
varname=\"oscar_run_tests\",
filename=\"${GITHUB_ENV}\");"
- name: "Run tests"
run: |
echo '${{ env.oscar_run_tests }}'
julia --project=oscar-dev/project/ -e '${{ env.oscar_run_tests }}'
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "OscarDevTools"
uuid = "4f01c588-2833-446a-9dbd-6331d80acb41"
authors = ["Benjamin Lorenz <[email protected]>"]
version = "0.1.0"
version = "0.1.1"

[deps]
GitHub = "bc5e4493-9b4d-5f90-b8aa-2b2bcaad7a26"
32 changes: 17 additions & 15 deletions src/OscarCI.jl
Original file line number Diff line number Diff line change
@@ -138,23 +138,25 @@ function ci_matrix(meta::Dict{String,Any}; pr=0, fork=nothing, active_repo=nothi

# add includes for custom configurations
matrix["include"] = []
for (name,inc) in meta["include"]
named_include = Dict()
for (key,val) in inc
if key in ("os","julia-version")
named_include[key] = val
else
named_include[key] = Dict{String,Any}(
"name" => "$(pkg_parsebranch(key,val)[3])",
"branch" => val
)
named_include[key]["test"] = haskey(meta["pkgs"],key) ?
meta["pkgs"][key]["test"] : false
named_include[key]["options"] = haskey(meta["pkgs"],key) ?
meta["pkgs"][key]["testoptions"] : []
if haskey(meta, "include")
for (name,inc) in meta["include"]
named_include = Dict()
for (key,val) in inc
if key in ("os","julia-version")
named_include[key] = val
else
named_include[key] = Dict{String,Any}(
"name" => "$(pkg_parsebranch(key,val)[3])",
"branch" => val
)
named_include[key]["test"] = haskey(meta["pkgs"],key) ?
meta["pkgs"][key]["test"] : false
named_include[key]["options"] = haskey(meta["pkgs"],key) ?
meta["pkgs"][key]["testoptions"] : []
end
end
push!(matrix["include"],named_include)
end
push!(matrix["include"],named_include)
end
return matrix
end
13 changes: 13 additions & 0 deletions test/meta/OscarCI-noinclude.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
title = "metadata for oscar CI run"

# keep it small to prevent job-explosion
[env]
os = [ "ubuntu-latest" ]
julia-version = [ "~1.6.0-0" ]

# for OscarDevTools we mostly use release versions
[pkgs]
[pkgs.Oscar]
branches = [ "master" ]
test = true
testoptions = []

2 comments on commit 4fa7620

@benlorenz
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/32080

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.1 -m "<description of version>" 4fa7620f331c673c2a69aa41889161d2a469e334
git push origin v0.1.1

Please sign in to comment.