Skip to content

Commit b8b6215

Browse files
authored
Merge pull request #172 from JuliaAstro/reorg-ci-project
Reorg CI + project
2 parents c09037a + 5ec3dd6 commit b8b6215

File tree

11 files changed

+130
-58
lines changed

11 files changed

+130
-58
lines changed

.github/workflows/CI.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
name: Test JuliaAstro
1+
name: CI
22

33
on:
4-
push:
5-
branches: [main]
6-
pull_request:
7-
schedule:
8-
- cron: '15 2 * * *' # 2:15 AM UTC every day
4+
workflow_call:
5+
inputs:
6+
test_args:
7+
required: true
8+
type: string
9+
910
jobs:
1011
test:
1112
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
@@ -32,4 +33,5 @@ jobs:
3233
- uses: julia-actions/julia-buildpkg@v1
3334
- uses: julia-actions/julia-runtest@v1
3435
with:
35-
coverage: false
36+
test_args: ${{ inputs.test_args }}
37+
coverage: false

.github/workflows/CI_dev.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Test JuliaAstro (dev)
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
schedule:
8+
- cron: '15 2 * * *' # 2:15 AM UTC every day
9+
10+
jobs:
11+
test-dev:
12+
uses: ./.github/workflows/CI.yml
13+
with:
14+
test_args: "--verbose packages_dev"

.github/workflows/CI_release.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Test JuliaAstro (release)
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
schedule:
8+
- cron: '15 2 * * 1' # 2:15 AM UTC every Monday
9+
10+
jobs:
11+
test-release:
12+
uses: ./.github/workflows/CI.yml
13+
with:
14+
test_args: "--verbose packages_release"

Project.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name = "JuliaAstroDocs"
22
uuid = "5ba9df79-bc07-467f-bade-66a1d49082bd"
33

4+
[workspace]
5+
projects = ["test", "docs"]
6+
47
[deps]
58
TypedTables = "9d95f2ec-7b3d-5a63-8d20-e2491e220bb9"
69

README.md

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ JuliaAstro.github.io
44
[![docs](https://img.shields.io/badge/docs-stable-blue.svg)](https://juliaastro.org/)
55
[![Build](https://github.com/JuliaAstro/JuliaAstro.github.io/actions/workflows/Documentation.yml/badge.svg)](https://github.com/JuliaAstro/JuliaAstro.github.io/actions/workflows/Documentation.yml)
66
[![Deploy](https://github.com/JuliaAstro/JuliaAstro.github.io/actions/workflows/pages/pages-build-deployment/badge.svg?branch=gh-pages)](https://github.com/JuliaAstro/JuliaAstro.github.io/actions/workflows/pages/pages-build-deployment)
7-
[![Test JuliaAstro](https://github.com/JuliaAstro/JuliaAstro.github.io/actions/workflows/CI.yml/badge.svg)](https://github.com/JuliaAstro/JuliaAstro.github.io/actions/workflows/CI.yml)
7+
8+
[![Test JuliaAstro (release)](https://github.com/JuliaAstro/JuliaAstro.github.io/actions/workflows/CI_release.yml/badge.svg)](https://github.com/JuliaAstro/JuliaAstro.github.io/actions/workflows/CI_release.yml)
9+
[![Test JuliaAstro (dev)](https://github.com/JuliaAstro/JuliaAstro.github.io/actions/workflows/CI_dev.yml/badge.svg)](https://github.com/JuliaAstro/JuliaAstro.github.io/actions/workflows/CI_dev.yml)
810

911
## Description
1012

@@ -98,12 +100,14 @@ All in all, to add a new case study:
98100
1. Update the content in the new file with your case study text.
99101
1. Add an entry to `JuliaAstro.github.io/docs/case_studies/<case study category>/config.json` with your new case study filename. Note that trailing commas are not supported in the JSON spec.
100102

101-
## Testing locally / developer docs
103+
## Developer docs
104+
105+
### Documentation
102106

103107
Add [LiveServer.jl](https://github.com/JuliaDocs/LiveServer.jl) to your global env and then run the following in the `JuliaAstro.github.io/` folder:
104108

105109
```julia-repl
106-
> julia --proj=docs/
110+
julia --proj=docs/
107111
108112
julia> using LiveServer
109113
@@ -117,3 +121,24 @@ The `include_dirs` arg allows our internal Revise worklow to pick up changes in
117121
118122
See our [Contributing page](https://juliaastro.org/home/#Contributing) for more.
119123

124+
### Testing
125+
126+
Run all tests:
127+
128+
```julia-repl
129+
julia --proj
130+
131+
julia> ]
132+
133+
pkg> test
134+
```
135+
136+
Run specific tests (currently `packages_release` and `packages_dev`):
137+
138+
```julia-repl
139+
julia --proj
140+
141+
julia> import Pkg
142+
143+
julia> Pkg.test("JuliaAstroDocs"; test_args=`--verbose packages_release`) # or packages_dev
144+
```

docs/Project.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ MultiDocumenter = "87ed4bf0-c935-4a67-83c3-2a03bee4197c"
88
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
99

1010
[sources]
11-
JuliaAstroDocs = {path = ".."}
1211
MultiDocumenter = {url = "https://github.com/JuliaComputing/MultiDocumenter.jl"}
1312

1413
[compat]

test/Project.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
[deps]
22
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
33
JuliaAstroDocs = "5ba9df79-bc07-467f-bade-66a1d49082bd"
4+
ParallelTestRunner = "d3525ed8-44d0-4b2c-a655-542cee43accc"
45
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
56
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
6-
7-
[sources]
8-
JuliaAstroDocs = {path = ".."}

test/_packages.jl

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
function test_packages(mode)
2+
@testset "Compatibility - $(mode)" begin
3+
for package in packages_juliaastro
4+
p_name = package.name
5+
@info string("Adding: ", p_name)
6+
@testset "$(p_name)" begin
7+
if mode == :release
8+
if p_name == "Spectra.jl"
9+
# TODO: Register
10+
@test Pkg.add(url="https://github.com/JuliaAstro/Spectra.jl") == nothing
11+
else
12+
@test Pkg.add(chopsuffix(p_name, ".jl")) == nothing
13+
end
14+
elseif mode == :dev
15+
@test Pkg.add(url=package.repo) == nothing
16+
else
17+
throw(ArgumentError("`mode` argument to `test_packages` must be either `:release` or `:dev`."))
18+
end
19+
end
20+
end
21+
22+
@testset "Precompilation" begin
23+
@test Pkg.precompile(; strict=true) == nothing
24+
end
25+
26+
@testset "Package loading" begin
27+
for package in packages_juliaastro
28+
p_name = package.name
29+
@info string("Loading: ", p_name)
30+
@testset "$(p_name)" begin
31+
@test eval(quote
32+
@time_imports using $(Symbol(chopsuffix(p_name, ".jl")))
33+
end) == nothing
34+
end
35+
end
36+
end
37+
end
38+
end

test/packages_dev.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
include("_packages.jl")
2+
3+
test_packages(:dev)

test/packages_release.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
include("_packages.jl")
2+
3+
test_packages(:release)

0 commit comments

Comments
 (0)