Skip to content

Remove sparse-checkout configuration from test.yml #35

Remove sparse-checkout configuration from test.yml

Remove sparse-checkout configuration from test.yml #35

Workflow file for this run

name : Python coverage
on:
push:
branches: [ "develop" ]
pull_request:
branches: [ "develop" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run : |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Test with pytest
id: test
run: |
coverage run -m pytest
coverage report -m
echo "coverage_score=$(coverage report -m | awk 'END{print$4}')" >> "${GITHUB_OUTPUT}"
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_REF#refs/heads/}" >> "${GITHUB_OUTPUT}"
id: extract_branch
- uses: actions/checkout@v4
with:
ref: badges
- name: Prepare badge
id: prepare
run: |
echo "coverage_badge_path=${{steps.extract_branch.outputs.branch}}" >> "${GITHUB_OUTPUT}"
mkdir -p ${{steps.extract_branch.outputs.branch}}
- name: Add coverage badge
uses: emibcn/badge-action@v2.0.2
with:
label: 'Test coverage'
status: ${{ steps.test.outputs.coverage_score }}
color: 'blue'
path: ${{ steps.prepare.outputs.coverage_badge_path }}/coverage.svg
- name: Commit badge
id: commit
run: |
ls ${{ steps.prepare.outputs.coverage_badge_path }}/coverage.svg
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add ${{ steps.prepare.outputs.coverage_badge_path }}
git commit -m "Add coverage badge"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: badges