Skip to content

Commit

Permalink
Merge branch 'main' into rasmuswl/no-dep-inst-default
Browse files Browse the repository at this point in the history
  • Loading branch information
Rasmus Wriedt Larsen committed Jan 4, 2024
2 parents dd20793 + 216127f commit ce9d281
Show file tree
Hide file tree
Showing 282 changed files with 6,790 additions and 1,562 deletions.
11 changes: 9 additions & 2 deletions .github/actions/release-branches/release-branches.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
import argparse
import json
import os
import subprocess
import configparser

# Name of the remote
ORIGIN = 'origin'

OLDEST_SUPPORTED_MAJOR_VERSION = 2
script_dir = os.path.dirname(os.path.realpath(__file__))
grandparent_dir = os.path.dirname(os.path.dirname(script_dir))

config = configparser.ConfigParser()
with open(os.path.join(grandparent_dir, 'releases.ini')) as stream:
config.read_string('[default]\n' + stream.read())

OLDEST_SUPPORTED_MAJOR_VERSION = int(config['default']['OLDEST_SUPPORTED_MAJOR_VERSION'])

def main():

Expand Down
2 changes: 1 addition & 1 deletion .github/actions/release-initialise/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ runs:
shell: bash

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

Expand Down
1 change: 1 addition & 0 deletions .github/releases.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
OLDEST_SUPPORTED_MAJOR_VERSION=2
63 changes: 56 additions & 7 deletions .github/update-release-branch.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import argparse
import datetime
import re
from github import Github
import json
import os
Expand Down Expand Up @@ -174,6 +175,60 @@ def get_today_string():
today = datetime.datetime.today()
return '{:%d %b %Y}'.format(today)

def process_changelog_for_backports(source_branch_major_version, target_branch_major_version):

# changelog entries can use the following format to indicate
# that they only apply to newer versions
some_versions_only_regex = re.compile(r'\[v(\d+)\+ only\]')

output = ''

with open('CHANGELOG.md', 'r') as f:

# until we find the first section, just duplicate all lines
while True:
line = f.readline()
if not line:
raise Exception('Could not find any change sections in CHANGELOG.md') # EOF

output += line
if line.startswith('## '):
line = line.replace(f'## {source_branch_major_version}', f'## {target_branch_major_version}')
# we have found the first section, so now handle things differently
break

# found_content tracks whether we hit two headings in a row
found_content = False
output += '\n'
while True:
line = f.readline()
if not line:
break # EOF
line = line.rstrip('\n')

# filter out changenote entries that apply only to newer versions
match = some_versions_only_regex.search(line)
if match:
if int(target_branch_major_version) < int(match.group(1)):
continue

if line.startswith('## '):
line = line.replace(f'## {source_branch_major_version}', f'## {target_branch_major_version}')
if found_content == False:
# we have found two headings in a row, so we need to add the placeholder message.
output += 'No user facing changes.\n'
found_content = False
output += f'\n{line}\n\n'
else:
if line.strip() != '':
found_content = True
# we use the original line here, rather than the stripped version
# so that we preserve indentation
output += line + '\n'

with open('CHANGELOG.md', 'w') as f:
f.write(output)

def update_changelog(version):
if (os.path.exists('CHANGELOG.md')):
content = ''
Expand Down Expand Up @@ -324,13 +379,7 @@ def main():

# Migrate the changelog notes from vLatest version numbers to vOlder version numbers
print(f'Migrating changelog notes from v{source_branch_major_version} to v{target_branch_major_version}')
subprocess.check_output(['sed', '-i', f's/^## {source_branch_major_version}\./## {target_branch_major_version}./g', 'CHANGELOG.md'])

# Remove changelog notes from all versions that do not apply to the vOlder branch
print(f'Removing changelog notes that do not apply to v{target_branch_major_version}')
for v in range(int(source_branch_major_version), int(target_branch_major_version), -1):
print(f'Removing changelog notes that are tagged [v{v}+ only\]')
subprocess.check_output(['sed', '-i', f'/^- \[v{v}+ only\]/d', 'CHANGELOG.md'])
process_changelog_for_backports(source_branch_major_version, target_branch_major_version)

# Amend the commit generated by `npm version` to update the CHANGELOG
run_git('add', 'CHANGELOG.md')
Expand Down
10 changes: 2 additions & 8 deletions .github/workflows/__all-platform-bundle.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 2 additions & 8 deletions .github/workflows/__analyze-ref-input.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 2 additions & 8 deletions .github/workflows/__autobuild-action.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 2 additions & 8 deletions .github/workflows/__config-export.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 2 additions & 8 deletions .github/workflows/__cpp-deptrace-disabled.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 2 additions & 8 deletions .github/workflows/__cpp-deptrace-enabled-on-macos.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 2 additions & 8 deletions .github/workflows/__cpp-deptrace-enabled.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 2 additions & 8 deletions .github/workflows/__diagnostics-export.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 2 additions & 8 deletions .github/workflows/__export-file-baseline-information.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 2 additions & 8 deletions .github/workflows/__extractor-ram-threads.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ce9d281

Please sign in to comment.