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 4 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
71 changes: 71 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: CI

on:
push:
branches:
- main
tags: ['*']
paths-ignore:
- 'LICENSE.md'
- 'README.md'
- '.zenodo.json'
- '.github/workflows/CompatHelper.yml'
- '.github/workflows/TagBot.yml'
tristanmontoya marked this conversation as resolved.
Show resolved Hide resolved
- 'docs/**'
pull_request:
paths-ignore:
- 'LICENSE.md'
- 'README.md'
- '.zenodo.json'
- '.github/workflows/CompatHelper.yml'
- '.github/workflows/TagBot.yml'
tristanmontoya marked this conversation as resolved.
Show resolved Hide resolved
- '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:
if: "!contains(github.event.head_commit.message, 'skip ci')"
tristanmontoya marked this conversation as resolved.
Show resolved Hide resolved
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@v1
tristanmontoya marked this conversation as resolved.
Show resolved Hide resolved
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- run: julia -e 'using InteractiveUtils; versioninfo(verbose=true)'
tristanmontoya marked this conversation as resolved.
Show resolved Hide resolved
- uses: julia-actions/cache@v1
tristanmontoya marked this conversation as resolved.
Show resolved Hide resolved
- uses: julia-actions/julia-buildpkg@v1
- name: Run tests without coverage
uses: julia-actions/julia-runtest@v1
with:
coverage: false
- name: Run tests with coverage
uses: julia-actions/julia-runtest@v1
with:
coverage: true
tristanmontoya marked this conversation as resolved.
Show resolved Hide resolved
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v3
tristanmontoya marked this conversation as resolved.
Show resolved Hide resolved
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>"]
version = "0.1.1-dev"
tristanmontoya marked this conversation as resolved.
Show resolved Hide resolved

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
4 changes: 4 additions & 0 deletions src/TrixiAtmo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,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