Skip to content

Commit

Permalink
Merge pull request #8 from SpecLad/release-2.7.99
Browse files Browse the repository at this point in the history
Release v2.7.99
  • Loading branch information
cvat-bot[bot] authored Oct 12, 2023
2 parents 7956a18 + e087ef2 commit 4fe358f
Show file tree
Hide file tree
Showing 20 changed files with 264 additions and 21 deletions.
109 changes: 109 additions & 0 deletions .github/workflows/finalize-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Finalize release
on:
workflow_dispatch:
jobs:
main:
runs-on: ubuntu-latest
steps:
- name: Discover pending release
id: discover
env:
GH_TOKEN: "${{ github.token }}"
run: |
gh --repo="${{ github.repository }}" \
pr list --base master --state open --json number,headRefName \
--jq 'map(select(.headRefName | startswith("release-")))' \
> /tmp/release-prs.json
if jq -e 'length < 1' /tmp/release-prs.json > /dev/null; then
echo "No open release pull requests found."
exit 1
elif jq -e 'length > 1' /tmp/release-prs.json > /dev/null; then
echo "Multiple open release pull requests found:"
jq -r '.[] | "https://github.com/${{ github.repository }}/pull/\(.number)"' /tmp/release-prs.json
exit 1
fi
jq -r '.[] | "prNumber=\(.number)", "version=\(.headRefName | ltrimstr("release-"))"' \
/tmp/release-prs.json >> "$GITHUB_OUTPUT"
# When you use the default github.token to make changes in the repository,
# it does not trigger further GitHub pipelines. We want to trigger CI for
# the pull request and artifact building for the release, so we have to use
# an app token.
- name: Generate authentication token
id: gen-token
uses: actions/create-github-app-token@v1
with:
app-id: "${{ secrets.CVAT_BOT_APP_ID }}"
private-key: "${{ secrets.CVAT_BOT_PRIVATE_KEY }}"

- name: Install dependencies
run:
sudo apt-get install -y pandoc

- uses: actions/checkout@v4
with:
ref: "release-${{ steps.discover.outputs.version }}"

- name: Verify that the release is new
env:
NEW_VERSION: "${{ steps.discover.outputs.version }}"
run: |
if git ls-remote --exit-code origin "refs/tags/v$NEW_VERSION" > /dev/null; then
echo "Release v$NEW_VERSION already exists"
exit 1
fi
# Do post-release tasks before publishing the release. If anything goes wrong,
# the dev-release-* branch can be deleted, and the whole process restarted again;
# whereas we can't unmerge the release PR.

- name: Create post-release branch
run:
git checkout -b "dev-release-${{ steps.discover.outputs.version }}"

- name: Bump version
run:
./dev/update_version.py --minor

- name: Commit post-release changes
run: |
git -c user.name='cvat-bot[bot]' -c user.email='cvat-bot[bot]@users.noreply.github.com' \
commit -a -m "Update ${{ github.ref_name }} after v${{ steps.discover.outputs.version }}"
- name: Push post-release branch
run:
git push -u origin "dev-release-${{ steps.discover.outputs.version }}"

- name: Create post-release pull request
env:
GH_TOKEN: "${{ steps.gen-token.outputs.token }}"
run: |
gh pr create \
--base="${{ github.ref_name }}" \
--title="Update ${{ github.ref_name }} after v${{ steps.discover.outputs.version }}" \
--body=""
# Now publish the release.

- name: Merge release pull request
env:
GH_TOKEN: "${{ steps.gen-token.outputs.token }}"
run:
gh pr merge --merge "${{ steps.discover.outputs.prNumber }}" --delete-branch

