From 33ac8d0a345aafd8c08f70d93d50301c2cfe5edc Mon Sep 17 00:00:00 2001 From: Wataru Otsubo Date: Fri, 13 Sep 2024 19:09:10 +0900 Subject: [PATCH 1/5] new: add doc for local --- Project.toml | 2 +- docs/Manifest.toml | 6 ++---- docs/make.jl | 4 +++- docs/src/index.md | 13 +++++++++++++ 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/Project.toml b/Project.toml index 5fb5666..757362c 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "PSBoardDataBase" uuid = "779f6a9c-59fa-41f1-8ed1-e9a91eccb2f5" -authors = ["qwjyh "] +authors = ["Wataru Otsubo "] version = "0.1.0" [deps] diff --git a/docs/Manifest.toml b/docs/Manifest.toml index a649b97..a8f999f 100644 --- a/docs/Manifest.toml +++ b/docs/Manifest.toml @@ -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"] diff --git a/docs/make.jl b/docs/make.jl index b399ace..a79915b 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -2,5 +2,7 @@ using Documenter, PSBoardDataBase makedocs( sitename = "PSBoard DataBase", - repo = Remotes.GitLab("https://gitlab.cern.ch/wotsubo/PSBoardDataBase") + remotes = Dict( + ".." => Remotes.GitLab("https://gitlab.cern.ch", "wotsubo", "PSBoardDataBase"), + ), ) diff --git a/docs/src/index.md b/docs/src/index.md index e69de29..7de2343 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -0,0 +1,13 @@ +```@meta +CurrentModule = PSBoardDataBase +``` + +# About + +```@index +``` + +```@autodocs +Modules = [PSBoardDataBase] +``` + From 96239dd489818f4276b81fce55e2ecea638bb8ef Mon Sep 17 00:00:00 2001 From: Wataru Otsubo Date: Fri, 13 Sep 2024 19:29:12 +0900 Subject: [PATCH 2/5] update: docs (main index.md and docstrring) --- docs/src/index.md | 7 +++++++ src/PSBoardDataBase.jl | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/docs/src/index.md b/docs/src/index.md index 7de2343..6a79cb5 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -4,6 +4,8 @@ CurrentModule = PSBoardDataBase # About +## API + ```@index ``` @@ -11,3 +13,8 @@ CurrentModule = PSBoardDataBase Modules = [PSBoardDataBase] ``` +### `QaqcMasterLog` + +```@autodocs +Modules = [QaqcMasterLog] +``` diff --git a/src/PSBoardDataBase.jl b/src/PSBoardDataBase.jl index 0865a27..624ae31 100644 --- a/src/PSBoardDataBase.jl +++ b/src/PSBoardDataBase.jl @@ -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, From ea7e87f36fe937dfcd4cfc6f0687bc6ffc0b8196 Mon Sep 17 00:00:00 2001 From: Wataru Otsubo Date: Fri, 13 Sep 2024 19:29:46 +0900 Subject: [PATCH 3/5] update: make.jl for docs --- docs/make.jl | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/make.jl b/docs/make.jl index a79915b..847aafd 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,8 +1,18 @@ using Documenter, PSBoardDataBase +DocMeta.setdocmeta!(PSBoardDataBase, :DocTestSetup, :(using PSBoardDataBase); recursive = true) + makedocs( + modules = [PSBoardDataBase], + authors = "Wataru Otsubo ", sitename = "PSBoard DataBase", - remotes = Dict( - ".." => 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", + ] ) From 6060e26e9097ce59ec157cee5bd75ae9a2752887 Mon Sep 17 00:00:00 2001 From: Wataru Otsubo Date: Fri, 13 Sep 2024 19:30:03 +0900 Subject: [PATCH 4/5] new: CI --- .gitlab-ci.yml | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..f348455 --- /dev/null +++ b/.gitlab-ci.yml @@ -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 From 8ad4dfba2715818de7632916081b04506f3a13fa Mon Sep 17 00:00:00 2001 From: Wataru Otsubo Date: Fri, 13 Sep 2024 19:37:49 +0900 Subject: [PATCH 5/5] fix: add LOCAL_TEST env var for local only test - add_qaqc_runlist_from_masterlogs works only when all of the master logs are located. but CI doesn't since log files are not included in the repo --- test/runtests.jl | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index dbd8151..85205cb 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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