Skip to content

Commit

Permalink
Merge branch 'develop' into fb-LSDV-5367
Browse files Browse the repository at this point in the history
  • Loading branch information
makseq authored Dec 19, 2023
2 parents d7c35a1 + c0f5e26 commit e016369
Show file tree
Hide file tree
Showing 574 changed files with 34,258 additions and 14,339 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@
!README.md
!licenses/**
!LICENSE
!pyproject.toml
!poetry.lock
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
.github/ @farioas
docs/.npmignore @hlomzik @Gondragos @nicholasrq
docs/package.json @hlomzik @Gondragos @nicholasrq
docs/yarn.lock @hlomzik @Gondragos @nicholasrq
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: Bug report
about: Create a report to help us improve
title: ''
labels: 'issue: bug'
assignees: makseq

---

Expand Down
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: makseq

---

Expand Down
4 changes: 4 additions & 0 deletions .github/codeql/codeql-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name: "CodeQL config"

paths-ignore:
- label_studio/frontend/dist
28 changes: 14 additions & 14 deletions .github/helpers/gh_changelog_generator/gh_changelog_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,23 +192,23 @@ def get_task(task_number: str, pr: int = None) -> AhaFeature or None:
if task_number in TASK_CACHE.keys():
return TASK_CACHE.get(task_number)
try:
task = AhaFeature(task_number, pr)
task = JiraIssue(task_number, pr)
TASK_CACHE[task_number] = task
return task
except Exception as e:
print(f'Could not find Feature {task_number} in Aha!: {e}')
print(f'Could not find Issue {task_number} in Jira: {e}')
try:
task = AhaRequirement(task_number, pr)
task = AhaFeature(task_number, pr)
TASK_CACHE[task_number] = task
return task
except Exception as e:
print(f'Could not find Requirement {task_number} in Aha!: {e}')
print(f'Could not find Feature {task_number} in Aha!: {e}')
try:
task = JiraIssue(task_number, pr)
task = AhaRequirement(task_number, pr)
TASK_CACHE[task_number] = task
return task
except Exception as e:
print(f'Could not find Issue {task_number} in Jira: {e}')
print(f'Could not find Requirement {task_number} in Aha!: {e}')
return None


Expand All @@ -228,7 +228,7 @@ def get_aha_release_features(release_num: str) -> list[AhaFeature]:


def get_aha_release_features_by_tag(tag: str) -> list[AhaFeature]:
features = aha_client.paginate(f'api/v1/features', 'features', data={"tag": tag})
features = aha_client.paginate('api/v1/features', 'features', data={"tag": tag})
tasks = set()
for feature in features:
if task := get_task(feature.get('reference_num')):
Expand Down Expand Up @@ -366,11 +366,11 @@ def render_output_md(
f'[Jira Release {RELEASE_VERSION}]({JIRA_SERVER}/projects/{JIRA_PROJECT}/versions/'
f'{jira_release.id}/tab/release-report-all-issues)')
else:
comment.append(f'Jira Release not found')
comment.append('Jira Release not found')
if aha_release:
comment.append(f'[Aha! Release {RELEASE_VERSION}]({aha_release.get("url", "")})')
else:
comment.append(f'Aha! Release not found')
comment.append('Aha! Release not found')

if len(missing_in_tracker) == 0:
comment.append('Release Notes are generated based on git log: No tasks found in Task Tracker.')
Expand Down Expand Up @@ -445,7 +445,7 @@ def main():
aha_release_features = get_aha_release_features(aha_release.get("reference_num", None))
print(f"Aha! Release {aha_release.get('url', '')}")
else:
print(f"Aha! Release not found")
print("Aha! Release not found")
else:
if AHA_TAG:
aha_release = {'url': f'{AHA_SERVER}/api/v1/features?tag={AHA_TAG.replace(" ", "%20")}'}
Expand All @@ -461,7 +461,7 @@ def main():
f"Jira Release {JIRA_SERVER}/projects/{JIRA_PROJECT}/versions/"
f"{jira_release.id}/tab/release-report-all-issues]")
else:
print(f"Jira Release not found")
print("Jira Release not found")

tracker_release_tasks = jira_release_issues + aha_release_features

Expand All @@ -473,7 +473,7 @@ def main():
missing_in_tracker = missing_tasks(gh_release_tasks, tracker_release_tasks)
missing_release_note_field = [x for x in tracker_release_tasks if not x.release_note]
else:
print(f"No tasks found in Task Tracker")
print("No tasks found in Task Tracker")
print("Using GitHub as a source")
sorted_release_tasks = sort_task_by_label(gh_release_tasks)
missing_in_gh = []
Expand All @@ -500,7 +500,7 @@ def main():
print(f"Creating a markdown output file: '{OUTPUT_FILE_MD}'")
f.write(output_md)
else:
print(f"OUTPUT_FILE_MD is not specified")
print("OUTPUT_FILE_MD is not specified")
print(output_md)

output_json = render_output_json(sorted_release_tasks)
Expand All @@ -509,7 +509,7 @@ def main():
print(f"Creating a json output file: '{OUTPUT_FILE_JSON}'")
json.dump(output_json, f)
else:
print(f"OUTPUT_FILE_JSON is not specified")
print("OUTPUT_FILE_JSON is not specified")
print(output_json)


Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/bandit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ jobs:
- uses: hmarr/[email protected]

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ inputs.head_sha }}

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.10'

Expand All @@ -45,7 +45,7 @@ jobs:
if: always()
run: cat ${{ env.REPORT_PATH }}

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: always()
with:
name: Security check results
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/blue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Blue

on:
workflow_call:
inputs:
head_sha:
required: true
type: string

jobs:
blue:
name: Blue
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.head_sha }}

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- uses: pre-commit/[email protected]
with:
extra_args: blue --all-files --hook-stage pre-push
49 changes: 26 additions & 23 deletions .github/workflows/build_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ on:
type: string
required: false

env:
PYTHON_VERSION_FILE: "pyproject.toml"

jobs:
pypi:
name: "PyPI"
Expand All @@ -57,41 +60,41 @@ jobs:
- uses: hmarr/[email protected]

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}

- name: Install toml
run: |
set -euo pipefail
wget -q -O- "https://github.com/gnprice/toml-cli/releases/download/v0.2.3/toml-0.2.3-x86_64-linux.tar.gz" | tar -xz -C .
mv toml-0.2.3-x86_64-linux/toml toml
chmod +x toml
- name: Manage version
env:
PROVIDED_VERSION: ${{ inputs.version }}
run: |
set -x
set -euo pipefail
version=$(sed "s/^v//g" <<< ${PROVIDED_VERSION})
sed -i "s/^__version__[ ]*=.*/__version__ = '${version}'/g" label_studio/__init__.py
./toml set '${{ env.PYTHON_VERSION_FILE }}' tool.poetry.version "$version" > pyproject.toml.new
mv -f pyproject.toml.new pyproject.toml
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Configure pip cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pypi-${{ hashFiles('deploy/requirements-mw.txt') }}-${{ hashFiles('deploy/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pypi-
- name: Set up Poetry
uses: snok/install-poetry@v1

- name: Install dependencies
- name: Install Python dependencies
run: |
pip install -r deploy/requirements-mw.txt
pip install -r deploy/requirements.txt
pip install -e .
pip install twine
poetry install --with build
- name: Collect static
run: |
python label_studio/manage.py collectstatic
poetry run python label_studio/manage.py collectstatic
- name: Download feature flags
env:
Expand All @@ -105,7 +108,7 @@ jobs:
--retry-delay 10 \
-H "Authorization: $LAUNCHDARKLY_COMMUNITY_SDK_KEY" \
"https://sdk.launchdarkly.com/sdk/latest-all" >"$LAUNCHDARKLY_DOWNLOAD_PATH"
if [ "$(jq 'has("flags")' <<< cat $LAUNCHDARKLY_DOWNLOAD_PATH)" = "true" ]; then
if [ "$(jq 'has("flags")' <<< cat $LAUNCHDARKLY_DOWNLOAD_PATH)" = "true" ]; then
echo "feature_flags.json is valid"
else
echo "feature_flags.json is invalid"
Expand All @@ -116,19 +119,19 @@ jobs:
- name: Package
env:
VERSION_OVERRIDE: ${{ inputs.version }}
run: python setup.py sdist bdist_wheel
run: poetry build

- name: Upload to PYPI
if: inputs.upload_to_pypi
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_APIKEY }}
run: twine upload dist/*
run: poetry run twine upload dist/*

- name: Get PyPI package details
id: pypi-package-details
if: inputs.upload_to_pypi
uses: actions/github-script@v6
uses: actions/github-script@v7
env:
VERSION: ${{ inputs.version }}
with:
Expand Down Expand Up @@ -156,7 +159,7 @@ jobs:
- name: Attach artifacts to release
if: inputs.release-id
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GIT_PAT }}
script: |
Expand All @@ -176,7 +179,7 @@ jobs:
- name: Upload to artifact
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Dist
path: dist/
2 changes: 1 addition & 1 deletion .github/workflows/bump-helm-chart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
git config --global user.email '[email protected]'
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: "${{ github.repository_owner }}/${{ env.HELM_CHART_REPO_NAME }}"
token: ${{ secrets.GIT_PAT }}
Expand Down
Loading

0 comments on commit e016369

Please sign in to comment.