-
Notifications
You must be signed in to change notification settings - Fork 390
194 lines (167 loc) · 5.25 KB
/
argilla-server.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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
name: Build Argilla server package
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
push:
tags:
- "*"
branches:
- main
- develop
- releases/**
pull_request:
paths:
- argilla-server/**
types:
- opened
- edited
- reopened
- synchronize
- ready_for_review
release:
types:
- published
jobs:
build:
name: Build `argilla-server` package
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
working-directory: argilla-server
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:8.8.2
ports:
- 9200:9200
env:
discovery.type: single-node
xpack.security.enabled: false
postgres:
image: postgres:14
env:
POSTGRES_HOST: localhost
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: argilla
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
env:
ARGILLA_ENABLE_TELEMETRY: 0
steps:
- name: Checkout Code 🛎
uses: actions/checkout@v4
- name: Setup PDM
uses: pdm-project/setup-pdm@v4
with:
python-version-file: argilla-server/pyproject.toml
cache-dependency-path: argilla-server/pdm.lock
cache: true
- name: Install dependencies
run: pdm install
- name: Run tests 📈
run: |
ARGILLA_DATABASE_URL=postgresql://postgres:postgres@localhost:5432/argilla
ARGILLA_ELASTICSEARCH=http://localhost:9200
ARGILLA_SEARCH_ENGINE=elasticsearch
pdm test tests/unit -vs --cov=argilla_server --cov-report=xml:coverage.xml
- name: Upload test coverage
uses: codecov/codecov-action@v4
with:
file: coverage.xml
flags: argilla-server
token: ${{ secrets.CODECOV_TOKEN }}
# This section is used to build the frontend and copy the build files to the server.
# In the future, static files should be downloaded after the frontend is built and uploaded as an artifact.
- name: Setup Node.js for frontend dependencies
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install frontend dependencies
working-directory: argilla-frontend
env:
BASE_URL: "@@baseUrl@@"
DIST_FOLDER: ./dist
run: |
npm install
npm run build
# End of frontend build section
- name: Build package
run: |
cp -r ../argilla-frontend/dist src/argilla_server/static
pdm build
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: argilla-server
path: argilla-server/dist
build_server_docker_image:
name: Build Argilla server docker image
uses: ./.github/workflows/argilla-server.build-docker-image.yml
needs:
- build
with:
download-python-package: true
image-name: argilla/argilla-server
dockerfile: argilla-server/docker/server/Dockerfile
context: argilla-server/docker/server
readme: argilla-server/README.md
platforms: linux/amd64,linux/arm64
secrets: inherit
build_quickstart_docker_image:
name: Build Argilla quickstart docker image
uses: ./.github/workflows/argilla-server.build-docker-image.yml
needs: build_server_docker_image
with:
download-python-package: false
image-name: argilla/argilla-quickstart
dockerfile: argilla-server/docker/quickstart/Dockerfile
context: argilla-server/docker/quickstart
readme: argilla-server/docker/quickstart/README.md
platforms: linux/amd64,linux/arm64
build-args: |
ARGILLA_VERSION=${{ needs.build_server_docker_image.outputs.version }}
secrets: inherit
# This job will publish argilla-server python package into PyPI repository
publish_release:
name: Publish Release
runs-on: ubuntu-latest
if: ${{ github.event_name == 'release' }}
needs:
- build
- build_server_docker_image
- build_quickstart_docker_image
permissions:
# This permission is needed for private repositories.
# contents: read
# IMPORTANT: this permission is mandatory for trusted publishing on PyPI
id-token: write
defaults:
run:
shell: bash -l {0}
working-directory: ./argilla-server
steps:
- name: Checkout Code 🛎
uses: actions/checkout@v4
- name: Download python package
uses: actions/download-artifact@v4
with:
name: argilla-server
path: argilla-server/dist
- name: Setup PDM
uses: pdm-project/setup-pdm@v4
with:
cache: true
- name: Publish Package to PyPI test environment 🥪
run: pdm publish --no-build --repository testpypi
- name: Test Installing 🍿
run: pip install --index-url https://test.pypi.org/simple --no-deps argilla-server==${GITHUB_REF#refs/*/v}
- name: Publish Package to PyPI 🥩
run: pdm publish --no-build