-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TST: Add GitHub action testing (#24)
* TST: Create unit-tests.yml * TST: try explicit version * TST: Remove unnecessary setup python * TST: disable precommit tests * TST: typo * TST: add pre-commit tests * TST: try installing jupyter for pre-commit * TST: add install/import tests * TST: just install basic version * TST: typo fixes * TST: done run executable tests on windows * TST: another attempt to disable executable tests for windows * TST: remove executable tests * DOC: add documentation job * DOC: make sure to pull tags for docs job * BLD: upload docs as an artifact
- Loading branch information
1 parent
cd9ef91
commit c5556bb
Showing
4 changed files
with
147 additions
and
0 deletions.
There are no files selected for viewing
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
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 |
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
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: . |
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
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() |
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
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 |