-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
56 changed files
with
2,549 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# .git-blame-ignore-revs | ||
# Formatting fixes for transaction/ and abi/ | ||
09351b56fff3459b5d4701ae681ec45b4b62d945 | ||
# Formatting fixes in test/ | ||
23c3faf0701b0d5c07c57dd7fca4ed77449f3209 | ||
# Formatting fixes in logic/ and crypto/ | ||
ebccd4939d84d3233e6fbb5fddb2332549a0f323 | ||
# Formatting fixes in types/ | ||
f99ffb34b9955fdaa366326fe97da49e761e9367 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,224 @@ | ||
name: Create Release PR | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
release_version: | ||
description: 'The release_version used for the release branch name, e.g. release/vx.x.x' | ||
default: 'vx.x.x' | ||
required: true | ||
type: string | ||
pre_release_version: | ||
description: "Pre-Release version, e.g. 'beta.1', will be added behind the release_version as the tag." | ||
required: false | ||
type: string | ||
|
||
env: | ||
RELEASE_VERSION: ${{ inputs.release_version }} | ||
PRE_RELEASE_VERSION: ${{ inputs.pre_release_version }} | ||
RELEASE_BRANCH: release/${{ inputs.release_version }} | ||
|
||
jobs: | ||
create-release-pr: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Set Release Version and Branch to Check Out | ||
id: set-release | ||
run: | | ||
if [[ $RELEASE_VERSION =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | ||
if [[ $PRE_RELEASE_VERSION =~ ^[a-z.0-9]+$ ]]; then | ||
echo "release-tag: $RELEASE_VERSION-$PRE_RELEASE_VERSION" | ||
echo "release-tag=$RELEASE_VERSION-$PRE_RELEASE_VERSION" >> $GITHUB_OUTPUT | ||
elif [[ -n $PRE_RELEASE_VERSION ]]; then | ||
echo "Input pre_release_version is not empty, but does not match the regex pattern ^[a-z.0-9]+$" | ||
exit 1 | ||
else | ||
echo "release-tag: $RELEASE_VERSION" | ||
echo "release-tag=$RELEASE_VERSION" >> $GITHUB_OUTPUT | ||
fi | ||
else | ||
echo "Version input doesn't match the regex pattern ^v[0-9]+\.[0-9]+\.[0-9]+$" | ||
exit 1 | ||
fi | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Create Release Branch if it does not exist | ||
run: | | ||
if ! git show-ref --verify --quiet "refs/remotes/origin/$RELEASE_BRANCH"; then | ||
git checkout -b $RELEASE_BRANCH | ||
git push --set-upstream origin $RELEASE_BRANCH | ||
elif [[ $(git rev-parse --abbrev-ref HEAD) != "$RELEASE_BRANCH" ]]; then | ||
echo "Current Branch: $(git rev-parse --abbrev-ref HEAD)" | ||
echo "Release branch exists, make sure you're using the workflow from the release branch or delete the existing release branch." | ||
exit 1 | ||
else | ||
echo "Release branch exists and used as workflow ref." | ||
fi | ||
- name: Get Latest Release | ||
id: get-release | ||
run: | | ||
if [[ -n $PRE_RELEASE_VERSION ]]; then | ||
echo "Get the latest release" | ||
tag=$(curl -L \ | ||
--header "Accept: application/vnd.github.v3+json" \ | ||
"https://api.github.com/repos/${{ github.repository }}/releases" | jq -r '.[0].tag_name') | ||
echo "latest-tag=$tag" >> $GITHUB_OUTPUT | ||
else | ||
echo "Get the latest stable release" | ||
tag=$(curl -L \ | ||
--header "Accept: application/vnd.github.v3+json" \ | ||
"https://api.github.com/repos/${{ github.repository }}/releases/latest" | jq -r '.tag_name') | ||
echo "latest-tag=$tag" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Build Changelog | ||
uses: mikepenz/release-changelog-builder-action@v3.7.2 | ||
id: build-changelog | ||
env: | ||
PREVIOUS_VERSION: ${{ steps.get-release.outputs.latest-tag }} | ||
with: | ||
fromTag: ${{ env.PREVIOUS_VERSION }} | ||
toTag: ${{ env.RELEASE_BRANCH }} | ||
failOnError: true | ||
configurationJson: | | ||
{ | ||
"categories": [ | ||
{ | ||
"title": "## New Features", | ||
"labels": [ | ||
"New Feature" | ||
] | ||
}, | ||
{ | ||
"title": "## Enhancements", | ||
"labels": [ | ||
"Enhancement" | ||
] | ||
}, | ||
{ | ||
"title": "## Bug Fixes", | ||
"labels": [ | ||
"Bug-Fix" | ||
] | ||
}, | ||
{ | ||
"title": "## Not Yet Enabled", | ||
"labels": [ | ||
"Not-Yet-Enabled" | ||
] | ||
} | ||
], | ||
"ignore_labels": [ | ||
"Skip-Release-Notes" | ||
], | ||
"sort": { | ||
"order": "ASC", | ||
"on_property": "mergedAt" | ||
}, | ||
"template": "#{{CHANGELOG}}", | ||
"pr_template": "- #{{TITLE}} by @#{{AUTHOR}} in ##{{NUMBER}}" | ||
} | ||
- name: Update Changelog | ||
if: ${{ env.PRE_RELEASE_VERSION == '' }} | ||
env: | ||
CHANGELOG_CONTENT: ${{ steps.build-changelog.outputs.changelog }} | ||
PREVIOUS_VERSION: ${{ steps.get-release.outputs.latest-tag }} | ||
run: | | ||
echo -e "# ${RELEASE_VERSION}\n\n${CHANGELOG_CONTENT}**Full Changelog**: https://github.com/${{ github.repository }}/compare/${PREVIOUS_VERSION}...${RELEASE_VERSION}\n" | cat - CHANGELOG.md > temp && mv temp CHANGELOG.md | ||
- name: Commit Changes | ||
uses: EndBug/add-and-commit@v9.1.3 | ||
env: | ||
RELEASE_TAG: ${{ steps.set-release.outputs.release-tag }} | ||
with: | ||
message: "bump up version to ${{ env.RELEASE_TAG }}" | ||
|
||
- name: Create Pull Request to Master | ||
env: | ||
CHANGELOG_CONTENT: ${{ steps.build-changelog.outputs.changelog }} | ||
PREVIOUS_VERSION: ${{ steps.get-release.outputs.latest-tag }} | ||
GH_TOKEN: ${{ github.token }} | ||
RELEASE_TAG: ${{ steps.set-release.outputs.release-tag }} | ||
run: | | ||
echo -e "# What's Changed\n\n${CHANGELOG_CONTENT}**Full Changelog**: https://github.com/${{ github.repository }}/compare/${PREVIOUS_VERSION}...${RELEASE_TAG}" > tmp_msg_body.txt | ||
export msg_body=$(cat tmp_msg_body.txt) | ||
rm tmp_msg_body.txt | ||
# Note: There's an issue adding teams as reviewers, see https://github.com/cli/cli/issues/6395 | ||
PULL_REQUEST_URL=$(gh pr create --base "master" \ | ||
--title "FOR REVIEW ONLY: ${{ github.event.repository.name }} $RELEASE_TAG" \ | ||
--label "Skip-Release-Notes" \ | ||
--label "Team Hyper Flow" \ | ||
--body "$msg_body" | tail -n 1) | ||
if [[ $PULL_REQUEST_URL =~ ^https://github.com/${{ github.repository }}/pull/[0-9]+$ ]]; then | ||
PULL_REQUEST_NUM=$(echo $PULL_REQUEST_URL | sed 's:.*/::') | ||
echo "pull-request-master=$PULL_REQUEST_URL" >> $GITHUB_ENV | ||
echo "pull-request-master-num=$PULL_REQUEST_NUM" >> $GITHUB_ENV | ||
echo "Pull request to Master created: $PULL_REQUEST_URL" | ||
else | ||
echo "There was an issue creating the pull request to master branch." | ||
exit 1 | ||
fi | ||
- name: Create Pull Request to Develop | ||
if: ${{ env.PRE_RELEASE_VERSION == '' }} | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
RELEASE_TAG: ${{ steps.set-release.outputs.release-tag }} | ||
run: | | ||
# Note: There's an issue adding teams as reviewers, see https://github.com/cli/cli/issues/6395 | ||
PULL_REQUEST_URL=$(gh pr create --base "develop" \ | ||
--title "FOR REVIEW ONLY: Merge back ${{ github.event.repository.name }} $RELEASE_TAG to develop" \ | ||
--label "Skip-Release-Notes" \ | ||
--label "Team Hyper Flow" \ | ||
--body "Merge back version changes to develop." | tail -n 1) | ||
if [[ $PULL_REQUEST_URL =~ ^https://github.com/${{ github.repository }}/pull/[0-9]+$ ]]; then | ||
echo "Pull request to Develop created: $PULL_REQUEST_URL" | ||
DEVELOP_PR_MESSAGE="\nPull Request to develop: $PULL_REQUEST_URL" | ||
echo "pull-request-develop-message=$DEVELOP_PR_MESSAGE" >> $GITHUB_ENV | ||
else | ||
echo "There was an issue creating the pull request to develop branch." | ||
exit 1 | ||
fi | ||
- name: Send Slack Message | ||
id: slack | ||
uses: slackapi/slack-github-action@v1.24.0 | ||
env: | ||
RELEASE_TAG: ${{ steps.set-release.outputs.release-tag }} | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | ||
SDK_DEPLOYMENT_URL: ${{ secrets.SDK_DEPLOYMENT_URL }} | ||
with: | ||
payload: | | ||
{ | ||
"blocks": [ | ||
{ | ||
"type": "header", | ||
"text": { | ||
"type": "plain_text", | ||
"text": "${{ github.event.repository.name }} Release PR for ${{ env.RELEASE_TAG }}" | ||
} | ||
}, | ||
{ | ||
"type": "section", | ||
"text": { | ||
"type": "mrkdwn", | ||
"text": "*Approvals needed for*:\nPull Request to master: ${{ env.pull-request-master}}${{ env.pull-request-develop-message }}" | ||
} | ||
}, | ||
{ | ||
"type": "section", | ||
"text": { | ||
"type": "mrkdwn", | ||
"text": "*After approvals*\nDeploy SDK using the <${{ env.SDK_DEPLOYMENT_URL }}|Deployment Pipeline> with the following parameters:\n*SDK*: ${{ github.event.repository.name }}\n*RELEASE_PR_NUM*: ${{ env.pull-request-master-num }}\n*RELEASE_VERSION*: ${{ env.RELEASE_VERSION }}\n*PRE_RELEASE_VERSION*: ${{ env.PRE_RELEASE_VERSION }}" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: "Lint Checks" | ||
on: | ||
pull_request: | ||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 # required for new-from-rev option in .golangci.yml | ||
- name: Install specific golang | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: '1.17.13' | ||
- name: Check format | ||
run: test -z `go fmt ./...` | ||
- name: Vet | ||
run: go vet ./... | ||
- name: reviewdog-golangci-lint | ||
uses: reviewdog/action-golangci-lint@v2 | ||
with: | ||
golangci_lint_version: "v1.47.3" | ||
golangci_lint_flags: "-c .golangci.yml --allow-parallel-runners" | ||
go_version: "1.17.13" | ||
reporter: "github-pr-review" | ||
tool_name: "Lint Errors" | ||
level: "error" | ||
fail_on_error: true | ||
filter_mode: "nofilter" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
run: | ||
timeout: 5m | ||
tests: false | ||
skip-dirs: | ||
# Don't run linter on generated files | ||
- client/v2 | ||
|
||
linters: | ||
disable-all: true | ||
enable: | ||
- deadcode | ||
- errcheck | ||
- exportloopref | ||
- gci | ||
- gofmt | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- misspell | ||
- nilerr | ||
- nolintlint | ||
- revive | ||
- staticcheck | ||
- structcheck | ||
- typecheck | ||
- unused | ||
- varcheck | ||
|
||
linters-settings: | ||
gci: | ||
sections: | ||
- standard | ||
- default | ||
- prefix(github.com/algorand) | ||
- prefix(github.com/algorand/go-algorand-sdk) | ||
section-separators: | ||
- newLine | ||
nolintlint: | ||
# require naming a specific linter X using //nolint:X | ||
require-specific: true | ||
# require comments like "//nolint:errcheck // Explanation of why we are ignoring linter here..." | ||
require-explanation: true | ||
|
||
severity: | ||
default-severity: error | ||
|
||
issues: | ||
# Disable default exclude rules listed in `golangci-lint run --help` (selectively re-enable some below) | ||
exclude-use-default: false | ||
|
||
# Maximum issues count per one linter. Set to 0 to disable. Default is 50. | ||
max-issues-per-linter: 0 | ||
|
||
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3. | ||
max-same-issues: 0 | ||
|
||
exclude: | ||
# ignore govet false positive fixed in https://github.com/golang/go/issues/45043 | ||
- "sigchanyzer: misuse of unbuffered os.Signal channel as argument to signal.Notify" | ||
# ignore golint false positive fixed in https://github.com/golang/lint/pull/487 | ||
- "exported method (.*).Unwrap` should have comment or be unexported" | ||
# ignore issues about the way we use _struct fields to define encoding settings | ||
- "`_struct` is unused" | ||
|
||
# Enable some golangci-lint default exception rules: | ||
# "EXC0001 errcheck: Almost all programs ignore errors on these functions and in most cases it's ok" | ||
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked | ||
# "EXC0005 staticcheck: Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore" | ||
- ineffective break statement. Did you mean to break out of the outer loop | ||
|
||
exclude-rules: | ||
# Test utilities and helpers may have code that look unused, but is being used in another file | ||
- path: test/helpers.go | ||
text: "is unused" | ||
- path: test/utilities.go | ||
text: "is unused" | ||
# Ignore unused fields in types that are copied from go-algorand | ||
- path: types/ | ||
text: "is unused" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.