Skip to content
Merged
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
13 changes: 7 additions & 6 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 @@ -60,14 +60,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 +80,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 +89,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 +112,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 }}
44 changes: 0 additions & 44 deletions .github/workflows/diff.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,12 @@ concurrency:
cancel-in-progress: true

jobs:
check-branch:
name: Check PR branch status
runs-on: ubuntu-latest
outputs:
outdated: ${{ steps.status.outputs.outdated }}
steps:
- uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Check whether branch is up-to-date
id: status
run: |
git remote add commaai https://github.com/commaai/new-connect.git
git fetch commaai master
echo "${{ github.event.pull_request.head.sha }}"
git rev-list --left-right --count commaai/master...${{ github.event.pull_request.head.sha }} | awk '{print "Behind "$1" - Ahead "$2""}'
count=$(git rev-list --left-right --count commaai/master...${{ github.event.pull_request.head.sha }} | awk '{print $1}')
if [ $count -gt 0 ]; then
echo "Current branch is behind commaai master branch!"
echo "outdated=true" >> "$GITHUB_OUTPUT"
else
echo "outdated=false" >> "$GITHUB_OUTPUT"
fi

lines:
name: Lint count diff
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
needs: check-branch
if: needs.check-branch.outputs.outdated == 'false'
timeout-minutes: 2
steps:
- name: Checkout code from PR branch
Expand All @@ -65,19 +37,3 @@ jobs:
file-path: ./diff.txt
comment-tag: diff
github-token: ${{ secrets.GITHUB_TOKEN }}

rebase:
name: Rebase comment
permissions:
pull-requests: write
runs-on: ubuntu-latest
needs: check-branch
if: needs.check-branch.outputs.outdated == 'true'
timeout-minutes: 1
steps:
- name: Comment rebase
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b
with:
message: This branch is behind commaai/master. The line count diff bot is disabled.
comment-tag: diff
github-token: ${{ secrets.GITHUB_TOKEN }}
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
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"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",
Expand Down
8 changes: 6 additions & 2 deletions src/App.browser.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { beforeAll, beforeEach, describe, expect, test } from 'vitest'
import { configure, render, waitFor } from '@solidjs/testing-library'
import { configure, fireEvent, render, waitFor } from '@solidjs/testing-library'

import { setAccessToken, signOut } from '~/api/auth/client'
import * as Demo from '~/api/auth/demo'
Expand All @@ -26,10 +26,14 @@ describe('Demo mode', () => {
})

test('View demo route', async () => {
const { findByText, findByTestId } = renderApp(`/${Demo.DONGLE_ID}/${DEMO_LOG_ID}`)
const { findByLabelText, findByText, findByTestId } = renderApp(`/${Demo.DONGLE_ID}/${DEMO_LOG_ID}`)
expect(await findByText(DEMO_LOG_ID)).toBeTruthy()
const video = (await findByTestId('route-video')) as HTMLVideoElement
await waitFor(() => expect(video.src).toBeTruthy())
expect(video.muted).toBe(true)
await fireEvent.click(await findByLabelText('Unmute'))
expect(video.muted).toBe(false)
expect(await findByLabelText('Mute')).toBeTruthy()
})
})

Expand Down
Loading
Loading