Skip to content

Add GitHub Actions CI/CD pipeline with comprehensive test coverage #109

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

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Tests

on:
push:
branches: [ master, main ]
pull_request:
branches: [ master, main ]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
tools: composer

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y graphviz graphviz-dev locales
sudo locale-gen en_US.UTF-8

- name: Set environment variables
run: |
echo "LANG=en_US.UTF-8" >> $GITHUB_ENV
echo "LC_ALL=en_US.UTF-8" >> $GITHUB_ENV

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements_dev.txt

- name: Install JavaScript dependencies
run: |
cd code2flow
npm install acorn

- name: Install Ruby dependencies
run: |
gem install parser

- name: Install PHP dependencies
run: |
cd code2flow
COMPOSER_AUTH='{}' composer require nikic/php-parser "^4.10" --no-interaction

- name: Run tests with coverage
run: |
pytest --cov-report=xml --cov-report=term --cov=code2flow tests/

- name: Upload coverage to Codecov
if: matrix.python-version == '3.11'
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@ __pycache__
out.*
.coverage*
htmlcov
build/
.build/
*.egg-info
dist
composer.json
composer.lock
vendor
node_modules/
package-lock.json
package.json
coverage.xml
.pytest_cache/
*.pyc
2 changes: 1 addition & 1 deletion code2flow/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ def main(sys_argv=None):
parser.add_argument(
'--version', action='version', version='%(prog)s ' + VERSION)

sys_argv = sys_argv or sys.argv[1:]
sys_argv = sys_argv if sys_argv is not None else sys.argv[1:]
args = parser.parse_args(sys_argv)
level = logging.INFO
if args.verbose and args.quiet:
Expand Down
1 change: 0 additions & 1 deletion code2flow/node_modules/.bin/acorn

This file was deleted.

18 changes: 0 additions & 18 deletions code2flow/node_modules/.package-lock.json

This file was deleted.

Loading