diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 47029a2..21f397d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,7 +44,18 @@ jobs: - name: Run tests run: mix test env: - MIX_ENV: dev + MIX_ENV: test + + - name: Run test coverage + run: mix coveralls.json + env: + MIX_ENV: test + + - name: Upload coverage report + uses: actions/upload-artifact@v3 + with: + name: coverage-report + path: cover/excoveralls.json - name: Check formatting run: mix format --check-formatted diff --git a/README.md b/README.md index ca37ab0..4d0a18f 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,31 @@ mix phx.server - Migrate: `mix ecto.migrate` - Reset: `mix ecto.reset` +### ๐Ÿงช Testing Magic + +- **Run All Tests**: `mix test` +- **Mock the Database**: + To use a mock database for testing, set the `MOCK_REPO` environment variable: + +```bash +MOCK_REPO=true mix test +``` + +- **Test Coverage**: + Unveil the secrets of your test coverage: + +```bash +MIX_ENV=test mix coveralls +``` + +For a detailed HTML report, cast this spell: + +```bash +MIX_ENV=test mix coveralls.html +``` + +The mystical report will appear in `cover/excoveralls.html`. + ### ๐Ÿ” Code Quality and Security Ensure your code is top-notch with these magical incantations: