-
Notifications
You must be signed in to change notification settings - Fork 25
168 lines (158 loc) · 5.54 KB
/
release.yml
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
name: Build and Publish
on:
pull_request:
branches:
- main
push:
branches:
- main
tags:
- '*'
workflow_dispatch:
inputs:
tag:
description: "The tag to build the image with. Format *.*.*((beta|rc)*)?"
required: true
jobs:
docker-metadata:
name: Generate docker metadata
runs-on: ubuntu-latest
outputs:
tags: ${{steps.meta.outputs.tags}}
labels: ${{steps.meta.outputs.labels}}
annotations: ${{steps.meta.outputs.annotations}}
platforms: |
linux/amd64
${{(startsWith(github.ref, 'refs/tags/') && 'linux/arm64') || ''}}
permissions:
contents: read
steps:
- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
github-token: ${{ github.token }}
images: "{0}/{1}"
tags: |
type=raw,value=branch-{{branch}},enable=${{ !startsWith(github.ref, 'refs/tags/') && !startsWith(github.ref, 'refs/pull/') }}
type=sha,prefix=sha-,format=long,suffix=-dev,enable=${{ !startsWith(github.ref, 'refs/tags/') }}
type=sha,prefix=sha-,format=long,enable=${{ startsWith(github.ref, 'refs/tags/') }}
type=ref,event=pr
type=pep440,value=${{inputs.tag || github.ref_name}},pattern={{version}}
type=pep440,value=${{inputs.tag || github.ref_name}},pattern={{major}}.{{minor}}
type=pep440,value=${{inputs.tag || github.ref_name}},pattern={{major}}
build-backend:
name: Build and Push Backend Image
runs-on: ubuntu-latest
needs: docker-metadata
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.RELEASE_DOCKERHUB_USERNAME }}
password: ${{ secrets.RELEASE_DOCKERHUB_TOKEN }}
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build and push backend
uses: docker/build-push-action@v6
with:
context: backend
platforms: ${{needs.docker-metadata.outputs.platforms}}
push: true
tags: ${{format(needs.docker-metadata.outputs.tags, secrets.RELEASE_DOCKERHUB_USERNAME, 'backend')}}
labels: ${{needs.docker-metadata.outputs.labels}}
annotations: ${{needs.docker-metadata.outputs.annotations}}
cache-from: type=gha
cache-to: type=gha,mode=max
build-frontend:
name: Build and Push Frontend Image
runs-on: ubuntu-latest
needs: docker-metadata
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.RELEASE_DOCKERHUB_USERNAME }}
password: ${{ secrets.RELEASE_DOCKERHUB_TOKEN }}
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build and push frontend
uses: docker/build-push-action@v6
with:
context: .
file: ./frontend/Dockerfile
platforms: ${{needs.docker-metadata.outputs.platforms}}
push: true
tags: ${{format(needs.docker-metadata.outputs.tags, secrets.RELEASE_DOCKERHUB_USERNAME, 'frontend')}}
labels: ${{needs.docker-metadata.outputs.labels}}
annotations: ${{needs.docker-metadata.outputs.annotations}}
cache-from: type=gha
cache-to: type=gha,mode=max
e2e-test:
name: E2E Test
runs-on: ubuntu-latest
timeout-minutes: 10
defaults:
run:
working-directory: e2e
needs:
- build-backend
- build-frontend
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
cache: npm
cache-dependency-path: e2e/package-lock.json
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run tests
run: ./start-test.sh
env:
E2E_DOCKER_TAG: sha-${{ github.sha }}-dev
E2E_LLM_PROVIDER: ${{vars.E2E_LLM_PROVIDER}}
E2E_LLM_MODEL: ${{vars.E2E_LLM_MODEL || ''}}
E2E_LLM_CREDENTIALS: ${{secrets.E2E_LLM_CREDENTIALS}}
E2E_EMBEDDING_PROVIDER: ${{vars.E2E_EMBEDDING_PROVIDER || 'openai'}}
E2E_EMBEDDING_MODEL: ${{vars.E2E_EMBEDDING_MODEL || ''}}
E2E_EMBEDDING_CREDENTIALS: ${{secrets.E2E_EMBEDDING_CREDENTIALS}}
E2E_RERANKER_PROVIDER: ${{vars.E2E_RERANKER_PROVIDER || 'jinaai'}}
E2E_RERANKER_MODEL: ${{vars.E2E_RERANKER_MODEL || ''}}
E2E_RERANKER_CREDENTIALS: ${{secrets.E2E_RERANKER_CREDENTIALS}}
- uses: actions/upload-artifact@v4
if: failure()
with:
name: e2e-report
path: e2e/playwright-report/
retention-days: 30