Skip to content

Commit

Permalink
Attempt to compile and run the C++ code
Browse files Browse the repository at this point in the history
  • Loading branch information
fcooper8472 committed Jan 2, 2024
1 parent 83f1a4a commit 070a76e
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
49 changes: 49 additions & 0 deletions .github/workflows/test-code.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: "Test code blocks"

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:

jobs:
run-tests:

runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v3

- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install poetry
poetry install
- name: Test with pytest
run: |
poetry run pytest tests/extract.py
- name: Install C++ deps
run: |
sudo apt install libboost-math-dev
- name: Compile and run C++ files
run: |
g++ -o my_program pdf.cpp -lboost_math
g++ -o my_program logpdf.cpp -lboost_math
g++ -o my_program rvs.cpp -lboost_math
./pdf > pdf.out
./logpdf > logpdf.out
./rvs > rvs.out
cat rvs.out
working-directory: tests/normal/cpp
1 change: 0 additions & 1 deletion tests/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,3 @@ def test_code_files_exist():
assert (get_test_output_dir() / 'normal' / 'cpp' / 'pdf.cpp').is_file()
assert (get_test_output_dir() / 'normal' / 'cpp' / 'logpdf.cpp').is_file()
assert (get_test_output_dir() / 'normal' / 'cpp' / 'rvs.cpp').is_file()

0 comments on commit 070a76e

Please sign in to comment.