diff --git a/.github/workflows/CompatHelper.yml b/.github/workflows/CompatHelper.yml new file mode 100644 index 0000000..98843bc --- /dev/null +++ b/.github/workflows/CompatHelper.yml @@ -0,0 +1,23 @@ +name: CompatHelper +on: + schedule: + - cron: 0 0 * * * + workflow_dispatch: +jobs: + CompatHelper: + runs-on: ubuntu-latest + steps: + - name: "Add CompatHelper" + run: | + import Pkg + Pkg.add("CompatHelper") + shell: julia --color=yes {0} + + - name: "Run CompatHelper" + run: | + import CompatHelper + CompatHelper.main(; subdirs=["", "docs", "test"]) + shell: julia --color=yes {0} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }} diff --git a/.github/workflows/DocPreviewCleanup.yml b/.github/workflows/DocPreviewCleanup.yml new file mode 100644 index 0000000..5be23b9 --- /dev/null +++ b/.github/workflows/DocPreviewCleanup.yml @@ -0,0 +1,33 @@ +name: Doc Preview Cleanup + +on: + pull_request: + types: [closed] + +# Ensure that only one "Doc Preview Cleanup" workflow is force pushing at a time +concurrency: + group: doc-preview-cleanup + cancel-in-progress: false + +jobs: + doc-preview-cleanup: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout gh-pages branch + uses: actions/checkout@v4 + with: + ref: gh-pages + - name: Delete preview and history + push changes + run: | + if [ -d "${preview_dir}" ]; then + git config user.name "Documenter.jl" + git config user.email "documenter@juliadocs.github.io" + git rm -rf "${preview_dir}" + git commit -m "delete preview" + git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree}) + git push --force origin gh-pages-new:gh-pages + fi + env: + preview_dir: previews/PR${{ github.event.number }} diff --git a/.github/workflows/Documenter.yml b/.github/workflows/Documenter.yml new file mode 100644 index 0000000..c54ad87 --- /dev/null +++ b/.github/workflows/Documenter.yml @@ -0,0 +1,50 @@ +name: Documentation + +on: + push: + branches: + - 'main' + tags: '*' + paths-ignore: + - '.zenodo.json' + - '.github/workflows/ci.yml' + - '.github/workflows/CompatHelper.yml' + - '.github/workflows/TagBot.yml' + pull_request: + paths-ignore: + - '.zenodo.json' + - '.github/workflows/ci.yml' + - '.github/workflows/CompatHelper.yml' + - '.github/workflows/TagBot.yml' + workflow_dispatch: + +# Cancel redundant CI tests automatically +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build-documentation: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + with: + version: '1' + show-versioninfo: true + - uses: julia-actions/cache@v2 + - name: Install dependencies + run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()' + - name: Build and deploy + uses: julia-actions/julia-docdeploy@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # For authentication with SSH deploy key + GKSwstype: 100 # To make GitHub Action work, disable showing a plot window with the GR backend of the Plots package + - name: Run doctests + run: | + julia --project=docs --color=yes -e ' + using Documenter: DocMeta, doctest + using TrixiAtmo + DocMeta.setdocmeta!(TrixiAtmo, :DocTestSetup, :(using TrixiAtmo); recursive=true) + doctest(TrixiAtmo)' 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..28c3c43 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,62 @@ +name: CI + +on: + push: + branches: + - main + tags: ['*'] + paths-ignore: + - 'LICENSE.md' + - 'README.md' + - '.zenodo.json' + - 'docs/**' + pull_request: + paths-ignore: + - 'LICENSE.md' + - 'README.md' + - '.zenodo.json' + - 'docs/**' + workflow_dispatch: + +concurrency: + # Skip intermediate builds: always. + # Cancel intermediate builds: only if it is a pull request build. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} + +jobs: + test: + name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + version: + - '1.10' + os: + - ubuntu-latest + - macOS-latest + - windows-latest + arch: + - x64 + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + with: + version: ${{ matrix.version }} + arch: ${{ matrix.arch }} + show-versioninfo: true + - uses: julia-actions/cache@v2 + - uses: julia-actions/julia-buildpkg@v1 + - name: Run tests + uses: julia-actions/julia-runtest@v1 + with: + coverage: true + - uses: julia-actions/julia-processcoverage@v1 + - uses: codecov/codecov-action@v4 + with: + files: lcov.info + - uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + path-to-lcov: ./lcov.info \ No newline at end of file diff --git a/Project.toml b/Project.toml index d1e2a7a..15f7cf9 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "TrixiAtmo" uuid = "c9ed1054-d170-44a9-8ee2-d5566f5d1389" -authors = ["Benedict Geihe "] -version = "0.1.0" +authors = ["Benedict Geihe ", "Tristan Montoya ", "Hendrik Ranocha ", "Michael Schlottke-Lakemper "] +version = "0.1.0-DEV" [deps] LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" diff --git a/README.md b/README.md index 1f38495..986afe6 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,18 @@ # TrixiAtmo.jl + +[![Docs-dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://trixi-framework.github.io/TrixiAtmo.jl/dev) +[![Slack](https://img.shields.io/badge/chat-slack-e01e5a)](https://join.slack.com/t/trixi-framework/shared_invite/zt-sgkc6ppw-6OXJqZAD5SPjBYqLd8MU~g) +[![Build Status](https://github.com/trixi-framework/TrixiAtmo.jl/workflows/CI/badge.svg)](https://github.com/trixi-framework/TrixiAtmo.jl/actions?query=workflow%3ACI) +[![Codecov](https://codecov.io/gh/trixi-framework/TrixiAtmo.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/trixi-framework/TrixiAtmo.jl) +[![Coveralls](https://coveralls.io/repos/github/trixi-framework/TrixiAtmo.jl/badge.svg?branch=main)](https://coveralls.io/github/trixi-framework/TrixiAtmo.jl?branch=main) +[![License: MIT](https://img.shields.io/badge/License-MIT-success.svg)](https://opensource.org/licenses/MIT) + + **Note: This repository is still in its alpha stage and anything might change at any time and without warning, including the deletion of this repository itself.** diff --git a/docs/Project.toml b/docs/Project.toml new file mode 100644 index 0000000..c1e0ac3 --- /dev/null +++ b/docs/Project.toml @@ -0,0 +1,8 @@ +[deps] +Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" +DocumenterInterLinks = "d12716ef-a0f6-4df4-a9f1-a5a34e75c656" +TrixiAtmo = "c9ed1054-d170-44a9-8ee2-d5566f5d1389" + +[compat] +Documenter = "1.3" +DocumenterInterLinks = "0.3.1" \ No newline at end of file diff --git a/docs/make.jl b/docs/make.jl new file mode 100644 index 0000000..05ce510 --- /dev/null +++ b/docs/make.jl @@ -0,0 +1,29 @@ +using TrixiAtmo +using Documenter +using DocumenterInterLinks + +# Provide external links to the Trixi.jl docs (project root and inventory file) +links = InterLinks("Trixi" => ("https://trixi-framework.github.io/Trixi.jl/stable/", + "https://trixi-framework.github.io/Trixi.jl/stable/objects.inv")) + +DocMeta.setdocmeta!(TrixiAtmo, :DocTestSetup, :(using TrixiAtmo); + recursive = true) + +makedocs(; + modules = [TrixiAtmo], + authors = "Benedict Geihe , Tristan Montoya , Michael Schlottke-Lakemper ", + repo = Remotes.GitHub("trixi-framework", + "TrixiAtmo.jl/blob/{commit}{path}#{line}"), + sitename = "TrixiAtmo.jl", + format = Documenter.HTML(; + prettyurls = get(ENV, "CI", "false") == "true", + canonical = "https://trixi-framework.github.io/TrixiAtmo.jl", + edit_link = "main", + assets = String[],), + pages = ["Home" => "index.md"], + plugins = [links],) + +deploydocs(; + repo = "github.com/trixi-framework/TrixiAtmo.jl", + devbranch = "main", + push_preview = true) diff --git a/docs/src/index.md b/docs/src/index.md new file mode 100644 index 0000000..987fc6c --- /dev/null +++ b/docs/src/index.md @@ -0,0 +1,14 @@ +```@meta +CurrentModule = TrixiAtmo +``` + +# TrixiAtmo + +Documentation for [TrixiAtmo](https://github.com/trixi-framework/TrixiAtmo.jl). + +```@index +``` + +```@autodocs +Modules = [TrixiAtmo] +``` diff --git a/src/TrixiAtmo.jl b/src/TrixiAtmo.jl index d80c0ee..84eac18 100644 --- a/src/TrixiAtmo.jl +++ b/src/TrixiAtmo.jl @@ -1,3 +1,11 @@ +""" + 🌍 TrixiAtmo 🌍 + +**TrixiAtmo.jl** is a simulation package for atmospheric models based on +[Trixi.jl](https://github.com/trixi-framework/Trixi.jl) + +See also: [trixi-framework/TrixiAtmo.jl](https://github.com/trixi-framework/TrixiAtmo.jl) +""" module TrixiAtmo using Trixi @@ -8,6 +16,10 @@ using StaticArrays: SVector using Static: True, False using LinearAlgebra: norm +foo() = true +bar() = false +baz() = Trixi.examples_dir() + include("equations/equations.jl") end # module TrixiAtmo diff --git a/test/Project.toml b/test/Project.toml new file mode 100644 index 0000000..b3405d2 --- /dev/null +++ b/test/Project.toml @@ -0,0 +1,5 @@ +[deps] +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" + +[compat] +Test = "1" \ No newline at end of file diff --git a/test/runtests.jl b/test/runtests.jl new file mode 100644 index 0000000..a8e58d3 --- /dev/null +++ b/test/runtests.jl @@ -0,0 +1,24 @@ +using TrixiAtmo +using Test + +# We run tests in parallel with CI jobs setting the `TRIXI_TEST` environment +# variable to determine the subset of tests to execute. +# By default, we just run the threaded tests since they are relatively cheap +# and test a good amount of different functionality. +const TRIXI_TEST = get(ENV, "TRIXI_TEST", "all") +const TRIXI_MPI_NPROCS = clamp(Sys.CPU_THREADS, 2, 3) +const TRIXI_NTHREADS = clamp(Sys.CPU_THREADS, 2, 3) + +@time @testset "TrixiAtmo.jl tests" begin + @time if TRIXI_TEST == "all" + @test TrixiAtmo.foo() == true + @test TrixiAtmo.bar() == false + @test TrixiAtmo.baz() isa String + end + + @time if TRIXI_TEST == "all" || TRIXI_TEST == "upstream" + @testset "baz()" begin + @test TrixiAtmo.baz() isa String + end + end +end