diff --git a/.github/workflows/pr-changelog-check.yml b/.github/workflows/pr-changelog-check.yml new file mode 100644 index 00000000..261471cc --- /dev/null +++ b/.github/workflows/pr-changelog-check.yml @@ -0,0 +1,14 @@ +name: Pull request changelog check +on: + pull_request: + types: [opened, labeled, unlabeled, synchronize] +jobs: + build: + if: ${{ !(contains(github.event.pull_request.labels.*.name, 'changelog-not-required')) }} + name: Run changelog check + runs-on: ubuntu-latest + steps: + - name: Check out the code + uses: actions/checkout@v2 + - name: Changelog check + run: ./scripts/changelog-check.sh \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..54c96d48 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,20 @@ +# Changelog +All notable changes to this project will be documented in this file. + +## [Unreleased] +https://github.com/Zokrates/ZoKrates/compare/master...develop + +## [0.6.4] - 2021-03-19 +### Release +- https://github.com/Zokrates/ZoKrates/releases/tag/0.6.4 + +### Changes +- re-include embeds for a slightly cheaper sha256 +- remove array ssa +- add flag to allow unconstrained variables +- better flattening of conjunctions +- put backends behind features +- accept any assignee in multidef +- minor performance and stability improvements + +For older releases and changes, visit https://github.com/Zokrates/ZoKrates/releases. \ No newline at end of file diff --git a/changelogs/README.md b/changelogs/README.md new file mode 100644 index 00000000..616fb49b --- /dev/null +++ b/changelogs/README.md @@ -0,0 +1,14 @@ +## Adding a changelog + +Pull request authors are expected to include a changelog file explaining the changes introduced by the pull request. +The changelog file should be a new file created in the `changelogs/unreleased` folder. +The file should follow the naming convention of `pr-username` and the contents of the file +should be your text for the changelog. + +### Example +``` +changelogs/unreleased # folder to place changelogs + 101-username # your changelog file (pull request #101 by @username) +``` + +Any user-facing change must have a changelog entry. If a pull request does not warrant a changelog, the CI check for a changelog can be skipped by applying a `changelog-not-required` label. diff --git a/changelogs/unreleased/.gitkeep b/changelogs/unreleased/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/scripts/changelog-check.sh b/scripts/changelog-check.sh new file mode 100755 index 00000000..24d1e68f --- /dev/null +++ b/scripts/changelog-check.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +set +x + +if [ -z "$CI" ]; then + echo "This script is intended to be run only on Github Actions." >&2 + exit 1 +fi + +CHANGELOG_PATH='changelogs/unreleased' + +pr_number=$(echo $GITHUB_REF | cut -d / -f 3) +changelog="${CHANGELOG_PATH}/${pr_number}-*" + +if [ ! -f "$changelog" ]; then + echo "Pull request #${pr_number:-?} is missing a changelog. Please add a changelog to ${CHANGELOG_PATH}." + exit 1 +fi + +cl_diff=$(git diff --exit-code $GITHUB_HEAD_REF CHANGELOG.md) +if [ -n "$cl_diff" ]; then + echo "Pull requests should not directly modify the main CHANGELOG.md file. For more information, please read changelogs/README.md" + exit 1 +fi \ No newline at end of file diff --git a/scripts/changelog.sh b/scripts/changelog.sh new file mode 100755 index 00000000..b8d87773 --- /dev/null +++ b/scripts/changelog.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +# This script is intended for maintainers only to generate changelog markdown before new releases. +# The generated markdown can be added to the main CHANGELOG.md file located at the root of the repository. + +set -e + +if [ -z "$1" ]; then + echo "Usage: $0 TAG" >&2 + exit 1 +fi + +function join { local IFS="$1"; shift; echo "$*"; } +function qdate +{ + if type -p gdate > /dev/null; then + gdate "$@"; + else + date "$@"; + fi +} + +CHANGELOG_PATH='changelogs/unreleased' + +tag=$1 +unreleased=$(ls -t ${CHANGELOG_PATH}) + +echo -e "Generating CHANGELOG markdown from ${CHANGELOG_PATH}\n" +cat << EOT +## [${tag}] - $(qdate '+%Y-%m-%d') + +### Release +- https://github.com/Zokrates/ZoKrates/releases/tag/${tag} + +### Changes +EOT + +for file in $unreleased +do + IFS=$'-' read -ra entry <<< "$file" + contents=$(cat ${CHANGELOG_PATH}/${file} | tr '\n' ' ') + author=$(join '-' ${entry[@]:1}) + echo "- ${contents} (#${entry[0]}, @${author})" +done + +echo -e "\nCopy and paste the markdown above to the appropriate CHANGELOG file." +echo "Be sure to run: git rm ${CHANGELOG_PATH}/*" \ No newline at end of file