Skip to content

Commit 2df7421

Browse files
authored
Merge pull request #18 from FelixNgFender/main
4 Data modalities, python typings, python testing and CLI, client multithreading for send function
2 parents d3e994c + 7b16f31 commit 2df7421

File tree

251 files changed

+17049
-10568
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

251 files changed

+17049
-10568
lines changed

.github/workflows/ci.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
pull_request:
9+
branches:
10+
- main
11+
12+
# Allows you to run this workflow manually from the Actions tab
13+
workflow_dispatch:
14+
15+
# security: restrict permissions for CI jobs.
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
server-ci:
21+
name: Server CI
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- name: Install Python
27+
id: install_python
28+
uses: actions/setup-python@v5
29+
with:
30+
python-version: "3.10"
31+
32+
- name: Install Poetry
33+
uses: abatilo/actions-poetry@v2
34+
with:
35+
poetry-version: "1.8.3"
36+
37+
- name: Setup a local virtual environment (if no poetry.toml file)
38+
working-directory: ./python
39+
run: |
40+
poetry config virtualenvs.create true --local
41+
poetry config virtualenvs.in-project true --local
42+
43+
- name: Restore cached virtualenv
44+
uses: actions/cache/restore@v4
45+
with:
46+
path: ./python/.venv
47+
key: venv-${{ runner.os }}-${{ steps.install_python.outputs.python-version }}-${{ hashFiles('./python/poetry.lock') }}
48+
49+
- name: Install dependencies (used by later workflows)
50+
working-directory: ./python
51+
run: |
52+
poetry install
53+
echo "$(poetry env info --path)/bin" >> $GITHUB_PATH
54+
echo "VIRTUAL_ENV=$(poetry env info --path)/bin" >> $GITHUB_ENV
55+
56+
- name: Saved cached virtualenv
57+
uses: actions/cache/save@v4
58+
with:
59+
path: ./python/.venv
60+
key: venv-${{ runner.os }}-${{ steps.install_python.outputs.python-version }}-${{ hashFiles('./python/poetry.lock') }}
61+
62+
- name: Lint with ruff
63+
working-directory: ./python
64+
run: ruff check --output-format=github
65+
66+
- name: Typecheck with pyright
67+
working-directory: ./python
68+
run: pyright arflow
69+
70+
- name: Test with pytest
71+
working-directory: ./python
72+
timeout-minutes: 5 # pytest sometimes hangs for (yet) unknown reasons
73+
# TODO: Add coverage tracking once we have a stable test suite
74+
run: |
75+
pytest

.github/workflows/main.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

.github/workflows/pre-release.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Pre-release
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
# Allows you to run this workflow manually from the Actions tab
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
release:
16+
name: Release package
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Install Python
22+
id: install_python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: "3.10"
26+
27+
- name: Install Poetry
28+
uses: abatilo/actions-poetry@v2
29+
with:
30+
poetry-version: "1.8.3"
31+
32+
- name: Setup a local virtual environment (if no poetry.toml file)
33+
working-directory: ./python
34+
run: |
35+
poetry config virtualenvs.create true --local
36+
poetry config virtualenvs.in-project true --local
37+
38+
- name: Restore cached virtualenv
39+
uses: actions/cache/restore@v4
40+
with:
41+
path: ./python/.venv
42+
key: venv-${{ runner.os }}-${{ steps.install_python.outputs.python-version }}-${{ hashFiles('./python/poetry.lock') }}
43+
44+
- name: Install dependencies (skipped if cache hit, fallback to install)
45+
working-directory: ./python
46+
run: |
47+
poetry install
48+
echo "$(poetry env info --path)/bin" >> $GITHUB_PATH
49+
echo "VIRTUAL_ENV=$(poetry env info --path)/bin" >> $GITHUB_ENV
50+
51+
- name: Saved cached virtualenv
52+
uses: actions/cache/save@v4
53+
with:
54+
path: ./python/.venv
55+
key: venv-${{ runner.os }}-${{ steps.install_python.outputs.python-version }}-${{ hashFiles('./python/poetry.lock') }}
56+
57+
- name: Configure Test PyPI with Poetry
58+
working-directory: ./python
59+
run: |
60+
poetry config repositories.testpypi https://test.pypi.org/legacy/
61+
poetry config pypi-token.testpypi ${{ secrets.TEST_PYPI_API_TOKEN }}
62+
63+
- name: Build and publish the package
64+
working-directory: ./python
65+
run: poetry publish --build -r testpypi
Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,17 @@
1-
# Simple workflow for deploying static content to GitHub Pages
2-
name: Deploy static content to Pages
1+
name: Publish docs
32

43
on:
5-
# Runs on pushes targeting the default branch
6-
push:
7-
branches:
8-
- main
9-
paths:
10-
- 'python/**'
11-
- '.github/workflows/website.yml'
12-
- 'website/**'
13-
- 'unity/**'
14-
15-
# Alternative: only build for tags.
16-
# tags:
17-
# - '*'
18-
194
# Allows you to run this workflow manually from the Actions tab
205
workflow_dispatch:
6+
workflow_call:
217

22-
# security: restrict permissions for CI jobs.
238
permissions:
24-
contents: read
9+
pages: write
10+
id-token: write
2511

