From 21a9cb9b28774b2e90d1e2a0768a5194f99bf6a2 Mon Sep 17 00:00:00 2001 From: Marko Date: Mon, 25 May 2020 20:02:08 +0200 Subject: [PATCH] ci: automate release post tag push (#6230) --- .github/workflows/lint.yml | 3 +++ .github/workflows/proto.yml | 8 +++++--- .github/workflows/release-sims.yml | 12 +++++++----- .github/workflows/sims.yml | 2 ++ .github/workflows/tag.yml | 26 ++++++++++++++++++++++++++ .github/workflows/test.yml | 4 +++- .goreleaser.yml | 27 +++++++++++++++++++++++++++ CONTRIBUTING.md | 7 +++++-- 8 files changed, 78 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/tag.yml create mode 100644 .goreleaser.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 22b8faec5..937f683e8 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,4 +1,7 @@ name: Lint +# Lint runs golangci-lint over the entire cosmos-sdk repository +# This workflow is run on every pull request and push to master +# The `golangci` will pass without running if no *.{go, mod, sum} files have been changed. on: pull_request: push: diff --git a/.github/workflows/proto.yml b/.github/workflows/proto.yml index 02f9f5a36..40d48e200 100644 --- a/.github/workflows/proto.yml +++ b/.github/workflows/proto.yml @@ -1,8 +1,10 @@ name: Protobuf -on: +# Protobuf runs buf (https://buf.build/) lint and check-breakage +# This workflow is only run when a .proto file has been changed +on: pull_request: - paths: - - '**.proto' + paths: + - "**.proto" jobs: lint: runs-on: ubuntu-latest diff --git a/.github/workflows/release-sims.yml b/.github/workflows/release-sims.yml index 08650bfba..283cdad42 100644 --- a/.github/workflows/release-sims.yml +++ b/.github/workflows/release-sims.yml @@ -1,9 +1,11 @@ name: Release Sims -on: - pull_request: - branches: - - 'rc**' - +# Release Sims workflow runs long-lived (multi-seed & large block size) simulations +# This workflow only runs on a pull request when the branch contains rc** (rc1/vX.X.x) +on: + pull_request: + branches: + - "rc**" + jobs: cleanup-runs: runs-on: ubuntu-latest diff --git a/.github/workflows/sims.yml b/.github/workflows/sims.yml index c23db979a..bf18d0a27 100644 --- a/.github/workflows/sims.yml +++ b/.github/workflows/sims.yml @@ -1,4 +1,6 @@ name: Sims +# Sims workflow runs multiple types of simulations (nondeterminism, import-export, after-import, multi-seed-short) +# This workflow will run on all Pull Requests, if a .go, .mod or .sum file have been changed on: pull_request: jobs: diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml new file mode 100644 index 000000000..6040be79c --- /dev/null +++ b/.github/workflows/tag.yml @@ -0,0 +1,26 @@ +name: Release +# This workflow helps with creating releases. +# This job will only be triggered when a tag (vX.X.x) is pushed +on: + push: + # Sequence of patterns matched against refs/tags + tags: + - "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10 + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install Go + uses: actions/setup-go@v1 + with: + go-version: 1.14 + - name: Unshallow + run: git fetch --prune --unshallow + - name: Create release + uses: goreleaser/goreleaser-action@v2 + with: + args: release --rm-dist --release-notes ./RELEASE_CHANGELOG.md + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 200f474be..2e78a807a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,6 @@ -name: Code Coverage +name: Uint-Tests / Code Coverage +# Uint-Tests / Code Coverage workflow runs unit tests and uploads a code coverage report +# This workflow is run on pushes to master & every Pull Requests where a .go, .mod, .sum have been changed on: pull_request: push: diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 000000000..4d33ce325 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,27 @@ +--- +project_name: cosmos-sdk + +release: + github: + owner: cosmos + name: cosmos-sdk + +builds: + - skip: true + +archives: + - format: tar.gz + wrap_in_directory: true + format_overrides: + - goos: windows + format: zip + name_template: "{{ .Binary }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}" + files: + - LICENSE + - README.md + +snapshot: + name_template: SNAPSHOT-{{ .Commit }} + +changelog: + skip: true diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 76c6d0e54..8f5c50601 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -216,6 +216,7 @@ only pull requests targeted directly against master. - **no PRs targeting this branch should be merged unless exceptional circumstances arise** - On the `RC` branch, prepare a new version section in the `CHANGELOG.md` - All links must be link-ified: `$ python ./scripts/linkify_changelog.py CHANGELOG.md` + - Copy the entries into a `RELEASE_CHANGELOG.md`, this is needed so the bot knows which entries to add to the release page on github. - Kick off a large round of simulation testing (e.g. 400 seeds for 2k blocks) - If errors are found during the simulation testing, commit the fixes to `master` and create a new `RC` branch (making sure to increment the `rcN`) @@ -234,13 +235,15 @@ releases will be based off of that release. - checkout a new branch `rcN/vX.X.X` - cherry pick the desired changes from `master` - these changes should be small and NON-BREAKING (both API and state machine) -- add entries to CHANGELOG.md and remove corresponding pending log entries +- create a `RELEASE_CHANGELOG.md`, add entires. + - this is needed so the bot knows which entries to add to the release page on github. - checkout a new branch `release/vX.X.X` based off of the previous release - create a PR merging `rcN/vX.X.X` into `release/vX.X.X` - run tests and simulations (noted in [Release Procedure](#release-procedure)) - after tests and simulation have successfully completed, merge the `RC` branch into `release/vX.X.X` - Make sure to delete the `RC` branch -- create a PR into `master` containing ONLY the CHANGELOG.md updates +- create a PR into `master` containing ONLY CHANGELOG.md updates + - Do not push `RELEASE_CHANGELOG.md` to master - tag (use `git tag -a`) then push the tags (`git push --tags`) ## Code Owner Membership