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

Add CI and codecov #1

Merged
merged 1 commit into from
Feb 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
44 changes: 44 additions & 0 deletions .github/workflows/CodeCov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: CodeCov

on:
push:
branches:
- main
- trying
- staging
tags: '*'
pull_request:

jobs:
codecov:
runs-on: ubuntu-latest

steps:
- uses: actions/[email protected]

- name: Set up Julia
uses: julia-actions/setup-julia@latest
with:
version: 1.5.2

- name: Test with coverage
env:
JULIA_PROJECT: "@."
run: |
julia --project=@. -e 'using Pkg; Pkg.instantiate()'
julia --project=@. -e 'using Pkg; Pkg.test(coverage=true)'

- name: Generate coverage file
env:
JULIA_PROJECT: "@."
run: julia --project=@. -e 'using Pkg; Pkg.add("Coverage");
using Coverage;
LCOV.writefile("coverage-lcov.info", Codecov.process_folder())'
if: success()

- name: Submit coverage
uses: codecov/[email protected]
with:
token: ${{secrets.CODECOV_TOKEN}}
if: success()

47 changes: 47 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: ci
on:
push:
branches:
- main
- trying
- staging
tags: '*'
pull_request:

jobs:
test:
name: ci ${{ matrix.version }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- '1.5.2'
os:
- ubuntu-latest
- macOS-latest
- windows-latest
arch:
- x64
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v1
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@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v1
with:
file: lcov.info
3 changes: 3 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ name = "DispatchedTuples"
uuid = "508c55e1-51b4-41fd-a5ca-7eb0327d070d"
authors = ["Charles Kawczynski <[email protected]>"]
version = "0.1.0"

[compat]
julia = "1.5"
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# DispatchedTuples.jl

|||
|---------------------:|:----------------------------------------------|
| **GHA CI** | [![gha ci][gha-ci-img]][gha-ci-url] |
| **Code Coverage** | [![codecov][codecov-img]][codecov-url] |

[gha-ci-img]: https://github.com/charleskawczynski/DispatchedTuples.jl/workflows/ci/badge.svg
[gha-ci-url]: https://github.com/charleskawczynski/DispatchedTuples.jl/actions?query=workflow%3Aci

[codecov-img]: https://codecov.io/gh/charleskawczynski/DispatchedTuples.jl/branch/main/graph/badge.svg
[codecov-url]: https://codecov.io/gh/charleskawczynski/DispatchedTuples.jl


DispatchedTuples.jl defines one user-facing type: `DispatchedTuple`, and one user-facing method: `dispatch`. A `DispatchedTuple` is similar to a compile-time dictionary, that uses dispatch for the look-up.

`DispatchedTuple` takes a `Tuple` of `Pair`s, where the `first` field of the `Pair` (the "key") is **an instance of the type you want to dispatch on**. The `second` field of the `Pair` is the quantity (the "value", which can be anything) returned by `dispatch`.
Expand Down