Skip to content

Commit 85e71c6

Browse files
committed
Merge remote-tracking branch 'origin/develop' into DEV-1249
2 parents 8d9be72 + b0d185d commit 85e71c6

File tree

79 files changed

+1096
-165
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+1096
-165
lines changed

.github/workflows/build_pypi.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,11 @@ jobs:
146146
core.setOutput("pipy-artifact-url", artifact.url);
147147
core.setOutput("pipy-artifact-digests-sha256", artifact.digests.sha256);
148148
clearInterval(intervalId)
149-
} else if (currentAttempt > MAX_ATTEMPTS) {
149+
} else if (currentAttempt >= MAX_ATTEMPTS) {
150150
clearInterval(intervalId)
151151
throw Error('Max attempts exceeded')
152152
}
153-
}, 6 * 1000)
153+
}, 60 * 1000 )
154154
155155
- name: Attach artifacts to release
156156
if: inputs.release-id

.github/workflows/cicd_pipeline.yml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,15 @@ jobs:
148148
with:
149149
ref: ${{ github.event.pull_request.head.ref || github.ref }}
150150

151+
migrations:
152+
name: "Tests"
153+
needs:
154+
- changed_files
155+
if: needs.changed_files.outputs.src == 'true'
156+
uses: heartexlabs/label-studio/.github/workflows/test_migrations.yml@develop
157+
with:
158+
head_sha: ${{ github.event.pull_request.head.sha || github.event.after }}
159+
secrets: inherit
151160

