-
Notifications
You must be signed in to change notification settings - Fork 77
129 lines (109 loc) · 3.45 KB
/
build.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: build
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-pnpm
- run: pnpm install
- run: pnpm build:development
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-pnpm
- run: |
pnpm install
cd ./node_modules/puppeteer
pnpm install
- run: pnpm run build:development
- name: Lint
run: pnpm lint
- name: Run unit tests
run: pnpm test
- name: Run end-to-end tests
run: pnpm test-puppeteer-build
# bundle_size:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: ./.github/actions/setup-pnpm
# - uses: preactjs/compressed-size-action@v2
# with:
# repo-token: ${{ secrets.GITHUB_TOKEN }}
# build-script: build:production
# pattern: "./dist/assets/*.{css,js}"
# strip-hash: "\\b-\\w{8}"
# minimum-change-threshold: 100
lighthouse:
runs-on: ubuntu-latest
if: github.repository == 'commaai/connect'
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-pnpm
- run: pnpm install
- run: pnpm build:production
- name: run Lighthouse CI
run: |
pnpm add -g @lhci/cli@0.12.x
lhci autorun
env:
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
docker:
runs-on: ubuntu-latest
needs: [test]
if: github.repository == 'commaai/connect'
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v3
- id: buildx
uses: docker/setup-buildx-action@v2
- uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/commaai/connect
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 date
run: echo "GIT_TIMESTAMP=$(git show -s --format=%cI)" >> $GITHUB_ENV
- uses: docker/build-push-action@v4
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: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
- run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache