Skip to content

Commit

Permalink
Merge branch 'main' into fix-symmetric-log-uniform
Browse files Browse the repository at this point in the history
  • Loading branch information
ColmTalbot authored Nov 1, 2024
2 parents 980e0cb + 8b2f6cf commit 506ad42
Show file tree
Hide file tree
Showing 98 changed files with 1,475 additions and 781 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/basic-install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Clean install

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
release:
types:
- published

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:

runs-on: ${{ matrix.os }}
strategy:
matrix:
# disable windows build test as bilby_cython is currently broken there
os: [ubuntu-latest, macos-latest]
python-version: ["3.10", "3.11", "3.12"]
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
60 changes: 60 additions & 0 deletions .github/workflows/build-containers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Build images

on:
schedule:
- cron: "15 0 * * *"
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-container:
permissions:
contents: read
packages: write
attestations: write
id-token: write
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["310", "311", "312"]
steps:
- uses: actions/checkout@v4
- name: Setup dockerfile
run: |
cp containers/v3-dockerfile-test-suite-python${{ matrix.python-version }} Dockerfile
cp containers/env-template.yml .
- name: Login to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
tags: type=raw,value=latest
images: ghcr.io/${{ env.IMAGE_NAME }}-python${{ matrix.python-version }}

- name: Build and push Docker image
id: push
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
tags: ${{ steps.meta.outputs.tags }}
push: true
labels: ${{ steps.meta.outputs.labels }}

# FIXME: disabled as it is not working well but should probably be added in later
# https://docs.github.com/en/actions/security-for-github-actions/using-artifact-attestations/using-artifact-attestations-to-establish-provenance-for-builds
# - name: Generate artifact attestation
# uses: actions/attest-build-provenance@v1
# with:
# subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
# subject-digest: ${{ steps.push.outputs.digest }}
# push-to-registry: true
61 changes: 61 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: GitHub Pages

permissions:
contents: read
pages: write
id-token: write
packages: read

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
release:
types:
- published

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
container: ghcr.io/bilby-dev/bilby-python311:latest
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
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/_build/html/
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
27 changes: 27 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: pre-commit

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
release:
types:
- published

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

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()
45 changes: 45 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Publish Python distribution to PyPI
on:
release:
types: [published]

jobs:
build:
name: Build distribution
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

pypi-publish:
name: Upload release to PyPI
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
41 changes: 41 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# 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: Unit testing

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
release:
types:
- published

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:

runs-on: ubuntu-latest
container: ghcr.io/bilby-dev/bilby-python311:latest
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

0 comments on commit 506ad42

Please sign in to comment.