Skip to content

Commit

Permalink
bug fixes; added all tests; actions added
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr Martian committed Jul 29, 2024
1 parent cb28263 commit cab6ea7
Show file tree
Hide file tree
Showing 69 changed files with 541 additions and 136 deletions.
82 changes: 82 additions & 0 deletions .github/workflows/coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: coveralls

on: push

jobs:
test:
name: Coveralls Upload
runs-on: ubuntu-latest

# setup

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: 1.1.16

- name: Install dependencies
run: bun install

# Bun tests

- name: Run JavaScript/TypeScript tests
run: bun run test

- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

# setup rust

- name: Install Clippy
run: rustup component add clippy

- name: Install llvm-tools-preview
run: rustup component add llvm-tools-preview

- name: Install grcov
run: |
sudo apt-get install lcov
cargo install grcov
- name: Build Rust project
run: cargo build
shell: bash

# Rust tests

- name: Run Rust tests with coverage
run: |
export CARGO_INCREMENTAL=0
export RUSTFLAGS='-Cinstrument-coverage'
export LLVM_PROFILE_FILE='cargo-test-%p-%m.profraw'
cargo test --lib
grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*/.cargo/*" --ignore "/*/target/*" -o ./coverage/rust-lcov.info
shell: bash

# Merge LCOV reports

- name: Merge Bun and Rust LCOV reports
run: |
mkdir -p coverage
if [ -f ./coverage/lcov.info ] && [ -f ./coverage/rust-lcov.info ]; then
cat ./coverage/rust-lcov.info >> ./coverage/lcov.info
elif [ -f ./coverage/rust-lcov.info ]; then
mv ./coverage/rust-lcov.info ./coverage/lcov.info
fi
# upload to Coveralls

- name: Upload coverage to Coveralls
run: |
if [ -f ./coverage/lcov.info ]; then
bun run coveralls < ./coverage/lcov.info
fi
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
48 changes: 48 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: test-workflow

on: push

jobs:
test:
name: Test
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: 1.1.16

- name: Install dependencies
run: bun install

- name: Run JavaScript/TypeScript tests
run: bun run test

- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Install Clippy
run: rustup component add clippy

- name: Run Clippy
run: cargo clippy -- -D warnings
shell: bash

- name: Build Rust project
run: cargo build
shell: bash

- name: Run Rust tests
run: cargo test
shell: bash
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "s2json"
version = "1.2.0"
version = "1.3.0"
edition = "2021"
authors = ["Craig O'Connor <oconnorct1@gmail.com>"]
description = "This library supports the S2JSON 1.0 Specification"
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
<a href="https://docs.rs/s2json">
<img src="https://img.shields.io/badge/docs-rust-yellow.svg" alt="docs-rust">
</a>
<img src="https://raw.githubusercontent.com/Open-S2/s2json/master/assets/doc-coverage.svg" alt="doc-coverage">
<a href="https://coveralls.io/github/Open-S2/s2json?branch=master">
<img src="https://coveralls.io/repos/github/Open-S2/s2json/badge.svg?branch=master" alt="code-coverage">
</a>
<a href="https://discord.opens2.com">
<img src="https://img.shields.io/discord/953563031701426206?logo=discord&logoColor=white" alt="Discord">
</a>
Expand Down
1 change: 1 addition & 0 deletions cobertura.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?xml version="1.0"?><coverage lines-covered="60" lines-valid="62" line-rate="0.967741935483871" branches-covered="0" branches-valid="0" branch-rate="0" complexity="0" version="1.9" timestamp="1722254116"><sources><source>/Users/craigoconnor/Documents/Projects/OpenS2/s2json</source></sources><packages><package name="rust" line-rate="0.967741935483871" branch-rate="0" complexity="0"><classes><class name="geometry" filename="rust/geometry.rs" line-rate="0.9615384615384616" branch-rate="0" complexity="0"><methods/><lines><line number="33" hits="1"/><line number="37" hits="2"/><line number="38" hits="0"/><line number="39" hits="1"/><line number="40" hits="1"/><line number="41" hits="1"/><line number="42" hits="1"/><line number="50" hits="1"/><line number="58" hits="1"/><line number="62" hits="1"/><line number="64" hits="1"/><line number="65" hits="1"/><line number="68" hits="2"/><line number="72" hits="3"/><line number="73" hits="2"/><line number="74" hits="2"/><line number="75" hits="2"/><line number="76" hits="2"/><line number="77" hits="2"/><line number="78" hits="2"/><line number="79" hits="2"/><line number="80" hits="2"/><line number="84" hits="1"/><line number="111" hits="2"/><line number="115" hits="4"/><line number="116" hits="0"/><line number="117" hits="2"/><line number="118" hits="2"/><line number="119" hits="2"/><line number="120" hits="2"/><line number="121" hits="2"/><line number="122" hits="2"/><line number="130" hits="2"/><line number="138" hits="2"/><line number="142" hits="2"/><line number="144" hits="2"/><line number="145" hits="2"/><line number="148" hits="4"/><line number="152" hits="6"/><line number="153" hits="4"/><line number="154" hits="4"/><line number="155" hits="4"/><line number="156" hits="4"/><line number="157" hits="4"/><line number="158" hits="4"/><line number="159" hits="4"/><line number="160" hits="4"/><line number="161" hits="4"/><line number="162" hits="4"/><line number="163" hits="4"/><line number="164" hits="4"/><line number="168" hits="2"/></lines></class><class name="lib" filename="rust/lib.rs" line-rate="1" branch-rate="0" complexity="0"><methods/><lines><line number="43" hits="6"/><line number="44" hits="6"/><line number="48" hits="6"/><line number="49" hits="6"/><line number="50" hits="1"/><line number="51" hits="1"/><line number="52" hits="1"/><line number="53" hits="1"/><line number="54" hits="1"/><line number="55" hits="1"/></lines></class></classes></package></packages></coverage>
2 changes: 1 addition & 1 deletion docs/hierarchy.html

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>s2json-spec - v1.2.0</title><meta name="description" content="Documentation for s2json-spec"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="assets/style.css"/><link rel="stylesheet" href="assets/highlight.css"/><script defer src="assets/main.js"></script><script async src="assets/icons.js" id="tsd-icons-script"></script><script async src="assets/search.js" id="tsd-search-script"></script><script async src="assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base="."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="index.html" class="title">s2json-spec - v1.2.0</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><h2>s2json-spec - v1.2.0</h2></div><div class="tsd-panel tsd-typography"><h1 style="text-align: center;">
<!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>s2json-spec - v1.3.0</title><meta name="description" content="Documentation for s2json-spec"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="assets/style.css"/><link rel="stylesheet" href="assets/highlight.css"/><script defer src="assets/main.js"></script><script async src="assets/icons.js" id="tsd-icons-script"></script><script async src="assets/search.js" id="tsd-search-script"></script><script async src="assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base="."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="index.html" class="title">s2json-spec - v1.3.0</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><h2>s2json-spec - v1.3.0</h2></div><div class="tsd-panel tsd-typography"><h1 style="text-align: center;">
<div align="center">s2json</div>
</h1>

Expand All @@ -21,7 +21,9 @@
<a href="https://docs.rs/s2json">
<img src="https://img.shields.io/badge/docs-rust-yellow.svg" alt="docs-rust">
</a>
<img src="https://raw.githubusercontent.com/Open-S2/s2json/master/assets/doc-coverage.svg" alt="doc-coverage">
<a href="https://coveralls.io/github/Open-S2/s2json?branch=master">
<img src="https://coveralls.io/repos/github/Open-S2/s2json/badge.svg?branch=master" alt="code-coverage">
</a>
<a href="https://discord.opens2.com">
<img src="https://img.shields.io/discord/953563031701426206?logo=discord&logoColor=white" alt="Discord">
</a>
Expand Down Expand Up @@ -62,4 +64,4 @@
<a id="md:generating-coverage-report" class="tsd-anchor"></a><h3><a href="#md:generating-coverage-report">Generating Coverage Report</a></h3><p>To generate the coverage report, use the following command:</p>
<pre><code class="language-bash"><span class="hl-5">cargo</span><span class="hl-1"> </span><span class="hl-3">tarpaulin</span><br/><span class="hl-0"># bacon</span><br/><span class="hl-5">bacon</span><span class="hl-1"> </span><span class="hl-3">coverage</span><span class="hl-1"> </span><span class="hl-0"># or type `l` inside the tool</span>
</code><button>Copy</button></pre>
</div></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><h4 class="uppercase">Member Visibility</h4><form><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li></ul></form></div><div class="tsd-theme-toggle"><h4 class="uppercase">Theme</h4><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-index-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#md:about"><span>About</span></a><a href="#md:read-the-spec"><span>Read <wbr/>The <wbr/>Spec</span></a><a href="#md:install"><span>Install</span></a><a href="#md:development"><span>Development</span></a><ul><li><a href="#md:requirements"><span>Requirements</span></a></li><li><a href="#md:validated-your-data"><span>Validated <wbr/>Your <wbr/>Data</span></a></li><li><a href="#md:running-tests"><span>Running <wbr/>Tests</span></a></li><li><a href="#md:generating-coverage-report"><span>Generating <wbr/>Coverage <wbr/>Report</span></a></li></ul></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="modules.html" class="current"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-1"></use></svg><span>s2json-spec - v1.2.0</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base="."><li>Loading...</li></ul></nav></div></div></div><footer></footer><div class="overlay"></div></body></html>
</div></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><h4 class="uppercase">Member Visibility</h4><form><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li></ul></form></div><div class="tsd-theme-toggle"><h4 class="uppercase">Theme</h4><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-index-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#md:about"><span>About</span></a><a href="#md:read-the-spec"><span>Read <wbr/>The <wbr/>Spec</span></a><a href="#md:install"><span>Install</span></a><a href="#md:development"><span>Development</span></a><ul><li><a href="#md:requirements"><span>Requirements</span></a></li><li><a href="#md:validated-your-data"><span>Validated <wbr/>Your <wbr/>Data</span></a></li><li><a href="#md:running-tests"><span>Running <wbr/>Tests</span></a></li><li><a href="#md:generating-coverage-report"><span>Generating <wbr/>Coverage <wbr/>Report</span></a></li></ul></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="modules.html" class="current"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-1"></use></svg><span>s2json-spec - v1.3.0</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base="."><li>Loading...</li></ul></nav></div></div></div><footer></footer><div class="overlay"></div></body></html>
Loading

0 comments on commit cab6ea7

Please sign in to comment.