Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub action update #1385

Merged
merged 18 commits into from
Mar 15, 2023
Merged
41 changes: 41 additions & 0 deletions .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Code Coverage Analysis

on:
push:
branches:
- develop
pull_request:
branches:
- develop
types:
- opened
- edited
- reopened
- synchronize
- unlocked

jobs:
codecov:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install dependencies
run: |
python generate_requirements.py
pip install --upgrade pip setuptools wheel
pip install -r requirements-dev.txt
- name: Run test and generate coverage report
run: |
pip install pytest-cov
pip install codecov
pytest --cov=./ --cov-report=xml
- name: Upload coverage information to Codecov
uses: codecov/codecov-action@v3
with:
version: "v0.2.6"
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)
19 changes: 7 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: stix-shifter
name: CI Build

on: [push, pull_request]

Expand All @@ -14,11 +14,13 @@ jobs:
python-version: [3.8, 3.9]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: '**/requirements-dev.txt'
- name: Install dependencies
run: |
python generate_requirements.py
Expand All @@ -31,14 +33,7 @@ jobs:
flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Run test and generate coverage report
- name: Run unittest
run: |
pip install pytest
pip install pytest-cov
pip install codecov
pytest --cov=./ --cov-report=xml
- name: Upload coverage information to Codecov
uses: codecov/codecov-action@v1
with:
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)
pytest -vv
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[![example workflow](https://github.com/opencybersecurityalliance/stix-shifter/actions/workflows/main.yml/badge.svg)](https://github.com/opencybersecurityalliance/stix-shifter/actions)
[![codecov](https://codecov.io/gh/opencybersecurityalliance/stix-shifter/branch/develop/graph/badge.svg?token=gQvl14peRj)](https://codecov.io/gh/opencybersecurityalliance/stix-shifter)

### Join us on Slack!
Expand Down
1 change: 0 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ pluggy==1.0.0
pycodestyle==2.3.1
pyflakes==1.6.0
pylint==2.15.5
pytest-cov==4.0.0
pytest==7.2.0
requests_mock==1.7.0
six==1.12.0
Expand Down