From 19da2480568b345e7c15cf4f96d9394963f39166 Mon Sep 17 00:00:00 2001 From: Oliver Schulz Date: Thu, 22 Apr 2021 09:25:18 +0200 Subject: [PATCH] Initial package layout --- .codecov.yml | 1 + .github/workflows/CompatHelper.yml | 20 ++++++ .github/workflows/TagBot.yml | 15 +++++ .github/workflows/ci.yml | 100 +++++++++++++++++++++++++++++ .gitignore | 7 ++ LICENSE.md | 24 +++++++ Project.toml | 14 ++++ README.md | 13 ++++ docs/.gitignore | 2 + docs/Project.toml | 6 ++ docs/make.jl | 31 +++++++++ docs/src/LICENSE.md | 6 ++ docs/src/api.md | 32 +++++++++ docs/src/index.md | 1 + src/BATBase.jl | 14 ++++ src/hello_world.jl | 23 +++++++ test/runtests.jl | 7 ++ test/test_hello_world.jl | 9 +++ 18 files changed, 325 insertions(+) create mode 100644 .codecov.yml create mode 100644 .github/workflows/CompatHelper.yml create mode 100644 .github/workflows/TagBot.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .gitignore create mode 100644 LICENSE.md create mode 100644 Project.toml create mode 100644 README.md create mode 100644 docs/.gitignore create mode 100644 docs/Project.toml create mode 100644 docs/make.jl create mode 100644 docs/src/LICENSE.md create mode 100644 docs/src/api.md create mode 100644 docs/src/index.md create mode 100644 src/BATBase.jl create mode 100644 src/hello_world.jl create mode 100644 test/runtests.jl create mode 100644 test/test_hello_world.jl diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 0000000..ac54655 --- /dev/null +++ b/.codecov.yml @@ -0,0 +1 @@ +# comment: false diff --git a/.github/workflows/CompatHelper.yml b/.github/workflows/CompatHelper.yml new file mode 100644 index 0000000..1f8a579 --- /dev/null +++ b/.github/workflows/CompatHelper.yml @@ -0,0 +1,20 @@ +name: CompatHelper + +on: + schedule: + - cron: '00 00 * * *' + push: + branches: + - actions/trigger/CompatHelper + workflow_dispatch: +jobs: + CompatHelper: + runs-on: ubuntu-latest + steps: + - name: Pkg.add("CompatHelper") + run: julia -e 'using Pkg; Pkg.add("CompatHelper")' + - name: CompatHelper.main() + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }} + run: julia -e 'using CompatHelper; CompatHelper.main()' diff --git a/.github/workflows/TagBot.yml b/.github/workflows/TagBot.yml new file mode 100644 index 0000000..f49313b --- /dev/null +++ b/.github/workflows/TagBot.yml @@ -0,0 +1,15 @@ +name: TagBot +on: + issue_comment: + types: + - created + workflow_dispatch: +jobs: + TagBot: + if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' + runs-on: ubuntu-latest + steps: + - uses: JuliaRegistries/TagBot@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + ssh: ${{ secrets.DOCUMENTER_KEY }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..be70b09 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,100 @@ +name: CI + +on: + push: + branches: + - master + - dev + - 'releases/**' + tags: '*' + pull_request: + release: + +jobs: + test: + name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} + runs-on: ${{ matrix.os }} + continue-on-error: ${{ matrix.version == 'nightly' }} + strategy: + fail-fast: false + matrix: + version: + - '1.3' + - '1' + # - 'nightly' + os: + - ubuntu-latest + - macOS-latest + - windows-latest + arch: + - x64 + - x86 + exclude: + # 32-bit Julia binaries are not available on macOS + - os: macOS-latest + arch: x86 + - os: windows-latest + arch: x86 + - version: nightly + arch: x86 + - version: nightly + os: macOS-latest + - version: nightly + os: windows-latest + - version: 1.3 + os: macOS-latest + - version: 1.3 + os: windows-latest + steps: + - uses: actions/checkout@v2 + - uses: julia-actions/setup-julia@latest + with: + version: ${{ matrix.version }} + arch: ${{ matrix.arch }} + - name: Cache artifacts + uses: actions/cache@v2 + env: + cache-name: cache-artifacts + with: + path: ~/.julia/artifacts + key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }} + restore-keys: | + ${{ runner.os }}-test-${{ env.cache-name }}- + ${{ runner.os }}-test- + ${{ runner.os }}- + - uses: julia-actions/julia-buildpkg@latest + env: + PYTHON: 'Conda' + - uses: julia-actions/julia-runtest@latest + - uses: julia-actions/julia-processcoverage@v1 + - uses: codecov/codecov-action@v1 + with: + file: lcov.info + docs: + name: Documentation + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: julia-actions/setup-julia@latest + with: + version: '1' + - name: Cache artifacts + uses: actions/cache@v2 + env: + cache-name: cache-artifacts + with: + path: ~/.julia/artifacts + key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/docs/Project.toml') }} + restore-keys: | + ${{ runner.os }}-test-${{ env.cache-name }}- + ${{ runner.os }}-test- + ${{ runner.os }}- + - uses: julia-actions/julia-buildpkg@latest + env: + PYTHON: 'Conda' + - uses: julia-actions/julia-docdeploy@latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Needed due to https://github.com/JuliaDocs/Documenter.jl/issues/1177 + DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} + GKSwstype: 'nul' diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d0b53d9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +.DS_Store +*.jl.cov +*.jl.*.cov +*.jl.mem +.ipynb_checkpoints +.vscode +Manifest.toml diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..67733d6 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,24 @@ +The BATBase.jl package is licensed under the MIT "Expat" License: + +> Copyright (c) 2017-2021: +> +> Oliver Schulz +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all +> copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +> SOFTWARE. +> diff --git a/Project.toml b/Project.toml new file mode 100644 index 0000000..e869850 --- /dev/null +++ b/Project.toml @@ -0,0 +1,14 @@ +name = "BATBase" +uuid = "b4d2a721-a957-46f4-b6b6-f139c9e7db21" +version = "0.1.0" + +[deps] + +[compat] +julia = "1" + +[extras] +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" + +[targets] +test = ["Test"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..9c91891 --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +# BATBase.jl + +[![Documentation for stable version](https://img.shields.io/badge/docs-stable-blue.svg)](https://bat.github.io/BATBase.jl/stable) +[![Documentation for development version](https://img.shields.io/badge/docs-dev-blue.svg)](https://bat.github.io/BATBase.jl/dev) +[![License](http://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](LICENSE.md) +[![Build Status](https://github.com/bat/BATBase.jl/workflows/CI/badge.svg?branch=master)](https://github.com/bat/BATBase.jl/actions?query=workflow%3ACI) +[![Codecov](https://codecov.io/gh/bat/BATBase.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/bat/BATBase.jl) + + +## Documentation + +* [Documentation for stable version](https://bat.github.io/BATBase.jl/stable) +* [Documentation for development version](https://bat.github.io/BATBase.jl/dev) diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 0000000..a303fff --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1,2 @@ +build/ +site/ diff --git a/docs/Project.toml b/docs/Project.toml new file mode 100644 index 0000000..ba02242 --- /dev/null +++ b/docs/Project.toml @@ -0,0 +1,6 @@ +[deps] +Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" +Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a" + +[compat] +Documenter = "~0.26" diff --git a/docs/make.jl b/docs/make.jl new file mode 100644 index 0000000..3208aac --- /dev/null +++ b/docs/make.jl @@ -0,0 +1,31 @@ +# Use +# +# DOCUMENTER_DEBUG=true julia --color=yes make.jl local [nonstrict] [fixdoctests] +# +# for local builds. + +using Documenter +using BATBase + +makedocs( + sitename = "BATBase", + modules = [BATBase], + format = Documenter.HTML( + prettyurls = !("local" in ARGS), + canonical = "https://bat.github.io/BATBase.jl/stable/" + ), + pages = [ + "Home" => "index.md", + "API" => "api.md", + "LICENSE" => "LICENSE.md", + ], + doctest = ("fixdoctests" in ARGS) ? :fix : true, + linkcheck = !("nonstrict" in ARGS), + strict = !("nonstrict" in ARGS), +) + +deploydocs( + repo = "github.com/bat/BATBase.jl.git", + forcepush = true, + push_preview = true, +) diff --git a/docs/src/LICENSE.md b/docs/src/LICENSE.md new file mode 100644 index 0000000..b1bd836 --- /dev/null +++ b/docs/src/LICENSE.md @@ -0,0 +1,6 @@ +# LICENSE + +```@eval +using Markdown +Markdown.parse_file(joinpath(@__DIR__, "..", "..", "LICENSE.md")) +``` diff --git a/docs/src/api.md b/docs/src/api.md new file mode 100644 index 0000000..e2bbe4d --- /dev/null +++ b/docs/src/api.md @@ -0,0 +1,32 @@ +# API + +```@meta +DocTestSetup = quote + using BATBase +end +``` + +## Modules + +```@index +Order = [:module] +``` + +## Types and constants + +```@index +Order = [:type, :constant] +``` + +## Functions and macros + +```@index +Order = [:macro, :function] +``` + +# Documentation + +```@autodocs +Modules = [BATBase] +Order = [:module, :type, :constant, :macro, :function] +``` diff --git a/docs/src/index.md b/docs/src/index.md new file mode 100644 index 0000000..db04b6e --- /dev/null +++ b/docs/src/index.md @@ -0,0 +1 @@ +# BATBase.jl diff --git a/src/BATBase.jl b/src/BATBase.jl new file mode 100644 index 0000000..620e42a --- /dev/null +++ b/src/BATBase.jl @@ -0,0 +1,14 @@ +# This file is a part of BATBase.jl, licensed under the MIT License (MIT). + +__precompile__(true) + +""" + BATBase + +Template for Julia packages. +""" +module BATBase + +include("hello_world.jl") + +end # module diff --git a/src/hello_world.jl b/src/hello_world.jl new file mode 100644 index 0000000..3449fcb --- /dev/null +++ b/src/hello_world.jl @@ -0,0 +1,23 @@ +# This file is a part of BATBase.jl, licensed under the MIT License (MIT). + + +""" + BATBase.hello_world() + +Prints "Hello, World!" and returns 42. + +```jldoctest +using BATBase + +BATBase.hello_world() + +# output + +Hello, World! +42 +``` +""" +function hello_world() + println("Hello, World!") + return 42 +end diff --git a/test/runtests.jl b/test/runtests.jl new file mode 100644 index 0000000..90fe337 --- /dev/null +++ b/test/runtests.jl @@ -0,0 +1,7 @@ +# This file is a part of BATBase.jl, licensed under the MIT License (MIT). + +import Test + +Test.@testset "Package BATBase" begin + include("test_hello_world.jl") +end # testset diff --git a/test/test_hello_world.jl b/test/test_hello_world.jl new file mode 100644 index 0000000..7bccc15 --- /dev/null +++ b/test/test_hello_world.jl @@ -0,0 +1,9 @@ +# This file is a part of BATBase.jl, licensed under the MIT License (MIT). + +using BATBase +using Test + + +@testset "hello_world" begin + @test BATBase.hello_world() == 42 +end