-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from trixi-framework/msl/add-basic-ci
Add basic CI infrastructure
- Loading branch information
Showing
19 changed files
with
365 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# xref: https://docs.codecov.io/docs/codecovyml-reference | ||
|
||
# Disable annotations (annoying!) | ||
github_checks: | ||
annotations: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" # Location of package manifests | ||
schedule: | ||
interval: "monthly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: CompatHelper | ||
on: | ||
schedule: | ||
- cron: 0 0 * * * | ||
workflow_dispatch: | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
jobs: | ||
CompatHelper: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check if Julia is already available in the PATH | ||
id: julia_in_path | ||
run: which julia | ||
continue-on-error: true | ||
- name: Install Julia, but only if it is not already available in the PATH | ||
uses: julia-actions/setup-julia@v1 | ||
with: | ||
version: '1' | ||
arch: ${{ runner.arch }} | ||
if: steps.julia_in_path.outcome != 'success' | ||
- name: "Add the General registry via Git" | ||
run: | | ||
import Pkg | ||
ENV["JULIA_PKG_SERVER"] = "" | ||
Pkg.Registry.add("General") | ||
shell: julia --color=yes {0} | ||
- name: "Install CompatHelper" | ||
run: | | ||
import Pkg | ||
name = "CompatHelper" | ||
uuid = "aa819f21-2bde-4658-8897-bab36330d9b7" | ||
version = "3" | ||
Pkg.add(; name, uuid, version) | ||
shell: julia --color=yes {0} | ||
- name: "Run CompatHelper" | ||
run: | | ||
import CompatHelper | ||
CompatHelper.main(; subdirs=["", "test", "docs"]) | ||
shell: julia --color=yes {0} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }} | ||
# COMPATHELPER_PRIV: ${{ secrets.COMPATHELPER_PRIV }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Documentation | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
tags: '*' | ||
paths-ignore: | ||
- '.github/workflows/ci.yml' | ||
- '.github/workflows/CompatHelper.yml' | ||
- '.github/workflows/TagBot.yml' | ||
pull_request: | ||
paths-ignore: | ||
- '.github/workflows/ci.yml' | ||
- '.github/workflows/CompatHelper.yml' | ||
- '.github/workflows/TagBot.yml' | ||
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: | ||
build-docs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: julia-actions/setup-julia@v1 | ||
with: | ||
version: '1' | ||
show-versioninfo: true | ||
- uses: julia-actions/julia-buildpkg@v1 | ||
- name: Install dependencies | ||
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()' | ||
- name: Build and deploy | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # For authentication with SSH deploy key | ||
run: julia --project=docs --color=yes docs/make.jl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: Spell Check | ||
|
||
on: [pull_request, workflow_dispatch] | ||
|
||
jobs: | ||
typos-check: | ||
name: Spell Check with Typos | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Actions Repository | ||
uses: actions/checkout@v4 | ||
- name: Check spelling | ||
uses: crate-ci/typos@v1.17.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: TagBot | ||
on: | ||
issue_comment: | ||
types: | ||
- created | ||
workflow_dispatch: | ||
inputs: | ||
lookback: | ||
default: 3 | ||
permissions: | ||
actions: read | ||
checks: read | ||
contents: write | ||
deployments: read | ||
issues: read | ||
discussions: read | ||
packages: read | ||
pages: read | ||
pull-requests: read | ||
repository-projects: read | ||
security-events: read | ||
statuses: read | ||
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 }} | ||
# Edit the following line to reflect the actual name of the GitHub Secret containing your private key | ||
ssh: ${{ secrets.DOCUMENTER_KEY }} | ||
# ssh: ${{ secrets.NAME_OF_MY_SSH_PRIVATE_KEY_SECRET }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: ['*'] | ||
paths-ignore: | ||
- 'CITATION.bib' | ||
- 'LICENSE.md' | ||
- 'README.md' | ||
- '.zenodo.json' | ||
- '.github/workflows/CompatHelper.yml' | ||
- '.github/workflows/SpellCheck.yml' | ||
- '.github/workflows/TagBot.yml' | ||
- 'docs/**' | ||
pull_request: | ||
paths-ignore: | ||
- 'CITATION.bib' | ||
- 'LICENSE.md' | ||
- 'README.md' | ||
- '.zenodo.json' | ||
- '.github/workflows/CompatHelper.yml' | ||
- '.github/workflows/SpellCheck.yml' | ||
- '.github/workflows/TagBot.yml' | ||
- '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: ${{ matrix.os }} - Julia ${{ matrix.version }} - ${{ github.event_name }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
version: | ||
- '1.8' | ||
- '1.9' | ||
- '1.10' | ||
os: | ||
- ubuntu-latest | ||
- macOS-latest | ||
- windows-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: julia-actions/setup-julia@v1 | ||
with: | ||
version: ${{ matrix.version }} | ||
- run: julia -e 'using InteractiveUtils; versioninfo(verbose=true)' | ||
- uses: julia-actions/cache@v1 | ||
- uses: julia-actions/julia-buildpkg@v1 | ||
- uses: julia-actions/julia-runtest@v1 | ||
- uses: julia-actions/julia-processcoverage@v1 | ||
with: | ||
directories: src,examples | ||
- uses: codecov/codecov-action@v3 | ||
with: | ||
files: lcov.info | ||
# token: ${{ secrets.CODECOV_TOKEN }} | ||
- uses: coverallsapp/github-action@master | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
path-to-lcov: ./lcov.info | ||
# Enable tmate debugging of manually-triggered workflows if the input option was provided | ||
- name: Setup tmate session for debugging | ||
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled && always() }} | ||
uses: mxschmitt/action-tmate@v3 | ||
timeout-minutes: 15 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[deps] | ||
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" | ||
|
||
[compat] | ||
Documenter = "1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
using Documenter | ||
|
||
# Get Smesh.jl root directory | ||
smesh_root_dir = dirname(@__DIR__) | ||
|
||
# Fix for https://github.com/trixi-framework/Trixi.jl/issues/668 | ||
if (get(ENV, "CI", nothing) != "true") && (get(ENV, "SMESH_DOC_DEFAULT_ENVIRONMENT", nothing) != "true") | ||
push!(LOAD_PATH, smesh_root_dir) | ||
end | ||
|
||
using Smesh | ||
|
||
# Define module-wide setups such that the respective modules are available in doctests | ||
DocMeta.setdocmeta!(Smesh, :DocTestSetup, :(using Smesh); recursive=true) | ||
|
||
# Copy some files from the top level directory to the docs and modify them | ||
# as necessary | ||
open(joinpath(@__DIR__, "src", "index.md"), "w") do io | ||
# Point to source file | ||
println(io, """ | ||
```@meta | ||
EditURL = "https://github.com/trixi-framework/Smesh.jl/blob/main/README.md" | ||
``` | ||
""") | ||
# Write the modified contents | ||
for line in eachline(joinpath(smesh_root_dir, "README.md")) | ||
line = replace(line, "[LICENSE.md](LICENSE.md)" => "[License](@ref)") | ||
println(io, line) | ||
end | ||
end | ||
|
||
open(joinpath(@__DIR__, "src", "license.md"), "w") do io | ||
# Point to source file | ||
println(io, """ | ||
```@meta | ||
EditURL = "https://github.com/trixi-framework/Smesh/blob/main/LICENSE.md" | ||
``` | ||
""") | ||
# Write the modified contents | ||
println(io, "# License") | ||
println(io, "") | ||
for line in eachline(joinpath(smesh_root_dir, "LICENSE.md")) | ||
println(io, "> ", line) | ||
end | ||
end | ||
|
||
# Make documentation | ||
makedocs( | ||
# Specify modules for which docstrings should be shown | ||
modules = [Smesh], | ||
# Set sitename to Trixi.jl | ||
sitename="Smesh.jl", | ||
# Provide additional formatting options | ||
format = Documenter.HTML( | ||
# Disable pretty URLs during manual testing | ||
prettyurls = get(ENV, "CI", nothing) == "true", | ||
# Set canonical URL to GitHub pages URL | ||
canonical = "https://trixi-framework.github.io/Smesh.jl/stable" | ||
), | ||
# Explicitly specify documentation structure | ||
pages = [ | ||
"Home" => "index.md", | ||
"API reference" => "reference.md", | ||
"License" => "license.md" | ||
], | ||
) | ||
|
||
|
||
deploydocs(; | ||
repo = "github.com/trixi-framework/Smesh.jl", | ||
devbranch = "main", | ||
push_preview = true | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
index.md | ||
license.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# API reference | ||
|
||
```@meta | ||
CurrentModule = Smesh | ||
``` | ||
|
||
```@autodocs | ||
Modules = [Smesh] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
using Smesh | ||
|
||
Smesh.greet() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
module Smesh | ||
|
||
""" | ||
greet() | ||
Say hello to the world. | ||
""" | ||
greet() = print("Hello World!") | ||
|
||
end # module Smesh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[deps] | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
|
||
[compat] | ||
Test = "1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
using Test | ||
|
||
@time @testset verbose=true showtiming=true "Smesh.jl tests" begin | ||
include("test_unit.jl") | ||
include("test_examples.jl") | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module TestExamples | ||
|
||
using Test | ||
using Smesh | ||
|
||
@testset verbose=true showtiming=true "test_examples.jl" begin | ||
|
||
@testset verbose=true showtiming=true "examples/dummy.jl" begin | ||
@test_nowarn include("../examples/dummy.jl") | ||
end | ||
|
||
end # @testset "test_examples.jl" | ||
|
||
end # module | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module TestUnit | ||
|
||
using Test | ||
using Smesh | ||
|
||
@testset verbose=true showtiming=true "test_unit.jl" begin | ||
|
||
@testset verbose=true showtiming=true "greet" begin | ||
@test_nowarn Smesh.greet() | ||
end | ||
|
||
end # @testset "test_unit.jl" | ||
|
||
end # module | ||
|