Skip to content

Commit

Permalink
chore_: Merge branch 'develop' into ci/desktop-build
Browse files Browse the repository at this point in the history
  • Loading branch information
mendelskiv93 committed Oct 21, 2024
2 parents ea829f5 + e611b1e commit 45b1bde
Show file tree
Hide file tree
Showing 1,072 changed files with 41,087 additions and 59,247 deletions.
41 changes: 37 additions & 4 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,46 @@
# When modifying this file, please validate using:
# make codecov-validate

codecov:
require_ci_to_pass: false
notify:
wait_for_ci: true

coverage:
require_ci_to_pass: no
wait_for_ci: no
status:
project:
default:
informational: true
unit-tests:
target: auto
flags:
- unit
functional-tests:
target: auto
flags:
- functional
patch:
default:
informational: true
unit-tests:
target: auto
flags:
- unit
functional-tests:
target: auto
flags:
- functional

# When modifying this file, please validate using:
# make codecov-validate
flags:
unit-tests:
paths:
- ".*"
carryforward: false
functional-tests:
paths:
- ".*"
carryforward: true

comment:
behavior: default
layout: diff,flags,tree
83 changes: 58 additions & 25 deletions .github/workflows/commit-check.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,56 @@
name: "Conventional Commits"

on:
pull_request:
pull_request_target:
types:
- opened
- reopened
- synchronize
- labeled
- unlabeled
jobs:
main:
name: Validate format
lint_pr_commits:
name: Validate commit messages
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ env.GITHUB_HEAD_REF }}
fetch-tags: true

- name: Fetch tags
run: |
git fetch --tags --quiet
git checkout origin/${GITHUB_HEAD_REF}
fetch-depth: 0
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}

- name: Check commit message
id: check_commit_message
if: always()
run: |
set +e
base_sha=${{ github.event.pull_request.base.sha }}
head_sha=${{ github.event.pull_request.head.sha }}
output=$(./_assets/scripts/commit_check.sh 2>&1)
output=$(./_assets/scripts/commit_check.sh "${base_sha}" "${head_sha}" 2>&1)
exit_code=$?
echo "exit_code=$exit_code" >> $GITHUB_OUTPUT
echo "${output}" | sed '$d'
echo "has_breaking_changes=${has_breaking_changes}"
echo "exit_code=${exit_code}" >> $GITHUB_OUTPUT
has_breaking_changes=$(echo "${output}" | tail -n 1)
echo "has_breaking_changes=${has_breaking_changes}" >> $GITHUB_OUTPUT
invalid_commit_messages=$(echo "${output}" | sed '1d;$d')
invalid_commit_messages=$(echo "${output}" | sed '1d;$d')
invalid_commit_messages=$(echo "${invalid_commit_messages}" | sed 's/\x1b\[[0-9;]*m//g') # Remove color codes
invalid_commit_messages=$(echo "${invalid_commit_messages}" | sed 's/^Commit message is ill-formed: //') # Remove prefix
if [[ $exit_code -ne 0 ]]; then
invalid_commit_messages=$(echo $output | sed '1d;$d')
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "error_message<<$EOF" >> "$GITHUB_ENV"
echo "invalid_commit_messages" >> "$GITHUB_ENV"
echo "${invalid_commit_messages}" >> "$GITHUB_ENV"
echo "$EOF" >> "$GITHUB_ENV"
else
has_breaking_changes=$(echo "$output" | tail -n 1)
echo "has_breaking_changes=$has_breaking_changes" >> $GITHUB_OUTPUT
fi
- name: "Publish failed commit messages"
Expand All @@ -50,12 +61,8 @@ jobs:
with:
header: commit-message-lint-error
message: |
Thank you for opening this pull request!
We require commits to follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/), but with `_` for non-breaking changes.
And it looks like your PR needs to be adjusted.
Details:
Please fix these commit messages:
```
${{ env.error_message }}
```
Expand All @@ -68,10 +75,14 @@ jobs:
with:
header: commit-message-lint-error
message: |
Thank you for opening this pull request!
Looks like you have BREAKING CHANGES in your PR.
Please make sure to update [status-desktop](https://github.com/status-im/status-desktop) and [status-mobile](https://github.com/status-im/status-mobile) clients accordingly.
Please make sure to follow [💔How to introduce breaking changes](https://www.notion.so/How-to-introduce-breaking-changes-ded9ec2d91464a46a2593c0d8de62fbe?pvs=4) guide:
### Check-list
- [ ] Tried to avoid this breaking change
- [ ] Updated [status-desktop](https://github.com/status-im/status-desktop)
- [ ] Updated [status-mobile](https://github.com/status-im/status-mobile)
# Delete a previous comment when the issue has been resolved
- name: "Delete previous comment"
Expand All @@ -80,3 +91,25 @@ jobs:
with:
header: commit-message-lint-error
delete: true

- name: "Mark as failed"
if: steps.check_commit_message.outputs.exit_code != 0
uses: actions/github-script@v7
with:
script: |
core.setFailed("Some commit messages are ill-formed")
- name: "Update breaking changes label"
if: always()
run: |
if [[ $ADD_LABEL == 'true' ]]; then
command="--add-label"
else
command="--remove-label"
fi
gh issue edit "$NUMBER" $command "breaking change"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
NUMBER: ${{ github.event.pull_request.number }}
ADD_LABEL: ${{ steps.check_commit_message.outputs.has_breaking_changes == 'true' }}
21 changes: 21 additions & 0 deletions .github/workflows/pr-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: "Conventional Commits"

on:
pull_request:
types:
- opened
- edited
- reopened
- synchronize
jobs:
lint_pr_title:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# Keep regex in sync with ./_assets/scripts/parse_commits.sh#L25
headerPattern: '^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\(.*\))?(\_|!): (.*)$'
headerPatternCorrespondence: type, scope, breaking, subject
18 changes: 17 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,26 @@ test-bob/
# Nix
/.nix-gcroots/

# integration-tests
# functional tests
__pycache__/
*.py[cod]
*$py.class
.pytest_cache/
.envrc
report/results.xml
tests-functional/coverage
tests-functional/reports
tests-functional/*.log

# generated files
mock
mock.go
*.pb.go
bindata.go
migrations.go
cmd/status-backend/server/endpoints.go
protocol/messenger_handlers.go

# Don't ignore generated files in the vendor/ directory
!vendor/**/*.pb.go
!vendor/**/migrations.go
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Once a feature has undergone testing and is ready for production use, the featur
Test coverage is vital for ensuring the stability and reliability of our project. Follow these guidelines:

1. Before submitting a PR, check the existing test coverage for the modified or new code.
2. Ensure that the new code is covered by relevant unit tests, integration tests, or other appropriate testing methods.
2. Ensure that the new code is covered by relevant unit, integration and/or functional tests, or other appropriate testing methods.
3. If modifying existing code, update or add tests to cover the changes.
4. If adding new features, include tests that demonstrate the correct functionality and handle edge cases.

Expand Down
Loading

0 comments on commit 45b1bde

Please sign in to comment.