Skip to content

Commit be85339

Browse files
committed
Fork preview foundation
1 parent 69f6b5a commit be85339

15 files changed

Lines changed: 339 additions & 331 deletions

File tree

.github/workflows/build.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,15 @@ jobs:
6060
name: build-artifacts-${{ github.run_id }}
6161

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

7070
docker:
71+
if: vars.DOCKER_IMAGE != ''
7172
runs-on: ubuntu-latest
7273
timeout-minutes: 1
7374
permissions:
@@ -79,7 +80,7 @@ jobs:
7980
uses: docker/setup-buildx-action@v2
8081

8182
- uses: docker/login-action@v3
82-
if: github.ref == 'refs/heads/master' && github.repository == 'commaai/new-connect'
83+
if: github.ref == 'refs/heads/master'
8384
with:
8485
registry: ghcr.io
8586
username: ${{ github.actor }}
@@ -88,7 +89,7 @@ jobs:
8889
- id: meta
8990
uses: docker/metadata-action@v5
9091
with:
91-
images: ghcr.io/commaai/connect2 # TODO: switch to 'connect' after launch
92+
images: ${{ vars.DOCKER_IMAGE }}
9293
tags: |
9394
type=raw,value=latest,enable={{is_default_branch}}
9495
type=ref,event=branch
@@ -111,6 +112,6 @@ jobs:
111112
SENTRY_RELEASE=${{ github.event_name == 'push' && github.sha || github.event.pull_request.head.sha }}
112113
builder: ${{ steps.buildx.outputs.name }}
113114
context: .
114-
push: ${{ github.ref == 'refs/heads/master' && github.repository == 'commaai/new-connect' }}
115+
push: ${{ github.ref == 'refs/heads/master' }}
115116
tags: ${{ steps.meta.outputs.tags }}
116117
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/diff.yaml

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -10,40 +10,12 @@ concurrency:
1010
cancel-in-progress: true
1111

1212
jobs:
13-
check-branch:
14-
name: Check PR branch status
15-
runs-on: ubuntu-latest
16-
outputs:
17-
outdated: ${{ steps.status.outputs.outdated }}
18-
steps:
19-
- uses: actions/checkout@v4
20-
with:
21-
repository: ${{ github.event.pull_request.head.repo.full_name }}
22-
ref: ${{ github.event.pull_request.head.sha }}
23-
fetch-depth: 0
24-
- name: Check whether branch is up-to-date
25-
id: status
26-
run: |
27-
git remote add commaai https://github.com/commaai/new-connect.git
28-
git fetch commaai master
29-
echo "${{ github.event.pull_request.head.sha }}"
30-
git rev-list --left-right --count commaai/master...${{ github.event.pull_request.head.sha }} | awk '{print "Behind "$1" - Ahead "$2""}'
31-
count=$(git rev-list --left-right --count commaai/master...${{ github.event.pull_request.head.sha }} | awk '{print $1}')
32-
if [ $count -gt 0 ]; then
33-
echo "Current branch is behind commaai master branch!"
34-
echo "outdated=true" >> "$GITHUB_OUTPUT"
35-
else
36-
echo "outdated=false" >> "$GITHUB_OUTPUT"
37-
fi
38-
3913
lines:
4014
name: Lint count diff
4115
permissions:
4216
contents: read
4317
pull-requests: write
4418
runs-on: ubuntu-latest
45-
needs: check-branch
46-
if: needs.check-branch.outputs.outdated == 'false'
4719
timeout-minutes: 2
4820
steps:
4921
- name: Checkout code from PR branch
@@ -65,19 +37,3 @@ jobs:
6537
file-path: ./diff.txt
6638
comment-tag: diff
6739
github-token: ${{ secrets.GITHUB_TOKEN }}
68-
69-
rebase:
70-
name: Rebase comment
71-
permissions:
72-
pull-requests: write
73-
runs-on: ubuntu-latest
74-
needs: check-branch
75-
if: needs.check-branch.outputs.outdated == 'true'
76-
timeout-minutes: 1
77-
steps:
78-
- name: Comment rebase
79-
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b
80-
with:
81-
message: This branch is behind commaai/master. The line count diff bot is disabled.
82-
comment-tag: diff
83-
github-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/preview.yaml

