-
Notifications
You must be signed in to change notification settings - Fork 6
102 lines (85 loc) · 3.12 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
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, macos-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
sudo apt-get install -y g++ gcc
- name: Install LLVM via Homebrew
if: matrix.os == 'macos-latest'
run: brew install libomp llvm
- name: Configure Environment Variables
if: matrix.os == 'macos-latest'
run: |
echo "PATH=$(brew --prefix llvm)/bin:$PATH" >> $GITHUB_ENV
echo "LDFLAGS=-L$(brew --prefix libomp)/lib -L$(brew --prefix llvm)/lib -L$(brew --prefix llvm)/lib/c++ -Wl,-rpath,$(brew --prefix llvm)/lib/c++" >> $GITHUB_ENV
echo "CPPFLAGS=-I$(brew --prefix libomp)/include -I$(brew --prefix llvm)/include" >> $GITHUB_ENV
echo "CC=$(brew --prefix llvm)/bin/clang" >> $GITHUB_ENV
echo "CXX=$(brew --prefix llvm)/bin/clang++" >> $GITHUB_ENV
echo "DYLD_LIBRARY_PATH=$(brew --prefix llvm)/lib:$(brew --prefix libomp)/lib" >> $GITHUB_ENV
- name: Set up MSVC environment
if: matrix.os == 'windows-latest'
run: |
& "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\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
run: |
python -m unittest discover tests
# - 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