Skip to content
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

Add GitHub action testing #24

Merged
merged 16 commits into from
Feb 23, 2024
Merged
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
47 changes: 47 additions & 0 deletions .github/workflows/basic-install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Clean install

on:
push:
branches: [ "github-main" ]
pull_request:
branches: [ "github-main" ]

jobs:
build:

runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install
run: python -m pip install .
- name: List environment
run: python -m pip list installed
- name: Test imports
run: |
python -c "import bilby"
python -c "import bilby.bilby_mcmc"
python -c "import bilby.core"
python -c "import bilby.core.prior"
python -c "import bilby.core.sampler"
python -c "import bilby.core.utils"
python -c "import bilby.gw"
python -c "import bilby.gw.detector"
python -c "import bilby.gw.eos"
python -c "import bilby.gw.likelihood"
python -c "import bilby.gw.sampler"
python -c "import bilby.hyper"
python -c "import cli_bilby"
python test/import_test.py
# - if: ${{ matrix.os != "windows-latest" }}
# run: |
# for script in $(pip show -f bilby | grep "bin\/" | xargs -I {} basename {}); do
# ${script} --help;
# done
46 changes: 46 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: GitHub Pages

on:
push:
branches:
- github-main
pull_request:
branches:
- github-main

jobs:
deploy:
runs-on: ubuntu-latest
container: containers.ligo.org/lscsoft/bilby/v2-bilby-python310
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: install
run: python -m pip install .
- name: Run jupyter notebooks
run: |
python -m ipykernel install
cd examples/tutorials
jupyter nbconvert --to notebook --execute *.ipynb --output-dir ../../docs
cd -
- name: Build docs
run: |
cd docs
make clean
make html
cd -
# Upload the build docs as an artifact until we expose the pages
- uses: actions/upload-artifact@v4
with:
name: docs-html
path: docs/_build/html/
# Disable docs deployment until we move primarily to GitHub
# - name: Deploy
# uses: peaceiris/actions-gh-pages@v3
# if: ${{ github.ref == 'refs/heads/master' }}
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# publish_dir: .
20 changes: 20 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: pre-commit

on:
push:
branches: [ "github-main" ]
pull_request:
branches: [ "github-main" ]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- name: Install jupyter
run: |
python -m pip install jupyterlab
- uses: pre-commit/[email protected]
- uses: pre-commit-ci/[email protected]
if: always()
34 changes: 34 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python package

on:
push:
branches: [ "github-main" ]
pull_request:
branches: [ "github-main" ]

jobs:
build:

runs-on: ubuntu-latest
container: containers.ligo.org/lscsoft/bilby/v2-bilby-python310
strategy:
fail-fast: false

steps:
- uses: actions/checkout@v3
- name: Install package
run: |
python -m pip install .
conda list --show-channel-urls
# - name: Run precommits
# run: |
# pre-commit run --all-files --verbose --show-diff-on-failure
- name: Run unit tests
run: |
pytest --cov=bilby --durations 10
- name: Run sampler tests
run: |
pytest test/integration/sampler_run_test.py --durations 10 -v
Loading