Skip to content

Commit

Permalink
Split out CI and coverage actions
Browse files Browse the repository at this point in the history
  • Loading branch information
j4ckofalltrades committed Mar 15, 2024
1 parent 5227a0f commit 7511a69
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 21 deletions.
50 changes: 29 additions & 21 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,43 @@
name: CI
name: "CI"

permissions: "read-all"

on:
push:
branches:
- main
- "main"
pull_request:
workflow_dispatch:

defaults:
run:
shell: "bash"

env:
FORCE_COLOR: "1"

jobs:
coverage:
runs-on: ubuntu-latest
env:
OS: ubuntu-latest
PYTHON: '3.9'
test:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]

name: "Test (${{ matrix.python-version }})"
runs-on: "ubuntu-latest"
continue-on-error: false

steps:
- uses: actions/checkout@v3
- name: "Checkout repository"
uses: "actions/checkout@v4"

- name: Setup Python
uses: actions/setup-python@v4
- name: "Setup Python"
uses: "actions/setup-python@v4"
with:
python-version: 3.9
python-version: "${{ matrix.python-version }}"

- name: Generate coverage report
- name: "Run tests"
run: |
python -m pip install poetry
poetry install --with test
poetry run pytest --cov=src/powerline_k8s --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
env_vars: OS,PYTHON
fail_ci_if_error: true
verbose: true
poetry run pytest
34 changes: 34 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "Codecov"

on: [push]

jobs:
coverage:
runs-on: "ubuntu-latest"
env:
OS: "ubuntu-latest"
PYTHON: '3.10'
environment:
name: "codecov"
steps:
- uses: "actions/checkout@master"

- name: "Setup Python"
uses: "actions/setup-python@master"
with:
python-version: "3.10"

- name: "Generate coverage report"
run: |
pip install pytest
pip install pytest-cov
pytest --cov=./ --cov-report=xml
- name: "Upload coverage to Codecov"
uses: "codecov/codecov-action@v4"
with:
files: ./coverage.xml
env_vars: OS,PYTHON
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}

0 comments on commit 7511a69

Please sign in to comment.