152161
draft-release:
153162
name: "Draft Release"
@@ -194,11 +203,15 @@ jobs:
194203
process.exit()
195204
}
196205
197-
const {data: tags} = await github.rest.repos.listTags({
206+
const tags = await github.paginate(
207+
github.rest.repos.listTags,
208+
{
198209
owner,
199210
repo,
200211
per_page: 100
201-
});
212+
},
213+
(response) => response.data
214+
);
202215
console.log(`Tags:`)
203216
console.log(tags.map(e => e.name))
204217
const matchedTags = tags.filter(e => e.name.indexOf(version) !== -1)
@@ -231,10 +244,15 @@ jobs:
231244
console.log(`Previous version: ${previousTag}`)
232245
233246
console.log('Find or Create a Draft release')
234-
const {data: releases} = await github.rest.repos.listReleases({
247+
const releases = await github.paginate(
248+
github.rest.repos.listReleases,
249+
{
235250
owner,
236251
repo,
237-
});
252+
per_page: 100
253+
},
254+
(response) => response.data
255+
);
238256
let release = releases.find(e => target_commitish.endsWith(e.target_commitish) && e.draft)
239257
if (release) {
240258
console.log(`Draft release already exist ${release.html_url}`)

.github/workflows/cut-off-release-branch.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ jobs:
6060
release_branch="${{ env.RELEASE_BRANCH_PREFIX }}/${first}.${second}.${third}"
6161
next_develop_version="${first}.${second}.$(($third + 1))dev"
6262
63-
echo "release_branch=${release_branch}"
64-
echo "release_version=${release_version}"
65-
echo "next_develop_version=${next_develop_version}"
63+
echo "release_branch=${release_branch}" >> $GITHUB_OUTPUT
64+
echo "release_version=${release_version}" >> $GITHUB_OUTPUT
65+
echo "next_develop_version=${next_develop_version}" >> $GITHUB_OUTPUT
6666
6767
- name: Cut dependencies release branches
6868
uses: actions/github-script@v6
@@ -154,7 +154,7 @@ jobs:
154154
git add ${{ env.PYTHON_VERSION_FILE }}
155155
git commit --message "ci: cut release ${{ steps.calculate_branch_name_and_version.outputs.release_version }}"
156156
157-
echo "commit=$(git rev-parse HEAD)"
157+
echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
158158
git push origin HEAD:refs/heads/${{ steps.calculate_branch_name_and_version.outputs.release_branch }}
159159
160160
- uses: actions/cache@v3
@@ -174,15 +174,15 @@ jobs:
174174
git checkout '${{ github.event.repository.default_branch }}'
175175
176176
branch='bump-version-${{ steps.calculate_branch_name_and_version.outputs.next_develop_version }}'
177-
echo "branch=${branch}"
177+
echo "branch=${branch}" >> $GITHUB_OUTPUT
178178
git checkout -b "${branch}"
179179
180180
sed -i "s/^__version__[ ]*=.*/__version__ = '${{ steps.calculate_branch_name_and_version.outputs.next_develop_version }}'/g" ${{ env.PYTHON_VERSION_FILE }}
181181
182182
git add ${{ env.PYTHON_VERSION_FILE }}
183183
git commit --message "chore: Bump version to ${{ steps.calculate_branch_name_and_version.outputs.next_develop_version }}"
184184
185-
echo "commit=$(git rev-parse HEAD)"
185+
echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
186186
git push origin HEAD:refs/heads/${branch}
187187
188188
- name: Create PR to 'develop'

.github/workflows/docker-release-promote.yml

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,18 @@ jobs:
4040
github-token: ${{ secrets.GIT_PAT }}
4141
script: |
4242
const {repo, owner} = context.repo;
43-
const {data: checks} = await github.rest.checks.listForRef({
44-
owner,
45-
repo,
46-
ref: 'tags/${{ inputs.release_tag }}',
47-
status: "completed",
48-
})
49-
const check = checks.check_runs.find(e => e.name === '${{ env.DOCKER_IMAGE_TAG_CHECK_NAME }}')
43+
const check_runs = await github.paginate(
44+
github.rest.checks.listForRef,
45+
{
46+
owner,
47+
repo,
48+
ref: 'tags/${{ inputs.release_tag }}',
49+
status: "completed",
50+
per_page: 100
51+
},
52+
(response) => response.data
53+
);
54+
const check = check_runs.find(e => e.name === '${{ env.DOCKER_IMAGE_TAG_CHECK_NAME }}')
5055
const details = JSON.parse(check.output.summary)
5156
console.log(details)
5257
core.setOutput("image_version", details.image_version);
@@ -83,11 +88,15 @@ jobs:
8388
return +a[1] - b[1]
8489
}
8590
86-
const {data: tags} = await github.rest.repos.listTags({
87-
owner,
88-
repo,
89-
per_page: 100
90-
});
91+
const tags = await github.paginate(
92+
github.rest.repos.listTags,
93+
{
94+
owner,
95+
repo,
96+
per_page: 100
97+
},
98+
(response) => response.data
99+
);
91100
const rawTags = tags.map(e => e.name)
92101
const filteredTags = rawTags.filter(e => e.match(regexp))
93102
const sortedTags = filteredTags
@@ -284,4 +293,4 @@ jobs:
284293
${{ env.PREFLIGHT_REPO }} \
285294
check container "${image}" \
286295
--submit
287-
done <<< '${{ steps.generate-tags.outputs.redhat-tags }},'
296+
done <<< '${{ steps.generate-tags.outputs.redhat-tags }},'
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: "Tests"
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
head_sha:
7+
required: true
8+
type: string
9+
10+
env:
11+
NODE: '14'
12+
CACHE_NAME_PREFIX: v1
13+
14+
jobs:
15+
migrations:
16+
name: "migrations"
17+
runs-on: ubuntu-20.04
18+
timeout-minutes: 20
19+
env:
20+
DJANGO_SETTINGS_MODULE: core.settings.label_studio
21+
COVERAGE_PROCESS_START: 1
22+
LOG_DIR: pytest_logs
23+
collect_analytics: true
24+
DEBUG_CONTEXTLOG: true
25+
LABEL_STUDIO_TEST_ENVIRONMENT: false
26+
SENTRY_ENVIRONMENT: tests-ubuntu-sqlite
27+
SENTRY_RATE: 0
28+
DJANGO_DB: sqlite
29+
JSON_LOG: 0
30+
# SENTRY_DSN:
31+
32+
steps:
33+
- uses: hmarr/[email protected]
34+
35+
- name: Checkout
36+
uses: actions/checkout@v3
37+
with:
38+
ref: ${{ inputs.ref }}
39+
40+
- name: Set up Python ${{ matrix.python-version }}
41+
uses: actions/setup-python@v4
42+
with:
43+
python-version: '3.9'
44+
45+
- name: Install OS dependencies
46+
run: |
47+
sudo apt-get update
48+
sudo apt-get install libsasl2-dev python3-dev libldap2-dev libssl-dev libxml2-dev libxslt-dev
49+
50+
- uses: actions/cache@v3
51+
name: Configure pip cache
52+
id: pip-cache
53+
with:
54+
# Cache the Python package environment, excluding pip and setuptools and label_studio* installed by setup-python
55+
path: |
56+
~/.cache/pip
57+
${{ env.pythonLocation }}/bin/*
58+
${{ env.pythonLocation }}/include
59+
${{ env.pythonLocation }}/lib/python*/site-packages/*
60+
!${{ env.pythonLocation }}/bin/pip*
61+
!${{ env.pythonLocation }}/lib/python*/site-packages/pip*
62+
!${{ env.pythonLocation }}/lib/python*/site-packages/setuptools*
63+
!${{ env.pythonLocation }}/lib/python*/site-packages/label_studio*
64+
key: ${{ runner.os }}-pip-${{ env.pythonLocation }}-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/requirements-test.txt') }}
65+
restore-keys: |
66+
${{ env.CACHE_NAME_PREFIX }}-${{ runner.os }}-pip-django-${{ env.pythonLocation }}-
67+
68+
- name: Install dependencies
69+
run: |
70+
python -m pip install --upgrade pip setuptools
71+
pip install --upgrade cython
72+
pip install -U pip==20.2
73+
pip install -r deploy/requirements.txt -r deploy/requirements-test.txt
74+
pip install -e .
75+
76+
- name: Test migrations
77+
run: |
78+
output=$(python label_studio/manage.py makemigrations)
79+
if ! grep 'No changes detected' <<< "${output}"; then
80+
error="${output}"
81+
error="${error//'%'/'%25'}"
82+
error="${error//$'\n'/'%0A'}"
83+
error="${error//$'\r'/'%0D'}"
84+
echo "::error::${error}"
85+
exit 1
86+
fi

