Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/josecfreittas/elixir-coverage-feedback-action
Action to run tests, check coverage, and send a feedback message to the pull request.
https://github.com/josecfreittas/elixir-coverage-feedback-action
ci coverage elixir phoenix tests
Last synced: about 1 month ago
JSON representation
Action to run tests, check coverage, and send a feedback message to the pull request.
- Host: GitHub
- URL: https://github.com/josecfreittas/elixir-coverage-feedback-action
- Owner: josecfreittas
- License: mit
- Created: 2022-06-15T15:57:21.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-28T11:19:58.000Z (4 months ago)
- Last Synced: 2024-10-29T20:16:35.313Z (about 2 months ago)
- Topics: ci, coverage, elixir, phoenix, tests
- Language: Elixir
- Homepage:
- Size: 307 KB
- Stars: 8
- Watchers: 2
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Elixir coverage feedback comment
This action gets the output of `mix test --cover`, treats it, and creates a feedback message in the pull request of origin. It also checks if the coverage reaches the minimum configured in the action, and exits with an error if it doesn't.![image](https://user-images.githubusercontent.com/10376340/200857131-94cb2147-d703-4965-be5c-6cd6521826da.png#gh-light-mode-only)
![image](https://user-images.githubusercontent.com/10376340/200857627-8232b1de-fcbe-4b68-9f30-df2b89b61ccf.png#gh-dark-mode-only)## Inputs
The action accepts the following inputs:- `github_token` (required): GitHub token to be able to create/edit comments on PRs.
- `coverage_threshold` (optional): Coverage threshold percentage. Default is 90.
- `working_directory` (optional): Working directory for the Elixir project. Default is the root directory (".").## Example of a complete test workflow using the action
`.github/workflows/test.yml````yaml
on:
pull_request:
push:
branches:
- mainjobs:
test:
name: Tests & Checks
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
env:
MIX_ENV: testservices:
db:
image: postgres:15-alpine
ports: ["5432:5432"]
env:
POSTGRES_DB: project_test
POSTGRES_USER: project
POSTGRES_PASSWORD: mycoolpasswordsteps:
- uses: actions/checkout@v4- name: Setup Erlang and Elixir
uses: erlef/[email protected]
with:
elixir-version: "1.16.0-otp-26"
otp-version: "26.0"- name: Mix and build cache
uses: actions/cache@v4
with:
path: |
deps
_build
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix-- name: Get dependencies
run: mix deps.get- name: Code analyzers
run: |
mix format --check-formatted
mix compile --warnings-as-errors- name: Tests & Coverage
uses: josecfreittas/elixir-coverage-feedback-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
coverage_threshold: 80
# working_directory: ./your_project_directory
```