1+ name : Update Coverage Badge
2+
3+ on :
4+ push :
5+ branches : [ main ]
6+
7+ env :
8+ POETRY_VERSION : " 1.8.3"
9+
10+ jobs :
11+ coverage :
12+ runs-on : ubuntu-latest
13+
14+ steps :
15+ - name : Check out repository
16+ uses : actions/checkout@v3
17+
18+ - name : Set up Python 3.11
19+ uses : actions/setup-python@v4
20+ with :
21+ python-version : ' 3.11'
22+ cache : ' pip'
23+
24+ - name : Install Poetry
25+ uses : snok/install-poetry@v1
26+ with :
27+ version : ${{ env.POETRY_VERSION }}
28+
29+ - name : Install dependencies
30+ run : |
31+ pip wheel --no-cache-dir --use-pep517 ml-dtypes
32+ poetry install --all-extras
33+
34+ - name : Set Redis image name
35+ run : |
36+ echo "REDIS_IMAGE=redis/redis-stack-server:latest" >> $GITHUB_ENV
37+
38+ - name : Run tests with coverage
39+ run : |
40+ poetry run pytest --cov=langgraph --cov-report=term --cov-report=json
41+ COVERAGE=$(python -c "import json; print(int(json.load(open('coverage.json'))['totals']['percent_covered']))")
42+ echo "COVERAGE=${COVERAGE}" >> $GITHUB_ENV
43+
44+ # Set color based on coverage
45+ if [ $COVERAGE -lt 70 ]; then
46+ echo "COLOR=red" >> $GITHUB_ENV
47+ elif [ $COVERAGE -lt 80 ]; then
48+ echo "COLOR=yellow" >> $GITHUB_ENV
49+ else
50+ echo "COLOR=green" >> $GITHUB_ENV
51+ fi
52+
53+ - name : Create Coverage Badge
54+ uses :
schneegans/[email protected] 55+ with :
56+ auth : ${{ secrets.GIST_TOKEN }}
57+ gistID : ${{ secrets.GIST_ID }}
58+ filename : langgraph-redis-coverage.json
59+ label : Coverage
60+ message : ${{ env.COVERAGE }}%
61+ color : ${{ env.COLOR }}
0 commit comments