.github/workflows/tests.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ on:
99

1010
env:
1111
NODE: '14'
12+
CACHE_NAME_PREFIX: v1
1213

1314
jobs:
1415
run_pytest_sqlite:
1516
name: LS SQLite Ubuntu
16-
runs-on: ubuntu-latest
17+
runs-on: ubuntu-20.04
1718
strategy:
1819
fail-fast: false
1920
matrix:
@@ -58,7 +59,7 @@ jobs:
5859
name: Configure pip cache
5960
id: pip-cache
6061
with:
61-
# Cache the Python package environment, excluding pip and setuptools installed by setup-python
62+
# Cache the Python package environment, excluding pip and setuptools and label_studio* installed by setup-python
6263
path: |
6364
~/.cache/pip
6465
${{ env.pythonLocation }}/bin/*
@@ -67,9 +68,10 @@ jobs:
6768
!${{ env.pythonLocation }}/bin/pip*
6869
!${{ env.pythonLocation }}/lib/python*/site-packages/pip*
6970
!${{ env.pythonLocation }}/lib/python*/site-packages/setuptools*
71+
!${{ env.pythonLocation }}/lib/python*/site-packages/label_studio*
7072
key: ${{ runner.os }}-pip-${{ env.pythonLocation }}-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/requirements-test.txt') }}
7173
restore-keys: |
72-
${{ runner.os }}-pip-${{ env.pythonLocation }}-
74+
${{ env.CACHE_NAME_PREFIX }}-${{ runner.os }}-pip-django-${{ env.pythonLocation }}-
7375
7476
- name: Install dependencies
7577
run: |
@@ -121,7 +123,7 @@ jobs:
121123

