Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 1
timeout-minutes: 2
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
Expand Down Expand Up @@ -49,7 +49,8 @@ jobs:

- name: Bundle size breakdown
run: bun dependency-report | column -t -s ":"
- run: bun bundle-size ./dist
- name: Bundle size report
run: bun run bundle-size:report ./dist

- name: Upload built project
uses: actions/upload-artifact@v4
Expand All @@ -60,14 +61,15 @@ jobs:
name: build-artifacts-${{ github.run_id }}

- name: Deploy to Cloudflare Pages
if: github.ref == 'refs/heads/master' && github.repository == 'commaai/new-connect'
if: github.ref == 'refs/heads/master' && vars.CF_PAGES_PROJECT != ''
uses: cloudflare/wrangler-action@v3
with:
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
apiToken: ${{ secrets.CLOUDFLARE_PAGES_TOKEN }}
command: pages deploy dist --project-name=connect --branch=new-connect --commit-dirty=true
command: pages deploy dist --project-name=${{ vars.CF_PAGES_PROJECT }} --branch=master --commit-dirty=true

docker:
if: vars.DOCKER_IMAGE != ''
runs-on: ubuntu-latest
timeout-minutes: 1
permissions:
Expand All @@ -79,7 +81,7 @@ jobs:
uses: docker/setup-buildx-action@v2

- uses: docker/login-action@v3
if: github.ref == 'refs/heads/master' && github.repository == 'commaai/new-connect'
if: github.ref == 'refs/heads/master'
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand All @@ -88,7 +90,7 @@ jobs:
- id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/commaai/connect2 # TODO: switch to 'connect' after launch
images: ${{ vars.DOCKER_IMAGE }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=branch
Expand All @@ -111,6 +113,6 @@ jobs:
SENTRY_RELEASE=${{ github.event_name == 'push' && github.sha || github.event.pull_request.head.sha }}
builder: ${{ steps.buildx.outputs.name }}
context: .
push: ${{ github.ref == 'refs/heads/master' && github.repository == 'commaai/new-connect' }}
push: ${{ github.ref == 'refs/heads/master' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
83 changes: 0 additions & 83 deletions .github/workflows/diff.yaml

This file was deleted.

75 changes: 9 additions & 66 deletions .github/workflows/preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-latest
outputs:
number: ${{ steps.pr.outputs.number }}
if: github.repository == 'commaai/new-connect' && github.event.workflow_run.event == 'pull_request'
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
steps:
# use `gr pr view` to get the PR number
# https://github.com/orgs/community/discussions/25220#discussioncomment-11285971
Expand All @@ -48,6 +48,7 @@ jobs:
preview:
name: Deploy preview
needs: pr
if: needs.pr.outputs.number != '' && vars.CF_PAGES_PROJECT != '' && vars.PREVIEW_BASE_DOMAIN != ''
outputs:
check_id: ${{ steps.check.outputs.result }}
runs-on: ubuntu-latest
Expand All @@ -66,7 +67,7 @@ jobs:
title: 'Preview deployment',
summary: 'In Progress',
},
owner: 'commaai',
owner: '${{ github.repository_owner }}',
repo: '${{ github.event.repository.name }}',
})
return response.data.id
Expand All @@ -87,85 +88,27 @@ jobs:
with:
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
apiToken: ${{ secrets.CLOUDFLARE_PAGES_TOKEN }}
command: pages deploy dist --project-name=connect --branch=${{ needs.pr.outputs.number }} --commit-dirty=true
command: pages deploy dist --project-name=${{ vars.CF_PAGES_PROJECT }} --branch=pr-${{ needs.pr.outputs.number }} --commit-dirty=true

- name: Comment URL on PR
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b
with:
message: |
<!-- _(run_id **${{ github.run_id }}**)_ -->

# deployed preview: https://${{ needs.pr.outputs.number }}.connect-d5y.pages.dev
# preview ready