Lines changed: 9 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
runs-on: ubuntu-latest
2222
outputs:
2323
number: ${{ steps.pr.outputs.number }}
24-
if: github.repository == 'commaai/new-connect' && github.event.workflow_run.event == 'pull_request'
24+
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
2525
steps:
2626
# use `gr pr view` to get the PR number
2727
# https://github.com/orgs/community/discussions/25220#discussioncomment-11285971
@@ -48,6 +48,7 @@ jobs:
4848
preview:
4949
name: Deploy preview
5050
needs: pr
51+
if: needs.pr.outputs.number != '' && vars.CF_PAGES_PROJECT != '' && vars.PREVIEW_BASE_DOMAIN != ''
5152
outputs:
5253
check_id: ${{ steps.check.outputs.result }}
5354
runs-on: ubuntu-latest
@@ -66,7 +67,7 @@ jobs:
6667
title: 'Preview deployment',
6768
summary: 'In Progress',
6869
},
69-
owner: 'commaai',
70+
owner: '${{ github.repository_owner }}',
7071
repo: '${{ github.event.repository.name }}',
7172
})
7273
return response.data.id
@@ -87,85 +88,27 @@ jobs:
8788
with:
8889
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
8990
apiToken: ${{ secrets.CLOUDFLARE_PAGES_TOKEN }}
90-
command: pages deploy dist --project-name=connect --branch=${{ needs.pr.outputs.number }} --commit-dirty=true
91+
command: pages deploy dist --project-name=${{ vars.CF_PAGES_PROJECT }} --branch=pr-${{ needs.pr.outputs.number }} --commit-dirty=true
9192

