Skip to content

Commit

Permalink
GitHub action update (#1385)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdazam1942 authored Mar 15, 2023
1 parent 8182d0d commit 8fed1fa
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 13 deletions.
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

0 comments on commit 8fed1fa

Please sign in to comment.