Skip to content

Commit

Permalink
CI Release notes testing
Browse files Browse the repository at this point in the history
  • Loading branch information
vzarytovskii committed Nov 16, 2023
1 parent 9078548 commit e67c60d
Show file tree
Hide file tree
Showing 10 changed files with 231 additions and 3 deletions.
219 changes: 219 additions & 0 deletions .github/workflows/check_release_notes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
name: Check release notes
on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- 'main'
- 'release/*'
jobs:
check_release_notes:
permissions:
issues: write
pull-requests: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
runs-on: ubuntu-latest
steps:
- name: Get github ref
uses: actions/github-script@v3
id: get-pr
with:
script: |
const result = await github.pulls.get({
pull_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
});
return { "pr_number": context.issue.number, "ref": result.data.head.ref, "repository": result.data.head.repo.full_name};
- name: Checkout repo
uses: actions/checkout@v2
with:
repository: ${{ fromJson(steps.get-pr.outputs.result).repository }}
ref: ${{ fromJson(steps.get-pr.outputs.result).ref }}
fetch-depth: 0
- name: Check for release notes changes
id: release_notes_changes
run: |
set -e
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
# Parse version from eng/Versions.props
# For FSarp.Core:
# <FSMajorVersion>8</FSMajorVersion>
# <FSMinorVersion>0</FSMinorVersion>
# <FSBuildVersion>100</FSBuildVersion>
# For FCS:
# FCSMajorVersion>43</FCSMajorVersion>
# <FCSMinorVersion>8</FCSMinorVersion>
# <FCSBuildVersion>$(FSBuildVersion)</FCSBuildVersion>
# For VS:
# <VSMajorVersion>17</VSMajorVersion>
# <VSMinorVersion>8</VSMinorVersion>
_fs_major_version=$(grep -oPm1 "(?<=<FSMajorVersion>)[^<]+" eng/Versions.props)
_fs_minor_version=$(grep -oPm1 "(?<=<FSMinorVersion>)[^<]+" eng/Versions.props)
_fs_build_version=$(grep -oPm1 "(?<=<FSBuildVersion>)[^<]+" eng/Versions.props)
_fcs_major_version=$(grep -oPm1 "(?<=<FCSMajorVersion>)[^<]+" eng/Versions.props)
_fcs_minor_version=$(grep -oPm1 "(?<=<FCSMinorVersion>)[^<]+" eng/Versions.props)
_fcs_build_version=$_fs_build_version
_vs_major_version=$(grep -oPm1 "(?<=<VSMajorVersion>)[^<]+" eng/Versions.props)
_vs_minor_version=$(grep -oPm1 "(?<=<VSMinorVersion>)[^<]+" eng/Versions.props)
FSHARP_CORE_VERSION="$_fs_major_version.$_fs_minor_version.$_fs_build_version"
FCS_VERSION="$_fcs_major_version.$_fcs_minor_version.$_fcs_build_version"
VISUAL_STUDIO_VERSION="$_vs_major_version.$_vs_minor_version"
echo "Found F# version: ${FSHARP_CORE_VERSION}"
echo "Found FCS version: ${FCS_VERSION}"
echo "Found Visual Studio version: ${VISUAL_STUDIO_VERSION}"
[[ "$FSHARP_CORE_VERSION" =~ ^[0-9]+\.[0-9]+.[0-9]+$ ]] || (echo "Invalid FSharp.Core Version parsed"; exit 1)
[[ "$FCS_VERSION" =~ ^[0-9]+\.[0-9]+.[0-9]+$ ]] || (echo "Invalid FCS Version parsed"; exit 1)
[[ "$VISUAL_STUDIO_VERSION" =~ ^[0-9]+\.[0-9]+$ ]] || (echo "Invalid Visual Studio Version parsed"; exit 1)
_release_notes_base_path='docs/release-notes'
_fsharp_core_release_notes_path="${_release_notes_base_path}/FSharp.Core/${FSHARP_CORE_VERSION}.md"
_fsharp_compiler_release_notes_path="${_release_notes_base_path}/FSharp.Compiler.Service/${FSHARP_CORE_VERSION}.md"
_fsharp_language_release_notes_path="${_release_notes_base_path}/Language/preview.md"
_fsharp_vs_release_notes_path="${_release_notes_base_path}/VisualStudio/${VISUAL_STUDIO_VERSION}.md"
readonly paths=(
"src/FSharp.Core|${_fsharp_core_release_notes_path}"
"src/Compiler|${_fsharp_compiler_release_notes_path}"
"src/Compiler/Facilities/LanguageFeatures.fsi|${_fsharp_language_release_notes_path}"
"vsintegration/src|${_fsharp_vs_release_notes_path}"
".github|NONEXISTING_NOTES_FOR_TESTING.md"
)
# Check all changed paths
RELEASE_NOTES_MESSAGE=""
RELEASE_NOTES_MESSAGE_DETAILS=""
RELEASE_NOTES_FOUND=""
RELEASE_NOTES_CHANGES_SUMMARY=""
RELEASE_NOTES_NOT_FOUND=""
_modified_paths=`gh pr view ${PR_NUMBER} --json files --jq '.files.[].path'`
for fields in ${paths[@]}
do
IFS=$'|' read -r path release_notes <<< "$fields"
echo "Checking for changed files in: $path"
# Check if path is in modified files:
if [[ "${_modified_paths[@]}" =~ "${path}" ]]; then
echo "Found $path in modified files"
echo "Checking if release notes modified in: $release_notes"
if [[ "${_modified_paths[@]}" =~ "${release_notes}" ]]; then
echo "Found $release_notes in modified files"
RELEASE_NOTES_FOUND+="> | \\\`$path\\\` | \\\`$release_notes\\\` |"
RELEASE_NOTES_FOUND+=$'\n'
else
echo "Did not find $release_notes in modified files"
DESCRIPTION="**No release notes found**"
RELEASE_NOTES_NOT_FOUND+="| \\\`$path\\\` | \\\`$release_notes\\\` | ${DESCRIPTION} |"
RELEASE_NOTES_NOT_FOUND+=$'\n'
fi
else
echo "Nothing found, no release notes required"
fi
done
if [[ $RELEASE_NOTES_NOT_FOUND != "" ]]; then
RELEASE_NOTES_MESSAGE_DETAILS+=$"> [!CAUTION]"
RELEASE_NOTES_MESSAGE_DETAILS+=$'\n'
RELEASE_NOTES_MESSAGE_DETAILS+=$"> **No release notes found for the following paths.**"
RELEASE_NOTES_MESSAGE_DETAILS+=$'\n'
RELEASE_NOTES_MESSAGE_DETAILS+=$">"
RELEASE_NOTES_MESSAGE_DETAILS+=$'\n'
RELEASE_NOTES_MESSAGE_DETAILS+=$"> Please make sure to add an entry with short succint description of the change as well as link to this pull request."
RELEASE_NOTES_MESSAGE_DETAILS+=$'\n'
RELEASE_NOTES_MESSAGE_DETAILS+=$">"
RELEASE_NOTES_MESSAGE_DETAILS+=$'\n'
RELEASE_NOTES_MESSAGE_DETAILS+=$"> Examples: "
RELEASE_NOTES_MESSAGE_DETAILS+=$'\n'
RELEASE_NOTES_MESSAGE_DETAILS+=$"> \\\`- Respect line limit in quick info popup - https://github.com/dotnet/fsharp/pull/16208\\\`"
RELEASE_NOTES_MESSAGE_DETAILS+=$'\n'
RELEASE_NOTES_MESSAGE_DETAILS+=$"> \\\`- More inlines for Result module - https://github.com/dotnet/fsharp/pull/16106\\\`"
RELEASE_NOTES_MESSAGE_DETAILS+=$'\n'
RELEASE_NOTES_MESSAGE_DETAILS+=$"> \\\`- Miscellaneous fixes to parens analysis - https://github.com/dotnet/fsharp/pull/16262\\\`"
RELEASE_NOTES_MESSAGE_DETAILS+=$'\n'
RELEASE_NOTES_MESSAGE_DETAILS+=$'\n'
RELEASE_NOTES_MESSAGE_DETAILS+='| Change path | Release notes path | Description |'
RELEASE_NOTES_MESSAGE_DETAILS+=$'\n'
RELEASE_NOTES_MESSAGE_DETAILS+='| ---------------- | ------------------ | ----------- |'
RELEASE_NOTES_MESSAGE_DETAILS+=$'\n'
RELEASE_NOTES_MESSAGE_DETAILS+="${RELEASE_NOTES_NOT_FOUND}"
RELEASE_NOTES_MESSAGE_DETAILS+=$'\n'
RELEASE_NOTES_MESSAGE_DETAILS+=$'\n'
RELEASE_NOTES_MESSAGE_DETAILS+=$'\n'
fi
if [[ $RELEASE_NOTES_FOUND != "" ]]; then
RELEASE_NOTES_MESSAGE_DETAILS+=$"<hr/>"
RELEASE_NOTES_MESSAGE_DETAILS+=$'\n'
RELEASE_NOTES_MESSAGE_DETAILS+=$'\n'
RELEASE_NOTES_MESSAGE_DETAILS+=$"> :white_check_mark: Found changes and release notes in following paths:"
RELEASE_NOTES_MESSAGE_DETAILS+=$'\n'
RELEASE_NOTES_MESSAGE_DETAILS+='> | Change path | Release notes path |'
RELEASE_NOTES_MESSAGE_DETAILS+=$'\n'
RELEASE_NOTES_MESSAGE_DETAILS+='> | ---------------- | ------------------ |'
RELEASE_NOTES_MESSAGE_DETAILS+=$'\n'
RELEASE_NOTES_MESSAGE_DETAILS+="${RELEASE_NOTES_FOUND}"
RELEASE_NOTES_MESSAGE_DETAILS+=$'\n'
fi
RELEASE_NOTES_MESSAGE+=$'<!-- DO_NOT_REMOVE: release_notes_check -->\n'
RELEASE_NOTES_MESSAGE+=$'## Release notes check\n\n'
if [[ $RELEASE_NOTES_MESSAGE_DETAILS == "" ]]; then
RELEASE_NOTES_MESSAGE+=$'### :white_check_mark: No release notes required.'
else
RELEASE_NOTES_MESSAGE+=$'### Release notes required.\n\n'
RELEASE_NOTES_MESSAGE+=$RELEASE_NOTES_MESSAGE_DETAILS
fi
echo "release-notes-check-message<<$EOF" >>$GITHUB_OUTPUT
echo "${RELEASE_NOTES_MESSAGE}" >>$GITHUB_OUTPUT
echo "$EOF" >>$GITHUB_OUTPUT
if [[ $RELEASE_NOTES_NOT_FOUND != "" ]]; then
exit 1
fi
# Did bot already commented the PR?
- name: Find Comment
if: success() || failure()
uses: peter-evans/find-comment@v2.4.0
id: fc
with:
issue-number: ${{github.event.pull_request.number}}
comment-author: 'github-actions[bot]'
body-includes: '<!-- DO_NOT_REMOVE: release_notes_check -->'
# If not, create a new comment
- name: Create comment
if: steps.fc.outputs.comment-id == '' && (success() || failure())
uses: actions/github-script@v6
with:
github-token: ${{ github.token }}
script: |
const comment = await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `${{steps.release_notes_changes.outputs.release-notes-check-message}}`
});
return comment.data.id;
# If yes, update the comment
- name: Update comment
if: steps.fc.outputs.comment-id != '' && (success() || failure())
uses: actions/github-script@v6
with:
github-token: ${{ github.token }}
script: |
const comment = await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: ${{steps.fc.outputs.comment-id}},
body: `${{steps.release_notes_changes.outputs.release-notes-check-message}}`
});
return comment.data.id;
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ stages:
# We will try to restore both FSharp.Core and FCS and if restore is _successful_, package version needs to be bumped.
# NOTE: This CI check should only run on the release branches.
- job: Check_Published_Package_Versions
condition: or(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), or(startsWith(variables['System.PullRequest.SourceBranch'], 'release/dev'), startsWith(variables['System.PullRequest.TargetBranch'], 'release/dev')))
# condition: or(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), or(startsWith(variables['System.PullRequest.SourceBranch'], 'release/dev'), startsWith(variables['System.PullRequest.TargetBranch'], 'release/dev')))
pool:
vmImage: $(UbuntuMachineQueueName)
strategy:
Expand Down
1 change: 1 addition & 0 deletions docs/release-notes/FSharp.Compiler.Service/8.0.200.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Miscellaneous fixes to parens analysis - https://github.com/dotnet/fsharp/pull/16262
1 change: 1 addition & 0 deletions docs/release-notes/FSharp.Core/8.0.200.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- More inlines for Result module - https://github.com/dotnet/fsharp/pull/16106
1 change: 1 addition & 0 deletions docs/release-notes/Language/preview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Feature: Better unmanaged structs handling - https://github.com/dotnet/fsharp/pull/12154
1 change: 1 addition & 0 deletions docs/release-notes/VisualStudio/17.9.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Respect line limit in quick info popup - https://github.com/dotnet/fsharp/pull/16208
6 changes: 4 additions & 2 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
<!-- Version number computation -->
<PropertyGroup>
<PreReleaseVersionLabel>beta</PreReleaseVersionLabel>
<!-- These have to be in sync with latest release branch -->
<!-- F# Version components -->
<FSMajorVersion>8</FSMajorVersion>
<FSMinorVersion>0</FSMinorVersion>
<FSBuildVersion>100</FSBuildVersion>
<FSBuildVersion>200</FSBuildVersion>
<FSRevisionVersion>0</FSRevisionVersion>
<!-- -->
<!-- F# Language version -->
Expand Down Expand Up @@ -55,8 +56,9 @@
<FSProductVersion>$(FSToolsMajorVersion).$(FSToolsMinorVersion).$(FSToolsBuildVersion).$(FSToolsRevisionVersion)</FSProductVersion>
</PropertyGroup>
<PropertyGroup>
<!-- These have to be in sync with latest release branch -->
<VSMajorVersion>17</VSMajorVersion>
<VSMinorVersion>8</VSMinorVersion>
<VSMinorVersion>9</VSMinorVersion>
<VSGeneralVersion>$(VSMajorVersion).0</VSGeneralVersion>
<VSAssemblyVersionPrefix>$(VSMajorVersion).$(VSMinorVersion).0</VSAssemblyVersionPrefix>
<VSAssemblyVersion>$(VSAssemblyVersionPrefix).0</VSAssemblyVersion>
Expand Down
1 change: 1 addition & 0 deletions src/Compiler/Facilities/LanguageFeatures.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,4 @@ type LanguageVersion =
static member GetFeatureVersionString: feature: LanguageFeature -> string

static member Default: LanguageVersion

1 change: 1 addition & 0 deletions src/FSharp.Core/prim-types-prelude.fs
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,4 @@ namespace Microsoft.FSharp.Core
type voidptr = (# "void*" #)

type ilsigptr<'T> = (# "!0*" #)

1 change: 1 addition & 0 deletions vsintegration/src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
</PropertyGroup>

</Project>

0 comments on commit e67c60d

Please sign in to comment.