peripherals: Add Peripheral.get_ports_by_id #936
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: Main | |
| on: push | |
| jobs: | |
| lint-python: | |
| name: Lint Python | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Lint Python code | |
| uses: qtoggle/actions-common/actions/lint-python@v1 | |
| with: | |
| source-dir: qtoggleserver | |
| lint-js: | |
| name: Lint JavaScript | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Lint JavaScript code | |
| uses: qtoggle/actions-common/actions/lint-js@v1 | |
| with: | |
| work-dir: qtoggleserver/frontend | |
| source-dir: js | |
| test: | |
| name: Run Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Source code checkout | |
| uses: actions/checkout@v4 | |
| - name: Replace source version | |
| uses: qtoggle/actions-common/actions/replace-source-version@v1 | |
| with: | |
| files: qtoggleserver/frontend/package.json | |
| - name: Install Postgres | |
| run: | | |
| sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' && | |
| wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - && | |
| sudo apt update && sudo apt -y install postgresql-17 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.14' | |
| - name: Install UV | |
| uses: astral-sh/setup-uv@v6 | |
| - name: Install Python deps | |
| run: uv sync --extra opt | |
| - name: Run PyTest | |
| run: uv run pytest | |
| build: | |
| name: Build Package | |
| if: startsWith(github.ref, 'refs/tags/version-') | |
| needs: | |
| - lint-python | |
| - lint-js | |
| - test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout source code | |
| uses: actions/checkout@v4 | |
| - name: Install host packages | |
| run: sudo apt-get -y update && sudo apt-get -y install librsvg2-bin | |
| - name: Setup NodeJS | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.14' | |
| - name: Replace source version | |
| uses: qtoggle/actions-common/actions/replace-source-version@v1 | |
| with: | |
| files: qtoggleserver/frontend/package.json | |
| - name: Build frontend | |
| run: cd qtoggleserver/frontend && npm install && npx webpack --mode=production | |
| - name: Install UV | |
| uses: astral-sh/setup-uv@v6 | |
| - name: Build Python package | |
| shell: bash | |
| run: uv build | |
| - name: Store dist folder | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: python-package-dist | |
| path: dist/ | |
| release-pypi: | |
| name: Publish PyPI Release | |
| if: startsWith(github.ref, 'refs/tags/version-') | |
| needs: | |
| - build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Fetch dist folder | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: python-package-dist | |
| path: dist/ | |
| - name: Publish package | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| user: __token__ | |
| password: ${{ secrets.PYPI_TOKEN }} | |
| release-github: | |
| name: Publish GitHub Release | |
| if: startsWith(github.ref, 'refs/tags/version-') | |
| needs: | |
| - build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Fetch dist folder | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: python-package-dist | |
| path: dist/ | |
| - name: Extract version from tag | |
| uses: qtoggle/actions-common/actions/extract-version-from-tag@v1 | |
| - name: Publish to GitHub | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: dist/qtoggleserver-${{ env.VERSION }}.tar.gz | |
| name: ${{ env.VERSION }} | |
| draft: true | |
| release-docker: | |
| name: Publish to Docker Hub | |
| if: startsWith(github.ref, 'refs/tags/version-') | |
| needs: | |
| - build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Source code checkout | |
| uses: actions/checkout@v4 | |
| - name: Replace source version | |
| uses: qtoggle/actions-common/actions/replace-source-version@v1 | |
| with: | |
| files: qtoggleserver/frontend/package.json | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Docker login | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
| - name: Generate Docker tags | |
| id: tags | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: qtoggle/qtoggleserver | |
| tags: type=match,pattern=version-(.*),group=1 | |
| - name: Build and push Docker images | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./docker/Dockerfile | |
| push: true | |
| platforms: linux/amd64,linux/arm/v7,linux/arm64 | |
| tags: ${{ steps.tags.outputs.tags }} | |
| labels: ${{ steps.tags.outputs.labels }} |