-
Notifications
You must be signed in to change notification settings - Fork 49
AZ-219 Replaced statefull force push check when pull requests are merged #168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Marcin-Radecki
merged 5 commits into
Cardinal-Cryptography:main
from
Marcin-Radecki:AZ-219-replaced-statefull-force-push-check
Jan 13, 2022
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
5693f05
AZ-219 Replaced statefull force push check when pull requests are merged
Marcin-Radecki 0c46cc1
AZ-219 Fixed clippy must_use on metod returning Self warning
Marcin-Radecki 2dc9eac
AZ-219 Victim of my own PR - bumped version as change is also in the …
Marcin-Radecki 74f51a7
AZ-219 This time fixing clippy must_use warning.
Marcin-Radecki e984232
Review remarks applied - now checking grep result status instead of
Marcin-Radecki File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,34 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -e | ||
|
|
||
| function get_major_version() { | ||
| echo "$1" | cut -d '.' -f 1 | ||
| } | ||
|
|
||
| function get_minor_version() { | ||
| echo "$1" | cut -d '.' -f 2 | ||
| } | ||
|
|
||
| function trim_version() { | ||
| grep -e "$1" "$2" | cut -d "=" -f 2 | tr -d "\"^ " | ||
| } | ||
|
|
||
| function check_versions() { | ||
| if [ "$1" != "$2" ]; then | ||
| echo "aleph-bft Cargo's toml $3 version $1 different than README.md's $3 version $2!" | ||
| exit 1 | ||
| fi | ||
| } | ||
|
|
||
| cargo_toml_version=$(trim_version '^version =' "Cargo.toml") | ||
| cargo_toml_major_version=$(get_major_version "${cargo_toml_version}") | ||
| cargo_toml_minor_version=$(get_minor_version "${cargo_toml_version}") | ||
|
|
||
| readme_version=$(trim_version '\s*aleph-bft =' "README.md") | ||
| readme_major_version=$(get_major_version "${readme_version}") | ||
| readme_minor_version=$(get_minor_version "${readme_version}") | ||
|
|
||
| check_versions "${cargo_toml_major_version}" "${readme_major_version}" "major" | ||
| check_versions "${cargo_toml_minor_version}" "${readme_minor_version}" "minor" | ||
| echo "Versions from README and Cargo.toml match." |
This file contains hidden or 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,13 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -e | ||
|
|
||
| if [ -z "$(git diff HEAD origin/main -- src/)" ]; then | ||
| echo "No changes in the code." | ||
| exit 0 | ||
| fi | ||
|
|
||
| if [ -z "$(git diff HEAD origin/main -- Cargo.toml | grep '^+version =')" ]; then | ||
| echo "None of commits in this PR has changed version in Cargo.toml!" | ||
| exit 1 | ||
| fi | ||
This file contains hidden or 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,21 @@ | ||
| name: Check if PR has bumbed versions in Cargo.toml for code changes and if README is synchronized | ||
timorl marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| check-versions: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: checkout | ||
| uses: actions/checkout@v2 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: check-cargo-toml-version-bumped | ||
| run: ./.github/scripts/check-cargo-toml-version-bumped.sh | ||
| shell: bash | ||
| - name: cargo-toml-match-readme-version | ||
| run: ./.github/scripts/cargo-toml-match-readme-version.sh | ||
| shell: bash | ||
This file contains hidden or 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,38 @@ | ||
| name: Publish to crates.io | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| main | ||
|
|
||
| jobs: | ||
| publish: | ||
| # need to rename environment name after this is merged | ||
timorl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| environment: Autobump version | ||
| runs-on: ubuntu-latest | ||
| if: ${{ github.repository == 'Cardinal-Cryptography/AlephBFT'}} | ||
| steps: | ||
| - name: checkout | ||
| uses: actions/checkout@v2 | ||
| with: | ||
| fetch-depth: 2 | ||
| - name: force publish if version bumped | ||
| run: | | ||
| if [ -n "$(git diff HEAD~ -- Cargo.toml | grep '^+version =')" ]; then | ||
timorl marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| echo "Version in Cargo.toml was bumped in this PR, publishing to crates.io." | ||
| touch publishMe | ||
timorl marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| fi | ||
| - uses: actions-rs/toolchain@v1 | ||
| with: | ||
| toolchain: stable | ||
| - name: credentials | ||
| uses: actions-rs/cargo@v1 | ||
| with: | ||
| command: login | ||
| args: ${{ secrets.CRATES_IO_TOKEN }} | ||
| - name: publish | ||
| run: | | ||
| if [ -f publishMe ]; then | ||
| echo "Publishing to cargo.io" | ||
| cargo publish | ||
| fi | ||
This file contains hidden or 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 was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.