- name: Create release
env:
GH_TOKEN: "${{ steps.gen-token.outputs.token }}"
NEW_VERSION: "${{ steps.discover.outputs.version }}"
run: |
# We could grab the release notes from the PR description, but it could
# be outdated if any changes were made on the release branch. So instead,
# just re-extract them from the changelog again.
./dev/gh_release_notes.sh \
| gh release create "v$NEW_VERSION" \
--target=master \
--title="v$NEW_VERSION" \
--notes-file=-
74 changes: 74 additions & 0 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Prepare release
on:
workflow_dispatch:
inputs:
newVersion:
description: "Version number for the new release"
required: true
default: X.Y.Z
jobs:
main:
runs-on: ubuntu-latest
steps:
- name: Validate version number
env:
NEW_VERSION: "${{ inputs.newVersion }}"
run: |
if ! [[ "$NEW_VERSION" =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then
echo "Invalid version number"
exit 1
fi
# When you use the default github.token to make changes in the repository,
# it does not trigger further GitHub pipelines. We want to trigger CI for
# the pull request, so we have to use an app token.
- name: Generate authentication token
id: gen-token
uses: actions/create-github-app-token@v1
with:
app-id: "${{ secrets.CVAT_BOT_APP_ID }}"
private-key: "${{ secrets.CVAT_BOT_PRIVATE_KEY }}"

- name: Install dependencies
run:
sudo apt-get install -y pandoc

- uses: actions/checkout@v4

- name: Verify that the release is new
run: |
if git ls-remote --exit-code origin refs/tags/v${{ inputs.newVersion }} > /dev/null; then
echo "Release v${{ inputs.newVersion }} already exists"
exit 1
fi
- name: Create release branch
run:
git checkout -b "release-${{ inputs.newVersion }}"

- name: Collect changelog
run:
pipx run scriv collect --version="${{ inputs.newVersion }}"

- name: Set the new version
run:
./dev/update_version.py --set="${{ inputs.newVersion }}"

- name: Commit release preparation changes
run: |
git -c user.name='cvat-bot[bot]' -c user.email='cvat-bot[bot]@users.noreply.github.com' \
commit -a -m "Prepare release v${{ inputs.newVersion }}"
- name: Push release branch
run:
git push -u origin "release-${{ inputs.newVersion }}"

- name: Create release pull request
env:
GH_TOKEN: "${{ steps.gen-token.outputs.token }}"
run: |
./dev/gh_release_notes.sh \
| gh pr create \
--base=master \
--title="Release v${{ inputs.newVersion }}" \
--body-file=-
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

<!-- scriv-insert-here -->

<a id='changelog-2.7.99'></a>
## \[2.7.99\] - 2023-10-12

### Fixed

- Persist image filters across jobs
(<https://github.com/opencv/cvat/pull/6953>)

### Security

- Security upgrade opencv-python-headless from 4.5.5.62 to 4.8.1.78
(<https://github.com/opencv/cvat/pull/6931>)

<a id='changelog-2.7.5'></a>
## \[2.7.5\] - 2023-10-09

Expand Down
2 changes: 1 addition & 1 deletion cvat-cli/requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
cvat-sdk~=2.7.5
cvat-sdk~=2.7.99
Pillow>=10.0.1
setuptools>=65.5.1 # not directly required, pinned by Snyk to avoid a vulnerability
2 changes: 1 addition & 1 deletion cvat-cli/src/cvat_cli/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = "2.7.5"
VERSION = "2.7.99"
2 changes: 1 addition & 1 deletion cvat-sdk/gen/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set -e

GENERATOR_VERSION="v6.0.1"

VERSION="2.7.5"
VERSION="2.7.99"
LIB_NAME="cvat_sdk"
LAYER1_LIB_NAME="${LIB_NAME}/api_client"
DST_DIR="$(cd "$(dirname -- "$0")/.." && pwd)"
Expand Down
2 changes: 1 addition & 1 deletion cvat-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cvat-ui",
"version": "1.57.2",
"version": "1.57.3",
"description": "CVAT single-page application",
"main": "src/index.tsx",
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ export default function GammaFilter(): JSX.Element {
useEffect(() => {
if (filters.length === 0) {
setGamma(1);
} else if (gammaFilter) {
setGamma((gammaFilter.modifier as GammaCorrection).gamma);
}
}, [filters]);

Expand Down
6 changes: 5 additions & 1 deletion cvat-ui/src/reducers/settings-reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,10 @@ export default (state = defaultState, action: AnyAction): SettingsState => {
case BoundariesActionTypes.RESET_AFTER_ERROR:
case AnnotationActionTypes.GET_JOB_SUCCESS: {
const { job } = action.payload;
const filters = [...state.imageFilters];
filters.forEach((imageFilter) => {
imageFilter.modifier.currentProcessedImage = null;
});

return {
...state,
Expand All @@ -477,7 +481,7 @@ export default (state = defaultState, action: AnyAction): SettingsState => {
} :
{}),
},
imageFilters: [],
imageFilters: filters,
};
}
case AnnotationActionTypes.INTERACT_WITH_CANVAS: {
Expand Down
14 changes: 14 additions & 0 deletions cvat-ui/src/utils/fabric-wrapper/gamma-correciton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export interface GammaFilterOptions {
}

export default class GammaCorrection extends FabricFilter {
#gamma: number[];

constructor(options: GammaFilterOptions) {
super();

Expand All @@ -22,5 +24,17 @@ export default class GammaCorrection extends FabricFilter {
this.filter = new fabric.Image.filters.Gamma({
gamma,
});
this.#gamma = gamma;
}

public configure(options: object): void {
super.configure(options);

const { gamma: newGamma } = options as GammaFilterOptions;
this.#gamma = newGamma;
}

get gamma(): number {
return this.#gamma[0];
}
}
2 changes: 1 addition & 1 deletion cvat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

from cvat.utils.version import get_version

VERSION = (2, 7, 5, 'final', 0)
VERSION = (2, 7, 99, 'final', 0)

__version__ = get_version(VERSION)
2 changes: 1 addition & 1 deletion cvat/requirements/base.in
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ furl==2.1.0
google-cloud-storage==1.42.0
natsort==8.0.0
numpy~=1.22.2
opencv-python-headless==4.5.5.62
opencv-python-headless~=4.8

# The package is used by pyunpack as a command line tool to support multiple
# archives. Don't use as a python module because it has GPL license.
Expand Down
2 changes: 1 addition & 1 deletion cvat/requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SHA1:efa1135fd6eb8ff1c784d632ee43797415192c71
# SHA1:21132d38b706741ba8b04ac1eb24b9136208dd3d
#
# This file is autogenerated by pip-compile-multi
# To update, run:
Expand Down
2 changes: 1 addition & 1 deletion cvat/schema.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
openapi: 3.0.3
info:
title: CVAT REST API
version: 2.7.5
version: 2.7.99
description: REST API for Computer Vision Annotation Tool (CVAT)
termsOfService: https://www.google.com/policies/terms/
contact:
Expand Down
14 changes: 14 additions & 0 deletions dev/gh_release_notes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

# This script takes the release notes for the most recent release
# and reformats them for use in GitHub.

# In GitHub PR and release descriptions, a single line break is
# equivalent to <br>, so we pipe the text through pandoc to unwrap all lines.

set -eu

repo_root="$(dirname "$0")/.."

awk '/^## / { hn += 1; next } hn == 1 && !/^</' "$repo_root/CHANGELOG.md" \
| pandoc -f gfm -t gfm --wrap=none
11 changes: 11 additions & 0 deletions dev/update_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ def increment_major(self) -> None:
self.major += 1
self._set_default_minor()

def set(self, v: str) -> None:
self.major, self.minor, self.patch = map(int, v.split('.'))
self.prerelease = 'final'
self.prerelease_number = 0

def _set_default_prerelease_number(self) -> None:
self.prerelease_number = 0

Expand Down Expand Up @@ -177,6 +182,9 @@ def main() -> None:
action_group.add_argument('--verify-current',
action='store_true', help='Check that all version numbers are consistent')

action_group.add_argument('--set', metavar='X.Y.Z',
help='Set the version to the specified version')

args = parser.parse_args()

version = get_current_version()
Expand Down Expand Up @@ -207,6 +215,9 @@ def main() -> None:
elif args.major:
version.increment_major()

elif args.set is not None:
version.set(args.set)

else:
assert False, "Unreachable code"

Expand Down
Loading

0 comments on commit 4fe358f

Please sign in to comment.