122124
run_pytest_postgresql:
123125
name: LS PostgreSQL Ubuntu
124-
runs-on: ubuntu-latest
126+
runs-on: ubuntu-20.04
125127
strategy:
126128
fail-fast: false
127129
matrix:
@@ -198,7 +200,7 @@ jobs:
198200
name: Configure pip cache
199201
id: pip-cache
200202
with:
201-
# Cache the Python package environment, excluding pip and setuptools installed by setup-python
203+
# Cache the Python package environment, excluding pip and setuptools and label_studio* installed by setup-python
202204
path: |
203205
~/.cache/pip
204206
${{ env.pythonLocation }}/bin/*
@@ -207,9 +209,10 @@ jobs:
207209
!${{ env.pythonLocation }}/bin/pip*
208210
!${{ env.pythonLocation }}/lib/python*/site-packages/pip*
209211
!${{ env.pythonLocation }}/lib/python*/site-packages/setuptools*
212+
!${{ env.pythonLocation }}/lib/python*/site-packages/label_studio*
210213
key: ${{ runner.os }}-pip-${{ env.pythonLocation }}-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/requirements-test.txt') }}
211214
restore-keys: |
212-
${{ runner.os }}-pip-${{ env.pythonLocation }}-
215+
${{ env.CACHE_NAME_PREFIX }}-${{ runner.os }}-pip-django-${{ env.pythonLocation }}-
213216
214217
- name: Install pip dependencies
215218
run: |

.github/workflows/upstream_repo_sync.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ env:
1212
NODE: 14
1313
CACHE_NAME_PREFIX: v1
1414
STATIC_DIST: 'label_studio/frontend/dist'
15+
RELEASE_BRANCH_PREFIX: "ls-release/"
1516

1617
jobs:
1718
open:
@@ -140,7 +141,7 @@ jobs:
140141
141142
branch_name='${{ steps.get-pr.outputs.branch-name }}'
142143
143-
if grep -q '^ls-release/.*$' <<< '${{ github.event.client_payload.base_branch_name }}'; then
144+
if grep -q '^${{ env.RELEASE_BRANCH_PREFIX }}.*$' <<< '${{ github.event.client_payload.base_branch_name }}'; then
144145
git checkout '${{ github.event.client_payload.base_branch_name }}'
145146
else
146147
git checkout '${{ github.event.repository.default_branch }}'
@@ -175,6 +176,7 @@ jobs:
175176
uses: actions/github-script@v6
176177
env:
177178
TITLE: ${{ github.event.client_payload.title }}
179+
RELEASE_BRANCH_PREFIX: "${{ env.RELEASE_BRANCH_PREFIX }}"
178180
with:
179181
github-token: ${{ secrets.GIT_PAT }}
180182
script: |
@@ -200,7 +202,7 @@ jobs:
200202
}
201203
} else {
202204
let base = '${{ github.event.repository.default_branch }}'
203-
if ( '${{ github.event.client_payload.base_branch_name }}'.startsWith('lse-release/') ) {
205+
if ( '${{ github.event.client_payload.base_branch_name }}'.startsWith(process.env.RELEASE_BRANCH_PREFIX) ) {
204206
base = '${{ github.event.client_payload.base_branch_name }}'
205207
}
206208
const createPullResponse = await github.rest.pulls.create({
@@ -238,12 +240,16 @@ jobs:
238240
let openPRs = []
239241
for (let submodule of submodules) {
240242
core.info(`Checking ${ submodule.owner }/${ submodule.repo }`)
241-
const { data: listAllOpenPulls } = await github.rest.pulls.list({
242-
owner: submodule.owner,
243-
repo: submodule.repo,
244-
status: 'open',
245-
per_page: 100
246-
});
243+
const listAllOpenPulls = await github.paginate(
244+
github.rest.pulls.list,
245+
{
246+
owner: submodule.owner,
247+
repo: submodule.repo,
248+
status: 'open',
249+
per_page: 100
250+
},
251+
(response) => response.data
252+
);
247253
248254
const listOpenPulls = listAllOpenPulls.filter(e => e.head.ref.toLowerCase() === branchNameLowerCase)
249255

0 commit comments

Comments
 (0)