Skip to content

Fix typos

Fix typos #50

Workflow file for this run

name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
ocaml-compiler:
- 4.14.x
- 5.2.x
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up OCaml
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
dune-cache: true
- name: Install dependencies
run: |
eval $(opam env)
opam install . --deps-only --with-test --with-dev-setup --yes
opam install ppx_deriving --yes
- name: Build
run: opam exec -- dune build
- name: Build and run tests with coverage
if: matrix.ocaml-compiler == '5.2.x'
run: |
mkdir -p _coverage
export BISECT_FILE=$(pwd)/_coverage/bisect
export BISECT_ENABLE=yes
echo "BISECT_FILE is set to: $BISECT_FILE"
echo "BISECT_ENABLE is set to: $BISECT_ENABLE"
opam exec -- dune clean
opam exec -- dune build --instrument-with bisect_ppx
echo "Running tests with coverage instrumentation..."
opam exec -- dune runtest --instrument-with bisect_ppx --force
echo "Test run completed. Checking for coverage files..."
ls -la _coverage/ || echo "_coverage directory not found after tests"
continue-on-error: true
- name: Run tests without coverage
if: matrix.ocaml-compiler != '5.2.x'
run: |
opam exec -- dune runtest
continue-on-error: true
- name: Check coverage files
if: matrix.ocaml-compiler == '5.2.x'
run: |
echo "Checking for coverage files..."
echo "Contents of _coverage directory:"
ls -la _coverage/ || echo "_coverage directory doesn't exist"
echo ""
echo "Looking for .coverage files:"
find _coverage -name "*.coverage" -type f 2>/dev/null | tee /tmp/coverage_files.txt || true
if [ ! -s /tmp/coverage_files.txt ]; then
echo "ERROR: No .coverage files found!"
echo "Checking if bisect files exist without .coverage extension:"
find _coverage -type f 2>/dev/null || echo "No files at all in _coverage"
exit 1
else
echo "Found coverage files:"
cat /tmp/coverage_files.txt
fi
- name: Generate coverage report
if: matrix.ocaml-compiler == '5.2.x'
run: |
echo "Generating HTML coverage report..."
opam exec -- bisect-ppx-report html --coverage-path _coverage || (echo "Failed to generate HTML report" && exit 1)
echo "Generating summary..."
opam exec -- bisect-ppx-report summary --coverage-path _coverage || (echo "Failed to generate summary" && exit 1)
echo "Generating Cobertura XML..."
opam exec -- bisect-ppx-report cobertura coverage.xml --coverage-path _coverage || (echo "Failed to generate Cobertura XML" && exit 1)
echo "Coverage reports generated successfully"
- name: Upload coverage to Codecov
if: matrix.ocaml-compiler == '5.2.x'
uses: codecov/codecov-action@v4
with:
files: ./coverage.xml
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}