I have a workflow that looks like this:
on:
push:
branches:
- master
jobs:
git_pull:
runs-on: self-hosted
steps:
- name: executing remote ssh commands
uses: appleboy/[email protected]
with:
host: <IP addr>
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_KEY }}
port: 22
script_stop: true
script: |
cd /my-api
rm -f /my-api/test-results.xml
ssh-agent bash -c 'ssh-add /root/.ssh/pubkey; git pull origin master'
# Ensure the directory exists and has the correct permissions
sudo mkdir -p /my-api
sudo chown -R $USER:$USER /my-api
systemctl stop my-api
pytest --junit-xml=test-results.xml generated_tests.py
coverage run -m pytest generated_tests.py
coverage report > coverage-report.txt
cat coverage-report.txt
systemctl start my-api
- name: Fetch and print coverage report
uses: appleboy/[email protected]
with:
host: <IP addr>
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_KEY }}
port: 22
script_stop: true
script: |
cat /my-api/coverage-report.txt >> $GITHUB_OUTPUT
- name: Surface failing tests
if: always()
uses: pmeier/pytest-results-action@main
with:
path: /my-api/test-results.xml
summary: true
fail-on-empty: true
title: Test results
As you can see, I have been trying to log the coverage report but it is not logging.
This won’t print the coverage report in any way in spite of me trying many variations of cat
, tee
and >> $GITHUB_OUTPUT
What is an easy way to log the coverage report
into the GitHub logs or the summary page?
New contributor
Yee Bee is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.