comma threex -> 3X #55
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: build | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| merge_group: | |
| types: [checks_requested] | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 1 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: oven-sh/setup-bun@v2 | |
| - uses: actions/cache@v4 | |
| id: playwright-cache | |
| with: | |
| path: | | |
| ~/.cache/ms-playwright | |
| key: ${{ runner.os }}-playwright-${{ hashFiles('**/bun.lockb') }} | |
| - name: Run tests | |
| run: | | |
| echo "::add-matcher::.github/tsc.json" | |
| ./test.sh | |
| env: | |
| SKIP_PLAYWRIGHT_INSTALL: ${{ steps.playwright-cache.outputs.cache-hit }} | |
| build: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 1 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: oven-sh/setup-bun@v2 | |
| - name: get commit date | |
| run: echo "VITE_APP_GIT_TIMESTAMP=$(git show -s --format=%cI)" >> $GITHUB_ENV | |
| - run: bun install --frozen-lockfile | |
| - run: bun run build | |
| env: | |
| VITE_SENTRY_ENVIRONMENT: ${{ github.ref == 'refs/heads/master' && 'production' || 'staging' }} | |
| VITE_APP_GIT_SHA: ${{ github.event_name == 'push' && github.sha || github.event.pull_request.head.sha }} | |
| - name: Bundle size breakdown | |
| run: bun dependency-report | column -t -s ":" | |
| - run: bun bundle-size ./dist | |
| - name: Upload built project | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| path: ./dist | |
| overwrite: true | |
| retention-days: 1 | |
| name: build-artifacts-${{ github.run_id }} | |
| - name: Deploy to Cloudflare Pages | |
| if: github.ref == 'refs/heads/master' && github.repository == 'commaai/connect' | |
| 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 | |
| docker: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 1 | |
| permissions: | |
| packages: write | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - id: buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - uses: docker/login-action@v3 | |
| if: github.ref == 'refs/heads/master' && github.repository == 'commaai/connect' | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/commaai/connect2 # TODO: switch to 'connect' after launch | |
| tags: | | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| type=ref,event=branch | |
| type=ref,event=pr,prefix= | |
| type=sha,format=long,prefix= | |
| env: | |
| DOCKER_METADATA_PR_HEAD_SHA: true | |
| - name: get commit date | |
| run: echo "GIT_TIMESTAMP=$(git show -s --format=%cI)" >> $GITHUB_ENV | |
| - uses: docker/build-push-action@v6 | |
| env: | |
| DOCKER_BUILD_SUMMARY: false | |
| with: | |
| build-args: | | |
| VITE_APP_GIT_SHA=${{ github.event_name == 'push' && github.sha || github.event.pull_request.head.sha }} | |
| VITE_APP_GIT_TIMESTAMP=${{ env.GIT_TIMESTAMP }} | |
| SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} | |
| 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/connect' }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} |