Improved USB latency #203
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 | |
| on: | |
| pull_request: | |
| branches: ["**", "!update/**", "!pr/**"] | |
| push: | |
| branches: ["**", "!update/**", "!pr/**"] | |
| tags: [v*] | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| target: [esp32, esp32s2, esp32s3] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Show version | |
| run: git describe | |
| - uses: actions/cache@v4 | |
| with: | |
| path: managed_components | |
| key: ${{ runner.os }}-managed-${{ matrix.target }}-${{ hashFiles('lib/app/idf_component.yml') }} | |
| - uses: pnpm/action-setup@v4 | |
| name: Install pnpm | |
| with: | |
| cache: true | |
| - run: pnpm install | |
| - name: Build dashboard | |
| run: pnpm build:dashboard | |
| - name: Build firmware | |
| uses: espressif/esp-idf-ci-action@v1 | |
| with: | |
| esp_idf_version: v6.0 | |
| target: ${{ matrix.target }} | |
| command: idf.py -B build/${{ matrix.target }} build | |
| - name: Upload build artifacts | |
| if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/v') | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: ${{ matrix.target }} | |
| path: | | |
| build/${{ matrix.target }}/teslasynth.bin | |
| build/${{ matrix.target }}/bootloader/bootloader.bin | |
| build/${{ matrix.target }}/partition_table/partition-table.bin | |
| build/${{ matrix.target }}/flasher_args.json | |
| python-test: | |
| name: Python tests (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - uses: astral-sh/setup-uv@v5 | |
| - name: Install and build | |
| run: | | |
| uv venv | |
| uv pip install scikit-build-core nanobind setuptools_scm | |
| uv sync --group dev --no-build-isolation | |
| working-directory: python | |
| - name: Run Python tests | |
| run: uv run pytest tests -v --tb=short | |
| working-directory: python | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - run: gcc --version | |
| name: Show gcc version | |
| - uses: actions/checkout@v6 | |
| - uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cache/pip | |
| ~/.platformio/.cache | |
| key: ${{ runner.os }}-pio | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install PlatformIO Core | |
| run: pip install --upgrade platformio | |
| - name: Run linting checks | |
| run: pio check -e native | |
| - name: Run tests | |
| run: pio test -e native --verbose | |
| copyright-headers: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - uses: hashicorp/setup-copywrite@v1.1.2 | |
| - name: Check copyright headers (firmware) | |
| run: copywrite headers --plan | |
| - name: Check copyright headers (python) | |
| run: copywrite headers --plan | |
| working-directory: python | |
| firmware-lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install clang-format-20 | |
| run: sudo apt-get install -y clang-format-20 | |
| - name: Check clang-format | |
| run: | | |
| git ls-files -- '*.cpp' '*.c' '*.hpp' '*.h' \ | |
| | xargs clang-format-20 --dry-run --Werror | |
| python-lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: astral-sh/setup-uv@v5 | |
| - name: Ruff lint | |
| run: uvx ruff check . | |
| working-directory: python | |
| - name: Ruff format check | |
| run: uvx ruff format --check . | |
| working-directory: python | |
| web-lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: pnpm/action-setup@v4 | |
| name: Install pnpm | |
| with: | |
| cache: true | |
| - run: pnpm install | |
| - name: Lint | |
| run: pnpm lint | |
| - name: Format check | |
| run: pnpm format:check | |
| web-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: pnpm/action-setup@v4 | |
| name: Install pnpm | |
| with: | |
| cache: true | |
| - run: pnpm install | |
| - name: Run web tests | |
| run: pnpm test | |
| website: | |
| runs-on: ubuntu-latest | |
| needs: [web-lint, web-test] | |
| if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: pnpm/action-setup@v4 | |
| name: Install pnpm | |
| with: | |
| cache: true | |
| - run: pnpm install | |
| - name: Build website | |
| run: pnpm build:site | |
| - name: Publish site | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: web/apps/site/dist | |
| python-wheels: | |
| name: Python wheels (${{ matrix.os }}) | |
| needs: [python-lint] | |
| if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| # aarch64 emulation for Linux cross-compilation | |
| - name: Set up QEMU | |
| if: runner.os == 'Linux' | |
| uses: docker/setup-qemu-action@v3 | |
| with: | |
| platforms: arm64 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Build wheels | |
| uses: pypa/cibuildwheel@v2.22 | |
| with: | |
| package-dir: python | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-${{ matrix.os }} | |
| path: wheelhouse/*.whl | |
| publish: | |
| runs-on: ubuntu-latest | |
| if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/v') | |
| needs: [build, test, python-test, python-wheels, firmware-lint, python-lint, web-lint, copyright-headers] | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - name: Checkout current branch (full) | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - uses: actions/download-artifact@v7 | |
| with: | |
| path: build | |
| # exclude python wheel artifacts from the firmware artifact download | |
| pattern: "!wheels-*" | |
| - name: Download Python wheels | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: wheels-* | |
| merge-multiple: true | |
| path: wheelhouse | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Build sdist | |
| run: | | |
| pip install build | |
| python -m build --sdist --outdir wheelhouse python/ | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: wheelhouse/ | |
| - name: Display structure of downloaded files | |
| run: ls -R build wheelhouse | |
| - name: Show version | |
| run: git describe | |
| - name: Generate assets | |
| run: ./generate_manifest.py build | |
| - name: Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| draft: true | |
| files: | | |
| dist/* | |
| wheelhouse/*.whl | |
| - name: Generate version catalog | |
| run: git tag --list 'v*' --sort=-version:refname | jq -R . | jq -s . > _catalog.json | |
| - name: Checkout firmware branch | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: firmware | |
| clean: false | |
| - name: Copy firmware files | |
| run: | | |
| mv dist ${{ github.ref_name }} | |
| mv _catalog.json catalog.json | |
| - name: Commit and push firmware | |
| run: | | |
| git config user.name "github-actions" | |
| git config user.email "github-actions@github.com" | |
| git add catalog.json ${{ github.ref_name }} | |
| git commit -m "Add firmware ${{ github.ref_name }}" | |
| git push origin firmware |