From 57067ffb06352fc7fce5d5a17ffe92741b5ef85c Mon Sep 17 00:00:00 2001 From: dark64 Date: Mon, 22 Mar 2021 15:10:39 +0100 Subject: [PATCH 1/5] add changelog scripts, add github action for checking changelogs --- .github/workflows/pr-changelog-check.yml | 12 +++++++ CHANGELOG | 20 +++++++++++ changelogs/unreleased/.gitkeep | 0 scripts/changelog-check.sh | 18 ++++++++++ scripts/changelog.sh | 44 ++++++++++++++++++++++++ 5 files changed, 94 insertions(+) create mode 100644 .github/workflows/pr-changelog-check.yml create mode 100644 CHANGELOG create mode 100644 changelogs/unreleased/.gitkeep create mode 100755 scripts/changelog-check.sh create mode 100755 scripts/changelog.sh diff --git a/.github/workflows/pr-changelog-check.yml b/.github/workflows/pr-changelog-check.yml new file mode 100644 index 00000000..c1d5b5d9 --- /dev/null +++ b/.github/workflows/pr-changelog-check.yml @@ -0,0 +1,12 @@ +name: Pull request changelog check +on: [pull_request] +jobs: + build: + name: Run changelog check + runs-on: ubuntu-latest + steps: + - name: Check out the code + uses: actions/checkout@v2 + - name: Changelog check + if: ${{ !(contains(github.event.pull_request.labels.*.name, 'changelog-not-required'))}} + run: ./scripts/changelog-check.sh \ No newline at end of file diff --git a/CHANGELOG b/CHANGELOG new file mode 100644 index 00000000..54c96d48 --- /dev/null +++ b/CHANGELOG @@ -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/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..c4bb4528 --- /dev/null +++ b/scripts/changelog-check.sh @@ -0,0 +1,18 @@ +#!/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 \ No newline at end of file diff --git a/scripts/changelog.sh b/scripts/changelog.sh new file mode 100755 index 00000000..a90a9ccf --- /dev/null +++ b/scripts/changelog.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +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 From 56583f9b354a898727eebc8501d859983bf6406b Mon Sep 17 00:00:00 2001 From: dark64 Date: Mon, 22 Mar 2021 15:21:32 +0100 Subject: [PATCH 2/5] update actions ci config --- .github/workflows/pr-changelog-check.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-changelog-check.yml b/.github/workflows/pr-changelog-check.yml index c1d5b5d9..261471cc 100644 --- a/.github/workflows/pr-changelog-check.yml +++ b/.github/workflows/pr-changelog-check.yml @@ -1,12 +1,14 @@ name: Pull request changelog check -on: [pull_request] +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 - if: ${{ !(contains(github.event.pull_request.labels.*.name, 'changelog-not-required'))}} run: ./scripts/changelog-check.sh \ No newline at end of file From 4f96dc78959b015b6e23d8484c6ea498038bf20c Mon Sep 17 00:00:00 2001 From: dark64 Date: Mon, 22 Mar 2021 19:56:08 +0100 Subject: [PATCH 3/5] add md extension, add readme for changelogs --- CHANGELOG => CHANGELOG.md | 0 changelogs/README.md | 14 ++++++++++++++ 2 files changed, 14 insertions(+) rename CHANGELOG => CHANGELOG.md (100%) create mode 100644 changelogs/README.md diff --git a/CHANGELOG b/CHANGELOG.md similarity index 100% rename from CHANGELOG rename to CHANGELOG.md diff --git a/changelogs/README.md b/changelogs/README.md new file mode 100644 index 00000000..3a3dbac8 --- /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) +``` + +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. \ No newline at end of file From 42617eca76274115c901bc10339820a9fc19d7cb Mon Sep 17 00:00:00 2001 From: Darko Macesic Date: Fri, 26 Mar 2021 11:56:07 +0100 Subject: [PATCH 4/5] Update README.md --- changelogs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelogs/README.md b/changelogs/README.md index 3a3dbac8..616fb49b 100644 --- a/changelogs/README.md +++ b/changelogs/README.md @@ -11,4 +11,4 @@ changelogs/unreleased # folder to place changelogs 101-username # your changelog file (pull request #101 by @username) ``` -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. \ No newline at end of file +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. From 9feb905cb34ad7901df394f0b6988eda2fb04be2 Mon Sep 17 00:00:00 2001 From: dark64 Date: Mon, 29 Mar 2021 16:00:35 +0200 Subject: [PATCH 5/5] add notes to changelog.sh, modify changelog-check.sh to check for main changelog file modifications --- scripts/changelog-check.sh | 6 ++++++ scripts/changelog.sh | 3 +++ 2 files changed, 9 insertions(+) diff --git a/scripts/changelog-check.sh b/scripts/changelog-check.sh index c4bb4528..24d1e68f 100755 --- a/scripts/changelog-check.sh +++ b/scripts/changelog-check.sh @@ -15,4 +15,10 @@ 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 index a90a9ccf..b8d87773 100755 --- a/scripts/changelog.sh +++ b/scripts/changelog.sh @@ -1,5 +1,8 @@ #!/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