Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding basic CI #6

Merged
merged 28 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
@@ -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 }}
33 changes: 33 additions & 0 deletions .github/workflows/DocPreviewCleanup.yml
Original file line number Diff line number Diff line change
@@ -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 }}
50 changes: 50 additions & 0 deletions .github/workflows/Documenter.yml
Original file line number Diff line number Diff line change
@@ -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)'
15 changes: 15 additions & 0 deletions .github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
@@ -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 }}
62 changes: 62 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
benegee marked this conversation as resolved.
Show resolved Hide resolved
- 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
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "TrixiAtmo"
uuid = "c9ed1054-d170-44a9-8ee2-d5566f5d1389"
authors = ["Benedict Geihe <bgeihe@uni-koeln.de>"]
version = "0.1.0"
authors = ["Benedict Geihe <bgeihe@uni-koeln.de>", "Tristan Montoya <montoya.tristan@gmail.com>", "Hendrik Ranocha <hendrik.ranocha@uni-mainz.de>", "Michael Schlottke-Lakemper <michael@sloede.com>"]
version = "0.1.0-DEV"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# TrixiAtmo.jl

<!--
[![Docs-stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://trixi-framework.github.io/TrixiAtmo.jl/stable)
-->
[![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)
<!--
[![DOI](https://zenodo.org/badge/DOI/TODO.svg)](https://doi.org/TODO)
-->

**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.**
8 changes: 8 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -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"
29 changes: 29 additions & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -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 <bgeihe@uni-koeln.de>, Tristan Montoya <montoya.tristan@gmail.com, Hendrik Ranocha <hendrik.ranocha@uni-mainz.de>, Michael Schlottke-Lakemper <michael@sloede.com>",
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)
14 changes: 14 additions & 0 deletions docs/src/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
```@meta
CurrentModule = TrixiAtmo
```

# TrixiAtmo

Documentation for [TrixiAtmo](https://github.com/trixi-framework/TrixiAtmo.jl).

```@index
```

```@autodocs
Modules = [TrixiAtmo]
```
12 changes: 12 additions & 0 deletions src/TrixiAtmo.jl
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
5 changes: 5 additions & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[deps]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
Test = "1"
24 changes: 24 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -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
Loading