2612
jobs:
2713
build-client-docs-as-artifact:
14+
name: Build client docs
2815
runs-on: windows-latest
2916
steps:
3017
- uses: actions/checkout@v4
@@ -47,41 +34,52 @@ jobs:
4734
path: ./unity/Documentation/clientHTMLOutput
4835

4936
build-server-docs:
37+
name: Build server docs
5038
needs: build-client-docs-as-artifact
5139
runs-on: ubuntu-latest
5240
steps:
5341
- uses: actions/checkout@v4
5442

5543
- name: Install Python
44+
id: install_python
5645
uses: actions/setup-python@v5
5746
with:
58-
python-version: '3.10.12'
47+
python-version: "3.10"
5948

6049
- name: Install Poetry
6150
uses: abatilo/actions-poetry@v2
6251
with:
63-
poetry-version: '1.8.3'
52+
poetry-version: "1.8.3"
6453

6554
- name: Setup a local virtual environment (if no poetry.toml file)
6655
working-directory: ./python
6756
run: |
6857
poetry config virtualenvs.create true --local
6958
poetry config virtualenvs.in-project true --local
7059
71-
- name: Define a cache for the virtual environment based on the dependencies lock file
72-
uses: actions/cache@v3
60+
- name: Restore cached virtualenv
61+
uses: actions/cache/restore@v4
7362
with:
7463
path: ./python/.venv
75-
key: venv-${{ hashFiles('./python/poetry.lock') }}
76-
64+
key: venv-${{ runner.os }}-${{ steps.install_python.outputs.python-version }}-${{ hashFiles('./python/poetry.lock') }}
65+
7766
- name: Install docs dependencies
7867
working-directory: ./python
79-
run: poetry install --with docs
68+
run: |
69+
poetry install --with docs
70+
echo "$(poetry env info --path)/bin" >> $GITHUB_PATH
71+
echo "VIRTUAL_ENV=$(poetry env info --path)/bin" >> $GITHUB_ENV
72+
73+
# - name: Saved cached virtualenv
74+
# uses: actions/cache/save@v4
75+
# with:
76+
# path: ./python/.venv
77+
# key: venv-${{ runner.os }}-${{ steps.install_python.outputs.python-version }}-${{ hashFiles('./python/poetry.lock') }}
8078

8179
- name: Build the documentation
8280
working-directory: ./python
83-
run: poetry run python tools/make_docs_cli.py
84-
81+
run: python tools/make_docs_cli.py
82+
8583
- name: Move docs to website directory
8684
run: |
8785
mkdir -p ./website/docs/server/
@@ -92,7 +90,7 @@ jobs:
9290
with:
9391
name: client-docs
9492
path: ./website/docs/client
95-
93+
9694
# # cleanup client docs artifacts
9795
# - name: Delete client docs artifact
9896
# run: |
@@ -107,7 +105,8 @@ jobs:
107105
path: ./website
108106

109107
# Single deploy job since we're just deploying
110-
deploy:
108+
deploy-website:
109+
name: Deploy website
111110
needs: build-server-docs
112111
runs-on: ubuntu-latest
113112
permissions:

.github/workflows/release.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
# Allows you to run this workflow manually from the Actions tab
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
release:
16+
name: Release package
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Install Python
22+
id: install_python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: "3.10"
26+
27+
- name: Install Poetry
28+
uses: abatilo/actions-poetry@v2
29+
with:
30+
poetry-version: "1.8.3"
31+
32+
- name: Setup a local virtual environment (if no poetry.toml file)
33+
working-directory: ./python
34+
run: |
35+
poetry config virtualenvs.create true --local
36+
poetry config virtualenvs.in-project true --local
37+
38+
- name: Restore cached virtualenv
39+
uses: actions/cache/restore@v4
40+
with:
41+
path: ./python/.venv
42+
key: venv-${{ runner.os }}-${{ steps.install_python.outputs.python-version }}-${{ hashFiles('./python/poetry.lock') }}
43+
44+
- name: Install dependencies (skipped if cache hit, fallback to install)
45+
working-directory: ./python
46+
run: |
47+
poetry install
48+
echo "$(poetry env info --path)/bin" >> $GITHUB_PATH
49+
echo "VIRTUAL_ENV=$(poetry env info --path)/bin" >> $GITHUB_ENV
50+
51+
- name: Saved cached virtualenv
52+
uses: actions/cache/save@v4
53+
with:
54+
path: ./python/.venv
55+
key: venv-${{ runner.os }}-${{ steps.install_python.outputs.python-version }}-${{ hashFiles('./python/poetry.lock') }}
56+
57+
- name: Use PyPI API token
58+
working-directory: ./python
59+
run: poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
60+
61+
- name: Build and publish the package
62+
working-directory: ./python
63+
run: poetry publish --build
64+
65+
- name: Upload Python package to GitHub
66+
uses: actions/upload-artifact@v4
67+
with:
68+
path: ./python/dist/
69+
if-no-files-found: error
70+
71+
publish-docs:
72+
name: Publish documentation
73+
permissions:
74+
pages: write
75+
id-token: write
76+
uses: ./.github/workflows/publish-docs.yml
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Update contributors
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
contrib-readme-job:
10+
runs-on: ubuntu-latest
11+
name: A job to automate contrib in readme
12+
permissions:
13+
contents: write
14+
pull-requests: write
15+
steps:
16+
- name: Contribute List
17+
uses: akhilmhdh/contributors-readme-action@v2.3.10
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)