Skip to content

Commit

Permalink
Merge branch 'main' into provide-a-devcontainer-to-be-used-in-codespace
Browse files Browse the repository at this point in the history
  • Loading branch information
turnmanh committed Jun 11, 2024
2 parents d465168 + fa6a874 commit 6883630
Show file tree
Hide file tree
Showing 158 changed files with 35,112 additions and 5,492 deletions.
1 change: 1 addition & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ your code.
- [ ] I performed linting and formatting as described in the [contribution
guidelines](https://github.com/sbi-dev/sbi/blob/main/CONTRIBUTING.md)
- [ ] I rebased on `main` (or there are no conflicts with `main`)
- [ ] For reviewer: The continuous deployment (CD) workflow are passing.
28 changes: 28 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# The official docs
# https://docs.codecov.io/docs/codecov-yaml
# https://docs.codecov.com/docs/common-recipe-list

# Check if this file is valid
# cd PATH_TO/sbi/.github
# curl -X POST --data-binary @codecov.yml https://codecov.io/validate

ignore:
- "sbi/examples"

coverage:
status:
project:
default:
target: 70% # the required coverage value
threshold: 2% # allow the coverage to drop by X%, and posting a success status
if_ci_failed: error # will set the status to success only if the CI is successful, alternative: success
patch: # about the individual commit
default:
target: 50% # minimum coverage ratio that the commit must meet to be considered a success
threshold: 2% # allow the coverage to drop by X%, and posting a success status
if_ci_failed: error # will set the status to success only if the CI is successful, alternative: success

comment:
layout: "diff, flags, files"
behavior: default # update if exists, otherwise post new
require_changes: false # if true, only post the comment if coverage changes
62 changes: 62 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Continuous Deployment

on:
push:
branches: [main]
workflow_dispatch:

defaults:
run:
shell: bash

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

jobs:
cd:
name: CD
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: false

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

- name: Cache dependency
id: cache-dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[dev]
- name: Run the fast and the slow CPU tests with coverage
run: |
pytest -v -x -n auto -m "not gpu" --cov=sbi --cov-report=xml tests/
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4-beta
with:
env_vars: OS,PYTHON
file: ./coverage.xml
flags: unittests
name: codecov-sbi-all-cpu
token: ${{ secrets.CODECOV_TOKEN }}

- name: Check doc building
run: |
jupyter nbconvert --to markdown tutorials/*.ipynb --output-dir docs/tutorial/
jupyter nbconvert --to markdown examples/*.ipynb --output-dir docs/examples/
mkdocs build -f docs/mkdocs.yml --site-dir site
65 changes: 65 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Continuous Integration

on: [pull_request, workflow_dispatch]

defaults:
run:
shell: bash

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

jobs:
ci:
name: CI
runs-on: ubuntu-latest
if: |
github.event_name == 'push' ||
(github.event_name == 'pull_request' && github.event.pull_request.draft == false)
strategy:
fail-fast: false
matrix:
python-version: ['3.8']
torch-version: ['1.11', '2.2']

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: false

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Cache dependency
id: cache-dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ matrix.torch-version }}$
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install torch==${{ matrix.torch-version }} --extra-index-url https://download.pytorch.org/whl/cpu
pip install -e .[dev]
- name: Run the fast CPU tests with coverage
run: |
pytest -v -x -n auto -m "not slow and not gpu" --cov=sbi --cov-report=xml tests/
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
env_vars: OS,PYTHON
file: ./coverage.xml
flags: unittests
name: codecov-sbi-fast-cpu
token: ${{ secrets.CODECOV_TOKEN }}
62 changes: 62 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Linting

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

defaults:
run:
shell: bash

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

jobs:
pre-commit:
name: ruff and hooks.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.8'
- uses: pre-commit/action@v3.0.1
with:
extra_args: --all-files --show-diff-on-failure

pyright:
name: Check types
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: false

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

- name: Cache dependency
id: cache-dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ubuntu-latest-pip-3.8
restore-keys: |
ubuntu-latest-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install torch --extra-index-url https://download.pytorch.org/whl/cpu
pip install -e .[dev]
- name: Check types with pyright
run: |
pyright sbi
65 changes: 65 additions & 0 deletions .github/workflows/manual_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Manual-Test

on:
workflow_dispatch:
inputs:
pytest-marker:
description: "Combination of markers to restrict the tests, use '' to run all tests."
type: choice
options:
- 'not slow and not gpu'
- 'not gpu'
- 'not slow'
- ''
default: ''
required: true

defaults:
run:
shell: bash

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

jobs:
test:
name: manual-test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.8']
torch-version: ['1.11', '2.2']

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: false

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Cache dependency
id: cache-dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ matrix.torch-version }}$
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install torch==${{ matrix.torch-version }} --extra-index-url https://download.pytorch.org/whl/cpu
pip install -e .[dev]
- name: Run the selected tests without coverage
run: |
pytest -v -x -m ${{ inputs.pytest-marker }} tests/
71 changes: 0 additions & 71 deletions .github/workflows/tests.yml

This file was deleted.

1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ repos:
rev: v0.3.3
hooks:
- id: ruff
args: [--diff]
- id: ruff-format
args: [--diff]
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand Down
Loading

0 comments on commit 6883630

Please sign in to comment.