diff --git a/.github/workflows/docs-and-testcov.yml b/.github/workflows/docs-and-testcov.yml new file mode 100644 index 0000000..e683ec4 --- /dev/null +++ b/.github/workflows/docs-and-testcov.yml @@ -0,0 +1,68 @@ +name: docs-and-testcov + +on: + push: + branches: [main] +# pull_request: +# branches: [main] + workflow_dispatch: + +permissions: + contents: read + id-token: write + pages: write + +jobs: + docs-and-testcov: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + + - name: Build documentation + run: cargo doc --no-deps + + - name: Prepare documentation for Pages + run: | + + + - name: Install Cargo binstall + uses: cargo-bins/cargo-binstall@main + + - name: Install cargo-tarpaulin via binstall + run: cargo binstall cargo-tarpaulin --no-confirm --locked + + - name: Generate coverage report + run: | + mkdir -p testcov + cargo tarpaulin --out Html + + - name: Check for tarpaulin-report.html + run: | + if [ ! -f tarpaulin-report.html ]; then + echo "tarpaulin-report.html not found!" + exit 1 + fi + + - name: Copy files to output directory + run: | + mkdir output + cp tarpaulin-report.html target/doc/rustframe/ + echo "" > target/doc/index.html + + - name: Upload Pages artifact + if: github.event_name == 'push' + uses: actions/upload-pages-artifact@v3 + with: + path: target/doc/ + + - name: Deploy to GitHub Pages + if: github.event_name == 'push' + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/run-unit-tests.yml b/.github/workflows/run-unit-tests.yml index 860f96d..eb5b81f 100644 --- a/.github/workflows/run-unit-tests.yml +++ b/.github/workflows/run-unit-tests.yml @@ -20,6 +20,8 @@ jobs: uses: taiki-e/install-action@cargo-llvm-cov - name: Generate code coverage run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info + - name: Test docs generation + run: cargo doc --no-deps - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 with: diff --git a/.gitignore b/.gitignore index 1f5fdb2..3aafca8 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,6 @@ data/ *.pkl .env -.venv/ \ No newline at end of file +.venv/ + +tarpaulin-report.html \ No newline at end of file diff --git a/README.md b/README.md index 80aebc7..c7d7494 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,11 @@ # rustframe -A simple dataframe library. \ No newline at end of file +[![codecov](https://codecov.io/gh/Magnus167/rustframe/graph/badge.svg?token=J7ULJEFTVI)](https://codecov.io/gh/Magnus167/rustframe) + +A simple dataframe library. + +--- + +`tarpaulin` coverage report: [tarpaulin-report](tarpaulin-report.html). + +--- diff --git a/src/lib.rs b/src/lib.rs index 6c9faf4..7ea02d4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,7 @@ +#![doc = include_str!("../README.md")] pub mod matrix; pub mod frame; -pub mod utils; \ No newline at end of file +pub mod utils;