Skip to content

Commit

Permalink
update main.yml
Browse files Browse the repository at this point in the history
Signed-off-by: Bernhard Kaindl <[email protected]>
  • Loading branch information
bernhardkaindl committed Feb 14, 2024
1 parent fb67085 commit c1d531f
Showing 1 changed file with 19 additions and 26 deletions.
45 changes: 19 additions & 26 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
# podman system service -t 0 &
# act --bind --container-daemon-socket $XDG_RUNTIME_DIR/podman/podman.sock -W .github/workflows/main.yml
#--------------------------------------------------------------------------------------
name: "GitHub CI"
name: "Pytest test suites"

#
# The GitHub events that trigger this workflow:
# Checks can be skipped by adding "skip-checks: true" to a commit message,
# or requested by adding "request-checks: true" if disabled by default for pushes:
# https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/about-status-checks#skipping-and-requesting-checks-for-individual-commits
#
on: [push, pull_request]

# Docs: https://github.com/marketplace/actions/commit-status-updater#workflow-permissions
Expand All @@ -21,9 +23,11 @@ permissions:
pull-requests: write # creating a comment
statuses: write # # updating commit status

#
# Cancel a currently running workflow from the same PR, branch or tag
# when a new workflow is triggered:
# https://stackoverflow.com/questions/66335225/how-to-cancel-previous-runs-in-the-pr-when-you-push-new-commitsupdate-the-curre
#
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand Down Expand Up @@ -59,12 +63,12 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: LizardByte/setup-python-action@master
with:
python-version: 2.7

- name: Install dependencies
run: |
#: Install Python 2.7 from Ubuntu 20.04 using apt-get install
sudo apt-get update && sudo apt-get install -y python2
curl -sSL https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
python2 get-pip.py
if [ -f requirements.txt ]; then pip2 install -r requirements.txt; fi
if [ -f requirements-dev.txt ]; then pip2 install -r requirements-dev.txt; fi
pip2 install pylint==1.9.4
Expand All @@ -78,23 +82,17 @@ jobs:
--cov tests/
--junitxml=.git/pytest27.xml
--cov-report term-missing
--cov-report html:.git/coverage27.html
--cov-report xml:.git/coverage27.xml
- name: Upload coverage reports to Codecov for the Python 2.7 tests
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
if: env.CODECOV_TOKEN && !cancelled() && github.event.pull_request.number
run: >
curl -Os https://cli.codecov.io/latest/linux/codecov &&
sudo chmod +x codecov &&
./codecov do-upload --report-type test_results
--file .git/pytest27.xml
--token $CODECOV_TOKEN &&
./codecov do-upload --report-type coverage
--file .git/coverage27.xml
--flags python2.7
--token $CODECOV_TOKEN
rm -rfv codecov;curl -O https://cli.codecov.io/latest/linux/codecov &&
sudo chmod +x codecov && ./codecov upload-process --report-type coverage
--git-service github --fail-on-error --dir .git --file coverage27.xml
--flag python2.7 --name "Python 2.7 for main"
continue-on-error: true


Expand All @@ -111,7 +109,7 @@ jobs:
flags: python2.7
env_vars: OS,PYTHON
fail_ci_if_error: false
name: coverage27
name: "Python 2.7 for main"
verbose: true

- name: Add Pytest 2.7 coverage comment (if write permission is available)
Expand Down Expand Up @@ -184,15 +182,10 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: >
curl -Os https://cli.codecov.io/latest/linux/codecov &&
sudo chmod +x codecov &&
./codecov do-upload --report-type test_results
--file .git/pytest.xml
--token $CODECOV_TOKEN &&
./codecov do-upload --report-type coverage
--file .git/coverage.xml
--flags ${{ format('python{0}', steps.python.outputs.python-version ) }}
--token $CODECOV_TOKEN
pip install codecov-cli && codecovcli upload-process --report-type coverage
--git-service github --fail-on-error --dir .git --file coverage.xml
--flag python${{ steps.python.outputs.python-version }}
--name "Python 3.x for main"
continue-on-error: true


Expand All @@ -211,7 +204,7 @@ jobs:
fail_ci_if_error: false
flags: >
${{ format('python{0}', steps.python.outputs.python-version ) }}
name: coverage
name: "Python 3.x for main"
verbose: true


Expand Down

0 comments on commit c1d531f

Please sign in to comment.