Merge branch 'add-ci' into 'main'

Add CI

See merge request wotsubo/PSBoardDataBase!1
This commit is contained in:
Wataru Otsubo 2024-09-13 12:42:36 +02:00
commit d7b1b08f3b
7 changed files with 108 additions and 13 deletions

43
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,43 @@
.script:
script:
- |
julia --project=@. -e '
using Pkg
Pkg.build()
Pkg.test(coverage=true)'
.coverage:
coverage: /Test coverage (\d+\.\d+%)/
after_script:
- |
julia -e '
using Pkg
Pkg.add("Coverage")
using Coverage
c, t = get_summary(process_folder())
using Printf
@printf "Test coverage %.2f%%\n" 100c / t'
Julia 1.10:
image: julia:1.10
extends:
- .script
- .coverage
pages:
image: julia:1.10
stage: deploy
script:
- |
julia --project=docs -e '
using Pkg
Pkg.develop(PackageSpec(path=pwd()))
Pkg.instantiate()
using Documenter: doctest
using PSBoardDataBase
doctest(PSBoardDataBase)
include("docs/make.jl")'
- mkdir -p public
- mv docs/build public/dev
artifacts:
paths:
- public
only:
- main

View file

@ -1,6 +1,6 @@
name = "PSBoardDataBase"
uuid = "779f6a9c-59fa-41f1-8ed1-e9a91eccb2f5"
authors = ["qwjyh <urataw421@gmail.com>"]
authors = ["Wataru Otsubo <wotsubo@icepp.s.u-tokyo.ac.jp>"]
version = "0.1.0"
[deps]

View file

@ -289,10 +289,8 @@ uuid = "efcefdf7-47ab-520b-bdef-62a2eaa19f15"
version = "10.42.0+1"
[[deps.PSBoardDataBase]]
deps = ["CSV", "DBInterface", "DataFrames", "Dates", "SQLite", "Tables"]
git-tree-sha1 = "50d84cb861c95ea8f20db4466a4ce03b917904f6"
repo-rev = "main"
repo-url = ".."
deps = ["CSV", "DBInterface", "DataFrames", "Dates", "Documenter", "SQLite", "Tables"]
path = ".."
uuid = "779f6a9c-59fa-41f1-8ed1-e9a91eccb2f5"
version = "0.1.0"
weakdeps = ["InteractiveUtils"]

View file

@ -1,6 +1,18 @@
using Documenter, PSBoardDataBase
DocMeta.setdocmeta!(PSBoardDataBase, :DocTestSetup, :(using PSBoardDataBase); recursive = true)
makedocs(
modules = [PSBoardDataBase],
authors = "Wataru Otsubo <wotsubo@icepp.s.u-tokyo.ac.jp>",
sitename = "PSBoard DataBase",
repo = Remotes.GitLab("https://gitlab.cern.ch/wotsubo/PSBoardDataBase")
format = Documenter.HTML(;
canonical = "https://wotsubo.web.cern.ch",
edit_link = "main",
assets = String[],
),
repo = Remotes.GitLab("https://gitlab.cern.ch", "wotsubo", "PSBoardDataBase"),
pages = [
"Home" => "index.md",
]
)

View file

@ -0,0 +1,20 @@
```@meta
CurrentModule = PSBoardDataBase
```
# About
## API
```@index
```
```@autodocs
Modules = [PSBoardDataBase]
```
### `QaqcMasterLog`
```@autodocs
Modules = [QaqcMasterLog]
```

View file

@ -13,6 +13,26 @@ include("create_table.jl")
include("import_data.jl")
"""
create_database_from_exported_csvs(
dbpath::AbstractString;
single_run_csv::AbstractString,
runlist_csv::AbstractString,
dispatch_csv::AbstractString,
hundred_csv::AbstractString,
masterlog_dir::AbstractString,
)
Create database at `dbpath` and import data from CSV and master log files.
# Arguments
- `dbpath`: where the database will be created
- `single_run_csv`: CSV of single run results exported from the Google sheets database
- `runlist_csv`: CSV of run lists exported from the Google sheets database
- `dispatch_csv`: CSV of dispatch lists exported from the Google sheets database
- `hundred_csv`: CSV of 100 tests results exported from the Google sheets database
- `masterlog_dir`: path to the directory (`log`) where all JATHub master log is stored
"""
function create_database_from_exported_csvs(
dbpath::AbstractString;
single_run_csv::AbstractString,

View file

@ -51,15 +51,17 @@ true || include("../src/PSBoardDataBase.jl")
@test PSBoardDataBase.add_qaqc_dispatch(db, dispatch_table) |> isnothing
@test PSBoardDataBase.add_qaqc_runlist_from_masterlogs(db, "input/log/") |>
isnothing
if haskey(ENV, "LOCAL_TEST")
@test PSBoardDataBase.add_qaqc_runlist_from_masterlogs(db, "input/log/") |>
isnothing
extra_100test_result_df =
CSV.read("input/PS board QAQC Data Base - 100回試験結果.csv", DataFrame)
extra_100test_result_df =
CSV.read("input/PS board QAQC Data Base - 100回試験結果.csv", DataFrame)
@test PSBoardDataBase.add_qaqc_100test_result(db, extra_100test_result_df) |>
isnothing
@test PSBoardDataBase.add_qaqc_100test_result(db, extra_100test_result_df) |>
isnothing
run(`sqlitebrowser $dbpath`)
run(`sqlitebrowser $dbpath`)
end
end
end