This repository has been archived by the owner on Jun 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
213 lines (201 loc) · 7.4 KB
/
package.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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
name: Build package
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
release:
types:
- "published"
push:
branches:
- "main"
- "develop"
- "releases/**"
tags:
- "*"
pull_request:
branches:
- "main"
- "develop"
- "releases/**"
- "feature/**"
- "feat/**"
- "fix/**"
# TODO: Delete this after we check that everything is working as expected.
- "project-creation-with-pdm"
types:
- opened
- reopened
- synchronize
- ready_for_review
jobs:
check_repo_files:
name: Check source changes
if: ${{ !github.event.pull_request.draft }}
uses: ./.github/workflows/check-repo-files.yml
deployable_check:
name: Check if must build & deploy from environment
runs-on: ubuntu-latest
needs: check_repo_files
env:
IS_DEPLOYABLE: ${{ secrets.AR_DOCKER_USERNAME != '' && needs.check_repo_files.outputs.buildChanges == 'true' }}
outputs:
isDeployable: ${{ steps.set_output.outputs.is_deployable }}
steps:
- name: set output
id: set_output
run: |
echo "is_deployable=$IS_DEPLOYABLE" >> $GITHUB_OUTPUT
run_unit_tests:
strategy:
matrix:
include:
- searchEngineDockerImage: docker.elastic.co/elasticsearch/elasticsearch:8.8.2
searchEngineDockerEnv: '{"discovery.type": "single-node", "xpack.security.enabled": "false"}'
coverageReport: coverage-elasticsearch-8.8.2
runsOn: ubuntu-latest
- searchEngineDockerImage: opensearchproject/opensearch:2.4.1
searchEngineDockerEnv: '{"discovery.type": "single-node", "plugins.security.disabled": "true"}'
coverageReport: coverage-opensearch-2.4.1
runsOn: ubuntu-latest
name: Run unit tests
uses: ./.github/workflows/run-python-tests.yml
needs: check_repo_files
if: needs.check_repo_files.outputs.pythonChanges == 'true'
with:
searchEngineDockerImage: ${{ matrix.searchEngineDockerImage }}
searchEngineDockerEnv: ${{ matrix.searchEngineDockerEnv }}
coverageReport: coverage
runsOn: ${{ matrix.runsOn }}
pytestArgs: tests/unit
secrets: inherit
run_unit_test_with_extra_engines:
strategy:
matrix:
include:
- searchEngineDockerImage: docker.elastic.co/elasticsearch/elasticsearch:8.8.0
searchEngineDockerEnv: '{"discovery.type": "single-node", "xpack.security.enabled": "false"}'
coverageReport: coverage-elasticsearch-8.8.0
runsOn: ubuntu-latest
- searchEngineDockerImage: docker.elastic.co/elasticsearch/elasticsearch:8.6.0
searchEngineDockerEnv: '{"discovery.type": "single-node", "xpack.security.enabled": "false"}'
coverageReport: coverage-elasticsearch-8.6.0
runsOn: ubuntu-latest
- searchEngineDockerImage: opensearchproject/opensearch:2.8.0
searchEngineDockerEnv: '{"discovery.type": "single-node", "plugins.security.disabled": "true"}'
coverageReport: coverage-opensearch-2.8.0
runsOn: ubuntu-latest
name: Run unit tests with extra engines
uses: ./.github/workflows/run-python-tests.yml
needs: check_repo_files
if: |
needs.check_repo_files.outputs.pythonChanges == 'true' &&
startsWith(github.event.ref, 'refs/tags/v')
with:
searchEngineDockerImage: ${{ matrix.searchEngineDockerImage }}
searchEngineDockerEnv: ${{ matrix.searchEngineDockerEnv }}
coverageReport: coverage
runsOn: ${{ matrix.runsOn }}
pytestArgs: tests/unit
secrets: inherit
push_coverage:
name: Upload code coverage
runs-on: ubuntu-latest
needs:
- run_unit_tests
steps:
- name: Checkout Code 🛎
uses: actions/checkout@v3
- uses: actions/download-artifact@v3
- name: Copy all reports
run: find coverage-report*/ -name "*.xml" -exec mv '{}' . \;
- name: Display current files structure
run: ls -R
- name: Upload Coverage reports to Codecov 📦
uses: codecov/codecov-action@v2
build_python_package:
name: Build Argilla python package
uses: ./.github/workflows/build-python-package.yml
needs: deployable_check
if: needs.deployable_check.outputs.isDeployable == 'true'
secrets: inherit
# build_server_docker_image:
# name: Build Argilla server docker image
# uses: ./.github/workflows/build-push-docker.yml
# needs:
# - build_python_package
# - run_unit_tests
# if: |
# !cancelled() &&
# needs.build_python_package.result == 'success' &&
# !contains(needs.*.result, 'failure') &&
# !contains(needs.*.result, 'cancelled')
# with:
# download-python-package: true
# image-name: argilla/argilla-server
# dockerfile: docker/Dockerfile
# readme: README.md
# platforms: linux/amd64,linux/arm64
# secrets: inherit
# build_quickstart_docker_image:
# name: Build Argilla quickstart docker image
# uses: ./.github/workflows/build-push-docker.yml
# needs: build_server_docker_image
# if: |
# !cancelled() &&
# needs.build_server_docker_image.result == 'success'
# with:
# download-python-package: false
# image-name: argilla/argilla-quickstart
# dockerfile: docker/quickstart.Dockerfile
# readme: docker/quickstart.README.md
# platforms: linux/amd64,linux/arm64
# build-args: |
# ARGILLA_VERSION=${{ needs.build_server_docker_image.outputs.version }}
# secrets: inherit
# deploy_environment:
# name: Deploy branch environment
# uses: ./.github/workflows/deploy-environment.yml
# needs: build_quickstart_docker_image
# if: |
# !cancelled() &&
# needs.build_quickstart_docker_image.result == 'success' &&
# github.event_name == 'pull_request' && github.event.pull_request.draft == false
# with:
# image-name: argilla/argilla-quickstart
# image-version: ${{ needs.build_quickstart_docker_image.outputs.version }}
# secrets: inherit
# This job will upload a Python Package using Twine when a release is created
# For more information see:
# https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
# publish_release:
# name: Publish Release
# runs-on: ubuntu-latest
# if: ${{ github.event_name == 'release' }}
# needs:
# - build_quickstart_docker_image
# defaults:
# run:
# shell: bash -l {0}
# steps:
# - name: Checkout Code 🛎
# uses: actions/checkout@v3
# - name: Download python package
# uses: actions/download-artifact@v2
# with:
# name: python-package
# path: dist
# - name: Publish Package to TestPyPI 🥪
# uses: pypa/gh-action-pypi-publish@master
# with:
# user: __token__
# password: ${{ secrets.AR_TEST_PYPI_API_TOKEN }}
# repository_url: https://test.pypi.org/legacy/
# - name: Test Installing 🍿
# run: pip install --index-url https://test.pypi.org/simple --no-deps argilla==${GITHUB_REF#refs/*/v}
# - name: Publish Package to PyPI 🥩
# uses: pypa/gh-action-pypi-publish@master
# with:
# user: __token__
# password: ${{ secrets.AR_PYPI_API_TOKEN }}