Fixing MSVC support #32
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI Pipeline | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- 'gbrl/**' # Trigger on changes to files in the src directory | |
pull_request: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
build-and-test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
python-version: ['3.10'] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies on Ubuntu | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y lcov g++ gcc | |
- name: Install dependencies on Windows | |
if: matrix.os == 'windows-latest' | |
run: | | |
python -m pip install --upgrade pip | |
- name: Set up MSVC environment | |
if: matrix.os == 'windows-latest' | |
run: | | |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat" | |
- name: Set environment variable for coverage | |
if: matrix.os == 'ubuntu-latest' | |
run: echo "COVERAGE=1" >> $GITHUB_ENV | |
- name: Install Python dependencies and build the project with coverage | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install coverage | |
pip install . | |
- name: Run tests with coverage | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
coverage run --source=gbrl -m unittest discover tests | |
- name: Run tests without coverage | |
if: matrix.os == 'windows-latest' | |
run: | | |
python -m unittest discover tests | |
- name: Generate coverage report | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
coverage report | |
coverage xml | |
- name: Generate C++ coverage report | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
lcov --capture --directory . --output-file coverage.info | |
lcov --remove coverage.info '/usr/*' --output-file coverage.info | |
lcov --list coverage.info | |
- name: Upload coverage reports as artifacts | |
if: matrix.os == 'ubuntu-latest' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-reports | |
path: | | |
coverage.xml | |
coverage.info |