Welcome to connect! Make sure to:
* read the [contributing guidelines](https://github.com/commaai/connect?tab=readme-ov-file#contributing)
* mark your PR as a draft until it's ready to review
* post the preview on [Discord](https://discord.comma.ai); feedback from users will speedup the PR review
comment-tag: run_id
pr-number: ${{ needs.pr.outputs.number }}
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout ci-artifacts
uses: actions/checkout@v4
with:
repository: commaai/ci-artifacts
ssh-key: ${{ secrets.CI_ARTIFACTS_DEPLOY_KEY }}
path: ${{ github.workspace }}/ci-artifacts
ref: master

- name: take screenshots
run: bun src/ci/screenshots.ts https://${{ needs.pr.outputs.number }}.connect-d5y.pages.dev ${{ github.workspace }}/ci-artifacts

- name: Push Screenshots
working-directory: ${{ github.workspace }}/ci-artifacts
run: |
git checkout -b connect/pr-${{ needs.pr.outputs.number }}
git config user.name "GitHub Actions Bot"
git config user.email "<>"
git add .
git commit -m "screenshots for PR #${{ needs.pr.outputs.number }}"
git push origin connect/pr-${{ needs.pr.outputs.number }} --force

- name: Add screenshots to comment on PR
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b
with:
message: |
<!-- _(run_id **${{ github.run_id }}**)_ -->

# deployed preview: https://${{ needs.pr.outputs.number }}.connect-d5y.pages.dev

Welcome to connect! Make sure to:
* read the [contributing guidelines](https://github.com/commaai/connect?tab=readme-ov-file#contributing)
* mark your PR as a draft until it's ready to review
* post the preview on [Discord](https://discord.comma.ai); feedback from users will speedup the PR review

### Mobile
<table>
<tr>
<td><img src="https://raw.githubusercontent.com/commaai/ci-artifacts/connect/pr-${{ needs.pr.outputs.number }}/Login-mobile.playwright.png"></td>
<td><img src="https://raw.githubusercontent.com/commaai/ci-artifacts/connect/pr-${{ needs.pr.outputs.number }}/RouteActivity-mobile.playwright.png"></td>
<td><img src="https://raw.githubusercontent.com/commaai/ci-artifacts/connect/pr-${{ needs.pr.outputs.number }}/RouteList-mobile.playwright.png"></td>
<td><img src="https://raw.githubusercontent.com/commaai/ci-artifacts/connect/pr-${{ needs.pr.outputs.number }}/SettingsActivity-mobile.playwright.png"></td>
</tr>
</table>
https://pr-${{ needs.pr.outputs.number }}.${{ vars.PREVIEW_BASE_DOMAIN }}

### Desktop
<table>
<tr>
<td><img src="https://raw.githubusercontent.com/commaai/ci-artifacts/connect/pr-${{ needs.pr.outputs.number }}/Login-desktop.playwright.png"></td>
<td><img src="https://raw.githubusercontent.com/commaai/ci-artifacts/connect/pr-${{ needs.pr.outputs.number }}/RouteActivity-desktop.playwright.png"></td>
<td><img src="https://raw.githubusercontent.com/commaai/ci-artifacts/connect/pr-${{ needs.pr.outputs.number }}/RouteList-desktop.playwright.png"></td>
<td><img src="https://raw.githubusercontent.com/commaai/ci-artifacts/connect/pr-${{ needs.pr.outputs.number }}/SettingsActivity-desktop.playwright.png"></td>
</tr>
</table>
Check the login flow, demo mode, route list, route detail, and settings before merging.
comment-tag: run_id
pr-number: ${{ needs.pr.outputs.number }}
github-token: ${{ secrets.GITHUB_TOKEN }}

update_pr_check:
name: Update PR check
needs: preview
if: always() && github.repository == 'commaai/connect' && github.event.workflow_run.event == 'pull_request'
if: always() && needs.preview.result != 'skipped' && github.event.workflow_run.event == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Update PR check
Expand All @@ -182,6 +125,6 @@ jobs:
title: 'Preview deployment',
summary: 'Result: ${{ needs.preview.result }}',
},
owner: 'commaai',
owner: '${{ github.repository_owner }}',
repo: '${{ github.event.repository.name }}',
})
49 changes: 21 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# connect
# new connect

connect is the web and mobile experience for [openpilot](https://github.com/commaai/openpilot).
new connect is a fork-owned web app for checking devices, trips, uploads, and remote actions from phone or desktop.

Try it out at https://new-connect.connect-d5y.pages.dev.

This is a rewrite of [comma connect](https://github.com/commaai/connect-pwa-archive).
This fork currently keeps compatibility with the existing backend APIs while taking its own product and workflow direction.

## Development

Expand All @@ -16,40 +14,35 @@ curl -fsSL https://bun.sh/install | bash
source ~/.bashrc # or source ~/.zshrc

cd ~
git clone https://github.com/commaai/new-connect.git
git clone https://github.com/Mahdi451/new-connect.git

cd connect
cd new-connect
bun install # sets up pre-commit hook
bun dev
```

## Contributing

Join the `#dev-connect-web` channel on our [Discord](https://discord.comma.ai).
The app has a demo mode, so you can work on the UI without pairing a live device.

connect has a demo mode, so no special comma device is needed to develop connect.

A few constraints to keep connect light and the dev environment fun:
A few constraints keep the app light and the dev environment fast:
* 5k line limit
* 500KB bundle size limit
* 1m timeout for all CI

References:
* [API docs](https://api.comma.ai)
* [openpilot docs](https://docs.comma.ai)
* [Discord](https://discord.comma.ai)
* [Bounties](https://comma.ai/bounties)
## Preview Workflow

Pull requests into `master` are expected to produce a deploy preview when the repo is configured with:

## Roadmap
* `CLOUDFLARE_ACCOUNT_ID`
* `CLOUDFLARE_PAGES_TOKEN`
* `CF_PAGES_PROJECT`
* `PREVIEW_BASE_DOMAIN`

The first goal is to replace current connect and get this shipped to https://connect.comma.ai.
The preview workflow comments a URL back onto the PR after a successful build. Screenshots are intentionally disabled until the fork has its own artifact publishing setup.

[This milestone](https://github.com/commaai/connect/milestone/1) tracks that progress. Most of the issues there are [paid bounties](https://comma.ai/bounties).
## Direction

Once we've shipped v1, next up will be:
* [Sentry mode](https://www.youtube.com/watch?v=laO0RzsDzfU)
* SSH console for openpilot developers
* Replace snapshot with a live stream
* openpilot clips, like this [community tool](https://github.com/nelsonjchen/op-replay-clipper)
* Manage the settings on your comma 3X
* Car mangement: lock doors, EV charge status, etc.
The first phase for this fork is:
* own the repo and deployment workflow
* replace upstream-facing branding and copy
* improve the day-to-day experience for checking devices, trips, uploads, and settings
* selectively pull upstream fixes only when they are useful
2 changes: 0 additions & 2 deletions lefthook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ pre-commit:
check:
run: bun biome check --write --no-errors-on-unmatched --files-ignore-unknown=true --colors=off {staged_files}
stage_fixed: true
lines:
run: bun lines

skip_output:
- execution_out
12 changes: 8 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
{
"name": "connect",
"name": "new-connect",
"version": "1.0.0",
"homepage": "https://new-connect.connect-d5y.pages.dev",
"homepage": "https://new-connect.pages.dev",
"license": "MIT",
"author": "comma.ai",
"author": "Mahdi451",
"repository": {
"type": "git",
"url": "https://github.com/commaai/new-connect.git"
"url": "https://github.com/Mahdi451/new-connect.git"
},
"scripts": {
"build": "bun run --bun vite build",
"bundle-size": "bun src/ci/check_bundle_size.ts",
"bundle-size:report": "bun src/ci/check_bundle_size.ts",
"bundle-size:check": "bun src/ci/check_bundle_size.ts --enforce",
"dependency-report": "bun src/ci/dependency_report.ts",
"dev": "bun run --bun vite --open",
"serve": "vite preview",
"lines": "bun src/ci/check_lines.ts",
"lines:report": "bun src/ci/check_lines.ts",
"lines:check": "bun src/ci/check_lines.ts --enforce",
"check": "biome check",
"fix": "biome check --write",
"test": "TZ=Greenwich vitest"
Expand Down
Loading
Loading