feat: ✨ add trace task state API and functions #3503
This file contains hidden or 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
name: CI Pipeline | |
on: | |
pull_request: | |
type: [ opened, synchronize ] | |
push: | |
branches: [ main ] | |
env: | |
WANDB_MODE: offline | |
ZETTA_USER: test | |
ZETTA_PROJECT: test | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
#SETUPTOOLS_ENABLE_FEATURES: legacy-editable | |
jobs: | |
pytest: | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
python-version: | |
- "3.12" | |
- "3.11" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Get token from Github App | |
uses: actions/create-github-app-token@v1 | |
id: app_token | |
with: | |
app-id: ${{ secrets.APP_ID }} | |
private-key: ${{ secrets.APP_PEM }} | |
# owner is required, otherwise the creds will fail the checkout step | |
owner: ${{ github.repository_owner }} | |
- name: Checkout from GitHub | |
uses: actions/checkout@v4 | |
with: | |
lfs: 'false' | |
submodules: true | |
ssh-key: ${{ secrets.git_ssh_key }} | |
token: ${{ steps.app_token.outputs.token }} | |
- name: Get changed files | |
id: changed-py-files | |
uses: tj-actions/changed-files@v46 | |
with: | |
files: | | |
**/*.py | |
- name: Setup Python | |
if: ${{ steps.changed-py-files.outputs.any_changed == 'true' }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: x64 | |
cache: 'pip' | |
- name: Setup Conda | |
if: ${{ steps.changed-py-files.outputs.any_changed == 'true' }} | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
python-version: ${{ matrix.python-version }} | |
- name: Setup Go | |
if: ${{ steps.changed-py-files.outputs.any_changed == 'true' }} | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.18.4' | |
- name: Install CUE | |
if: ${{ steps.changed-py-files.outputs.any_changed == 'true' }} | |
run: go install cuelang.org/go/cmd/[email protected] | |
- name: Install libboost | |
if: ${{ steps.changed-py-files.outputs.any_changed == 'true' }} | |
run: sudo apt install libboost-dev | |
- name: Install zetta_utils with dependencies | |
if: ${{ steps.changed-py-files.outputs.any_changed == 'true' }} | |
run: | | |
python install_zutils.py --mode=all --pcg --dockerfile --skip_apt | |
shell: bash -l {0} | |
- name: Run pytest | |
if: ${{ steps.changed-py-files.outputs.any_changed == 'true' }} | |
run: coverage run -m py.test ./tests/unit | |
shell: bash -l {0} | |
- name: Send coverage repot to codecov | |
uses: codecov/codecov-action@v3 | |
if: ${{ steps.changed-py-files.outputs.any_changed == 'true' }} | |
with: | |
files: /home/runner/work/zetta_utils/zetta_utils/coverage.xml | |
pylint-isort: | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
python-version: | |
- "3.12" | |
- "3.11" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Get token from Github App | |
uses: actions/create-github-app-token@v1 | |
id: app_token | |
with: | |
app-id: ${{ secrets.APP_ID }} | |
private-key: ${{ secrets.APP_PEM }} | |
# owner is required, otherwise the creds will fail the checkout step | |
owner: ${{ github.repository_owner }} | |
- name: Checkout from GitHub | |
uses: actions/checkout@v4 | |
with: | |
lfs: 'false' | |
submodules: true | |
ssh-key: ${{ secrets.git_ssh_key }} | |
token: ${{ steps.app_token.outputs.token }} | |
- name: Get changed files | |
id: changed-py-files | |
uses: tj-actions/changed-files@v46 | |
with: | |
files: | | |
**/*.py | |
- name: Setup Python | |
if: ${{ steps.changed-py-files.outputs.any_changed == 'true' }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: x64 | |
cache: 'pip' | |
- name: Setup Conda | |
if: ${{ steps.changed-py-files.outputs.any_changed == 'true' }} | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
python-version: ${{ matrix.python-version }} | |
- name: Setup Go | |
if: ${{ steps.changed-py-files.outputs.any_changed == 'true' }} | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.18.4' | |
- name: Install CUE | |
if: ${{ steps.changed-py-files.outputs.any_changed == 'true' }} | |
run: go install cuelang.org/go/cmd/[email protected] | |
- name: Install libboost | |
if: ${{ steps.changed-py-files.outputs.any_changed == 'true' }} | |
run: sudo apt install libboost-dev | |
- name: Install zetta_utils with dependencies | |
if: ${{ steps.changed-py-files.outputs.any_changed == 'true' }} | |
run: | | |
python install_zutils.py --mode=all --pcg --dockerfile --skip_apt | |
shell: bash -l {0} | |
- name: Run pylint | |
if: ${{ steps.changed-py-files.outputs.any_changed == 'true' }} | |
run: pylint ${{ steps.changed-py-files.outputs.all_changed_files }} | |
shell: bash -l {0} | |
- name: Run isort | |
if: ${{ steps.changed-py-files.outputs.any_changed == 'true' }} | |
run: isort --check-only --df --verbose --om --profile black . | |
shell: bash -l {0} | |
mypy: | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
python-version: | |
- "3.12" | |
- "3.11" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Get token from Github App | |
uses: actions/create-github-app-token@v1 | |
id: app_token | |
with: | |
app-id: ${{ secrets.APP_ID }} | |
private-key: ${{ secrets.APP_PEM }} | |
# owner is required, otherwise the creds will fail the checkout step | |
owner: ${{ github.repository_owner }} | |
- name: Checkout from GitHub | |
uses: actions/checkout@v4 | |
with: | |
lfs: 'false' | |
submodules: true | |
ssh-key: ${{ secrets.git_ssh_key }} | |
token: ${{ steps.app_token.outputs.token }} | |
- name: Get changed files | |
id: changed-py-files | |
uses: tj-actions/changed-files@v46 | |
with: | |
files: | | |
**/*.py | |
- name: Setup Python | |
if: ${{ steps.changed-py-files.outputs.any_changed == 'true' }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: x64 | |
cache: 'pip' | |
- name: Setup Conda | |
if: ${{ steps.changed-py-files.outputs.any_changed == 'true' }} | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
python-version: ${{ matrix.python-version }} | |
- name: Setup Go | |
if: ${{ steps.changed-py-files.outputs.any_changed == 'true' }} | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.18.4' | |
- name: Install CUE | |
if: ${{ steps.changed-py-files.outputs.any_changed == 'true' }} | |
run: go install cuelang.org/go/cmd/[email protected] | |
- name: Install libboost | |
if: ${{ steps.changed-py-files.outputs.any_changed == 'true' }} | |
run: sudo apt install libboost-dev | |
- name: Install zetta_utils with dependencies | |
if: ${{ steps.changed-py-files.outputs.any_changed == 'true' }} | |
run: | | |
python install_zutils.py --mode=all --pcg --dockerfile --skip_apt | |
shell: bash -l {0} | |
- name: Run mypy | |
if: ${{ steps.changed-py-files.outputs.any_changed == 'true' }} | |
run: mypy . | |
shell: bash -l {0} | |
test-docs: | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
python-version: | |
- "3.11" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Get token from Github App | |
uses: actions/create-github-app-token@v1 | |
id: app_token | |
with: | |
app-id: ${{ secrets.APP_ID }} | |
private-key: ${{ secrets.APP_PEM }} | |
# owner is required, otherwise the creds will fail the checkout step | |
owner: ${{ github.repository_owner }} | |
- name: Checkout from GitHub | |
uses: actions/checkout@v4 | |
with: | |
lfs: 'false' | |
submodules: true | |
ssh-key: ${{ secrets.git_ssh_key }} | |
token: ${{ steps.app_token.outputs.token }} | |
- name: Get changed files | |
id: changed-py-files | |
uses: tj-actions/changed-files@v46 | |
with: | |
files: | | |
**/*.py | |
- name: Get changed files | |
id: changed-docs-files | |
uses: tj-actions/changed-files@v46 | |
with: | |
files: | | |
**/*.rst | |
- name: Setup Python | |
if: ${{ steps.changed-py-files.outputs.any_changed == 'true' || steps.changed-docs-files.outputs.any_changed == 'true'}} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: x64 | |
cache: 'pip' | |
- name: Setup Conda | |
if: ${{ steps.changed-py-files.outputs.any_changed == 'true' || steps.changed-docs-files.outputs.any_changed == 'true'}} | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
python-version: ${{ matrix.python-version }} | |
- name: Install libboost | |
if: ${{ steps.changed-py-files.outputs.any_changed == 'true' || steps.changed-docs-files.outputs.any_changed == 'true'}} | |
run: sudo apt install libboost-dev | |
- name: Install zetta_utils with dependencies | |
if: ${{ steps.changed-py-files.outputs.any_changed == 'true' || steps.changed-docs-files.outputs.any_changed == 'true'}} | |
run: | | |
python install_zutils.py --mode=all --pcg --dockerfile --skip_apt | |
shell: bash -l {0} | |
- name: Doctest | |
if: ${{ steps.changed-py-files.outputs.any_changed == 'true' || steps.changed-docs-files.outputs.any_changed == 'true'}} | |
run: make -C docs doctest | |
shell: bash -l {0} | |
- name: Build Docs | |
if: ${{ steps.changed-py-files.outputs.any_changed == 'true' || steps.changed-docs-files.outputs.any_changed == 'true'}} | |
run: make -C docs html | |
shell: bash -l {0} | |
all-checks-test: | |
runs-on: ubuntu-latest | |
needs: [mypy, pytest, pylint-isort, test-docs] | |
if: always() | |
steps: | |
- name: Success | |
if: ${{ !(contains(needs.*.result, 'failure')) }} | |
run: exit 0 | |
- name: Failure | |
if: ${{ contains(needs.*.result, 'failure') }} | |
run: exit 1 |