9293
- name: Comment URL on PR
9394
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b
9495
with:
9596
message: |
9697
<!-- _(run_id **${{ github.run_id }}**)_ -->
9798
98-
# deployed preview: https://${{ needs.pr.outputs.number }}.connect-d5y.pages.dev
99+
# preview ready
99100
100-
Welcome to connect! Make sure to:
101-
* read the [contributing guidelines](https://github.com/commaai/connect?tab=readme-ov-file#contributing)
102-
* mark your PR as a draft until it's ready to review
103-
* post the preview on [Discord](https://discord.comma.ai); feedback from users will speedup the PR review
104-
comment-tag: run_id
105-
pr-number: ${{ needs.pr.outputs.number }}
106-
github-token: ${{ secrets.GITHUB_TOKEN }}
107-
108-
- name: Checkout ci-artifacts
109-
uses: actions/checkout@v4
110-
with:
111-
repository: commaai/ci-artifacts
112-
ssh-key: ${{ secrets.CI_ARTIFACTS_DEPLOY_KEY }}
113-
path: ${{ github.workspace }}/ci-artifacts
114-
ref: master
115-
116-
- name: take screenshots
117-
run: bun src/ci/screenshots.ts https://${{ needs.pr.outputs.number }}.connect-d5y.pages.dev ${{ github.workspace }}/ci-artifacts
118-
119-
- name: Push Screenshots
120-
working-directory: ${{ github.workspace }}/ci-artifacts
121-
run: |
122-
git checkout -b connect/pr-${{ needs.pr.outputs.number }}
123-
git config user.name "GitHub Actions Bot"
124-
git config user.email "<>"
125-
git add .
126-
git commit -m "screenshots for PR #${{ needs.pr.outputs.number }}"
127-
git push origin connect/pr-${{ needs.pr.outputs.number }} --force
128-
129-
- name: Add screenshots to comment on PR
130-
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b
131-
with:
132-
message: |
133-
<!-- _(run_id **${{ github.run_id }}**)_ -->
134-
135-
# deployed preview: https://${{ needs.pr.outputs.number }}.connect-d5y.pages.dev
136-
137-
Welcome to connect! Make sure to:
138-
* read the [contributing guidelines](https://github.com/commaai/connect?tab=readme-ov-file#contributing)
139-
* mark your PR as a draft until it's ready to review
140-
* post the preview on [Discord](https://discord.comma.ai); feedback from users will speedup the PR review
141-
142-
### Mobile
143-
<table>
144-
<tr>
145-
<td><img src="https://raw.githubusercontent.com/commaai/ci-artifacts/connect/pr-${{ needs.pr.outputs.number }}/Login-mobile.playwright.png"></td>
146-
<td><img src="https://raw.githubusercontent.com/commaai/ci-artifacts/connect/pr-${{ needs.pr.outputs.number }}/RouteActivity-mobile.playwright.png"></td>
147-
<td><img src="https://raw.githubusercontent.com/commaai/ci-artifacts/connect/pr-${{ needs.pr.outputs.number }}/RouteList-mobile.playwright.png"></td>
148-
<td><img src="https://raw.githubusercontent.com/commaai/ci-artifacts/connect/pr-${{ needs.pr.outputs.number }}/SettingsActivity-mobile.playwright.png"></td>
149-
</tr>
150-
</table>
101+
https://pr-${{ needs.pr.outputs.number }}.${{ vars.PREVIEW_BASE_DOMAIN }}
151102
152-
### Desktop
153-
<table>
154-
<tr>
155-
<td><img src="https://raw.githubusercontent.com/commaai/ci-artifacts/connect/pr-${{ needs.pr.outputs.number }}/Login-desktop.playwright.png"></td>
156-
<td><img src="https://raw.githubusercontent.com/commaai/ci-artifacts/connect/pr-${{ needs.pr.outputs.number }}/RouteActivity-desktop.playwright.png"></td>
157-
<td><img src="https://raw.githubusercontent.com/commaai/ci-artifacts/connect/pr-${{ needs.pr.outputs.number }}/RouteList-desktop.playwright.png"></td>
158-
<td><img src="https://raw.githubusercontent.com/commaai/ci-artifacts/connect/pr-${{ needs.pr.outputs.number }}/SettingsActivity-desktop.playwright.png"></td>
159-
</tr>
160-
</table>
103+
Check the login flow, demo mode, route list, route detail, and settings before merging.
161104
comment-tag: run_id
162105
pr-number: ${{ needs.pr.outputs.number }}
163106
github-token: ${{ secrets.GITHUB_TOKEN }}
164107

165108
update_pr_check:
166109
name: Update PR check
167110
needs: preview
168-
if: always() && github.repository == 'commaai/connect' && github.event.workflow_run.event == 'pull_request'
111+
if: always() && needs.preview.result != 'skipped' && github.event.workflow_run.event == 'pull_request'
169112
runs-on: ubuntu-latest
170113
steps:
171114
- name: Update PR check
@@ -182,6 +125,6 @@ jobs:
182125
title: 'Preview deployment',
183126
summary: 'Result: ${{ needs.preview.result }}',
184127
},
185-
owner: 'commaai',
128+
owner: '${{ github.repository_owner }}',
186129
repo: '${{ github.event.repository.name }}',
187130
})

README.md

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
# connect
1+
# new connect
22

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

5-
Try it out at https://new-connect.connect-d5y.pages.dev.
6-
7-
This is a rewrite of [comma connect](https://github.com/commaai/connect-pwa-archive).
5+
This fork currently keeps compatibility with the existing backend APIs while taking its own product and workflow direction.
86

97
## Development
108

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

1816
cd ~
19-
git clone https://github.com/commaai/new-connect.git
17+
git clone https://github.com/Mahdi451/new-connect.git
2018

21-
cd connect
19+
cd new-connect
2220
bun install # sets up pre-commit hook
2321
bun dev
2422
```
2523

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

30-
connect has a demo mode, so no special comma device is needed to develop connect.
31-
32-
A few constraints to keep connect light and the dev environment fun:
26+
A few constraints keep the app light and the dev environment fast:
3327
* 5k line limit
3428
* 500KB bundle size limit
3529
* 1m timeout for all CI
3630

37-
References:
38-
* [API docs](https://api.comma.ai)
39-
* [openpilot docs](https://docs.comma.ai)
40-
* [Discord](https://discord.comma.ai)
41-
* [Bounties](https://comma.ai/bounties)
31+
## Preview Workflow
32+
33+
Pull requests into `master` are expected to produce a deploy preview when the repo is configured with:
4234

43-
## Roadmap
35+
* `CLOUDFLARE_ACCOUNT_ID`
36+
* `CLOUDFLARE_PAGES_TOKEN`
37+
* `CF_PAGES_PROJECT`
38+
* `PREVIEW_BASE_DOMAIN`
4439

45-
The first goal is to replace current connect and get this shipped to https://connect.comma.ai.
40+
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.
4641

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

49-
Once we've shipped v1, next up will be:
50-
* [Sentry mode](https://www.youtube.com/watch?v=laO0RzsDzfU)
51-
* SSH console for openpilot developers
52-
* Replace snapshot with a live stream
53-
* openpilot clips, like this [community tool](https://github.com/nelsonjchen/op-replay-clipper)
54-
* Manage the settings on your comma 3X
55-
* Car mangement: lock doors, EV charge status, etc.
44+
The first phase for this fork is:
45+
* own the repo and deployment workflow
46+
* replace upstream-facing branding and copy
47+
* improve the day-to-day experience for checking devices, trips, uploads, and settings
48+
* selectively pull upstream fixes only when they are useful

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"name": "connect",
2+
"name": "new-connect",
33
"version": "1.0.0",
4-
"homepage": "https://new-connect.connect-d5y.pages.dev",
4+
"homepage": "https://new-connect.pages.dev",
55
"license": "MIT",
6-
"author": "comma.ai",
6+
"author": "Mahdi451",
77
"repository": {
88
"type": "git",
9-
"url": "https://github.com/commaai/new-connect.git"
9+
"url": "https://github.com/Mahdi451/new-connect.git"
1010
},
1111
"scripts": {
1212
"build": "bun run --bun vite build",

0 commit comments

Comments
 (0)