Skip to content

Commit

Permalink
Initial commit: Add core functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
stes committed May 1, 2023
1 parent b2d87e7 commit 79412a0
Show file tree
Hide file tree
Showing 118 changed files with 9,036 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .clabot
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"contributors": "https://script.google.com/macros/s/AKfycbxMTfPIVni3XIT1gWJyt6ujOe3xMw3kdWpFbVQ6zZ1MS4eLiJCB2Jth3a1mrkoYHTIW/exec",
"message": "Thank you for your contribution. We require contributors to sign our Contributor License Agreement (CLA). We do not have a signed CLA on file for you. In order for us to review and merge your code, please sign our CLA [here](https://forms.gle/o5F7YiLCZ96vfhQ18). After you signed, you can comment on this PR with `@cla-bot check` to trigger another check.",
"label": "CLA signed",
"recheckComment": "Thanks for tagging me. I looked for a signed form under your signature again, and updated the status on this PR. If the check was successful, no further action is needed. If the check was unsuccessful, please see the instructions in my first comment."
}
48 changes: 48 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Python package

on:
push:
branches:
- main
- 'main*'

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
python-version: [3.8]
include:
- os: ubuntu-latest
path: ~/.cache/pip

steps:
- name: Checkout code
uses: actions/checkout@v2

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

- name: Install package
run: |
python -m pip install --upgrade pip setuptools wheel
- name: Run the formatter
run: |
make format
- name: Check that no binary files have been added to repo
run: |
make check_for_binary
- name: Build package
run: |
make build
run: |
make test
74 changes: 74 additions & 0 deletions .github/workflows/doc-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: PR Status
# Adapted from https://github.com/shift-happens-benchmark/icml-2022/blob/main/.github/workflows/pr-status.yml
# Apache 2.0 licensed


on:
pull_request:
branches:
- main
- 'main*'

jobs:
documentation-status:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8']

steps:
# NOTE(stes) currently not used, we check
# the entire codebase now by default.
#- uses: actions/checkout@v3
# with:
# ref: main
- uses: actions/checkout@v3
- uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip
restore-keys: |
${{ runner.os }}-pip
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install package
run: |
python -m pip install --upgrade pip setuptools wheel
pip install interrogate==1.5.0
- name: documentation
id: documentation
run: |
RESULT=$(make --silent interrogate)
RESULT=$(tail -n +3 <<< $RESULT)
STATUS=$(tail -n1 <<< $RESULT)
STATUS=$(sed 's/-//g' <<< $STATUS)
# trim
STATUS=$(echo $STATUS | xargs echo -n)
RESULT=$(head -n -1 <<< $RESULT)
# remove second to last line
RESULTA=$(head -n -2 <<< $RESULT)
RESULTB=$(tail -n1 <<< $RESULT)
NL=$'\n'
RESULT="$RESULTA${NL}||||||${NL}$RESULTB"
RESULT="$RESULT${NL}${NL}$STATUS"
RESULT="${RESULT//'%'/'%25'}"
RESULT="${RESULT//$'\n'/'%0A'}"
RESULT="${RESULT//$'\r'/'%0D'}"
echo "::set-output name=result::$RESULT"
continue-on-error: true
- name: comment documentation result on PR
uses: thollander/actions-comment-pull-request@v1
with:
message: |
## Docstring Coverage Report
${{ steps.documentation.outputs.result }}
comment_includes: '## Docstring Coverage Report'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# following snippet borrowed from
# https://stackoverflow.com/a/58003436
# CC BY-SA 4.0, Peter Evans
- name: Fail on insufficient coverage
if: steps.documentation.outcome != 'success'
run: exit 1
100 changes: 100 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Build docs

on:
push:
branches:
- main
pull_request:
branches:
- main
- 'main*'

jobs:
build:
runs-on: ubuntu-latest

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

- name: Checkout code
uses: actions/checkout@v3

- name: Checkout cebra figures
uses: actions/checkout@v3
with:
repository: AdaptiveMotorControlLab/cebra-figures
path: docs/source/cebra-figures
ref: main
token: ${{ secrets.GH_PAT_FIGURES }}

- name: Checkout assets
uses: actions/checkout@v3
with:
repository: AdaptiveMotorControlLab/cebra-assets
path: assets
ref: main
token: ${{ secrets.GH_PAT_FIGURES }}

- name: Add assets to repo
run: |
cp -r assets/* .
rm -r assets
- name: Checkout cebra demos
uses: actions/checkout@v3
with:
repository: AdaptiveMotorControlLab/cebra-demos
path: docs/source/demo_notebooks
ref: main
token: ${{ secrets.GH_PAT_FIGURES }}

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

- name: Install package
run: |
python -m pip install --upgrade pip setuptools wheel
sudo apt-get install -y pandoc
pip install torch --extra-index-url https://download.pytorch.org/whl/cpu
pip install '.[docs]'
- name: Build docs
run: |
ls docs/source/cebra-figures
# later also add the -n option to check for broken links
export SPHINXOPTS="-W --keep-going -n"
make docs
- name: Deploy docs (staging)
uses: cpina/github-action-push-to-another-repository@main
if: github.ref != 'refs/heads/main'
env:
API_TOKEN_GITHUB: ${{ secrets.GH_PAT_FIGURES }}
with:
source-directory: 'docs/page'
destination-github-username: 'stes'
destination-repository-name: 'cebra-ai'
user-name: stes
user-email: [email protected]
target-branch: staging

- name: Deploy docs (production)
uses: cpina/github-action-push-to-another-repository@main
if: github.ref == 'refs/heads/main'
env:
API_TOKEN_GITHUB: ${{ secrets.GH_PAT_FIGURES }}
with:
source-directory: 'docs/page'
destination-github-username: 'stes'
destination-repository-name: 'cebra-ai'
user-name: stes
user-email: [email protected]
target-branch: main

51 changes: 51 additions & 0 deletions .github/workflows/release-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Update internal release

on:
push:
tags:
- 'v*.*.*'
pull_request:
branches: [ main ]
types:
- labeled
- opened
- edited
- synchronize
- reopened

jobs:
release:
runs-on: ubuntu-latest

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

- name: Checkout code
uses: actions/checkout@v3

- name: Build and publish to Test PyPI
if: ${{ (github.ref != 'refs/heads/main') && (github.event.label.name == 'release') }}
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }}
run: |
make dist
ls dist/
tar tvf dist/cebra-*.tar.gz
python3 -m twine upload --repository testpypi dist/*
- name: Build and publish to PyPI
if: ${{ github.event_name == 'push' }}
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
make dist
ls dist/
tar tvf dist/cebra-*.tar.gz
python3 -m twine upload dist/*
Loading

0 comments on commit 79412a0

Please sign in to comment.