Skip to content

Commit

Permalink
Merge branch 'master' into update-artifacts-version
Browse files Browse the repository at this point in the history
  • Loading branch information
k-dovgan authored Sep 17, 2024
2 parents d83ed01 + 9b853a3 commit 640a12d
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 26 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/postcommit-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Universum check
on:
push

jobs:
universum_postcommit:
name: Universum postcommit
runs-on: ubuntu-latest

steps:
- name: Setup python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8

- name: Install dependency
run: pip install universum[test]

- name: Universum
run:
python -u -m universum
--fail-unsuccessful
--vcs-type="git"
--git-repo "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY"
--git-refspec "$GITHUB_REF_NAME"
--no-archive
--no-diff

- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
with:
files: artifacts/*.xml

- name: Collect artifacts
uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: artifacts
path: artifacts
42 changes: 22 additions & 20 deletions .github/workflows/telegram-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,42 +40,44 @@ jobs:
run: |
if [[ ! -z "${{ github.event.pull_request }}" && "${{ github.event.action }}" == "opened" ]]; then
ESCAPED_NAME=`echo -e "${{ env.PR_NAME }}" | sed 's/\&/\&amp;/g' | sed 's/</\&lt;/g' | sed 's/>/\&gt;/g'`
TEXT=`echo -e "<b>${{ env.PR_AUTHOR }}</b> created new <a href=\"${{ env.PR_URL }}\">PR#${{ env.PR_NUMBER }}</a> '$ESCAPED_NAME' to branch '${{ env.PR_BASE }}'"`
ESCAPED_NAME=`echo -e "$PR_NAME" | sed 's/\&/\&amp;/g' | sed 's/</\&lt;/g' | sed 's/>/\&gt;/g'`
TEXT=`echo -e "<b>"$PR_AUTHOR"</b> created new <a href=\"$PR_URL\">PR#"$PR_NUMBER"</a> '"$ESCAPED_NAME"' to branch '"$PR_BASE"'"`
elif [[ ! -z "${{ github.event.pull_request }}" && "${{ github.event.action }}" == "synchronize" ]]; then
TEXT=`echo -e "<b>${{ env.PR_AUTHOR }}</b> updated <a href=\"${{ env.PR_URL }}\">PR#${{ env.PR_NUMBER }}</a>"`
TEXT=`echo -e "<b>"$PR_AUTHOR"</b> updated <a href=\"$PR_URL\">PR#"$PR_NUMBER"</a>"`
elif [[ ! -z "${{ github.event.pull_request }}" && "${{ github.event.action }}" == "closed" && "${{ github.event.pull_request.merged }}" == "true" ]]; then
TEXT=`echo -e "<b>${{ env.PR_MERGED }}</b> merged <a href=\"${{ env.PR_URL }}\">PR#${{ env.PR_NUMBER }}</a> to branch <b>'${{ env.PR_BASE }}'</b>"`
TEXT=`echo -e "<b>"$PR_MERGED"</b> merged <a href=\"$PR_URL\">PR#"$PR_NUMBER"</a> to branch <b>'"$PR_BASE"'</b>"`
elif [[ ! -z "${{ github.event.pull_request }}" && "${{ github.event.action }}" == "closed" ]]; then
TEXT=`echo -e "<b>${{ env.PR_AUTHOR }}</b> closed <a href=\"${{ env.PR_URL }}\">PR#${{ env.PR_NUMBER }}</a>"`
TEXT=`echo -e "<b>"$PR_AUTHOR"</b> closed <a href=\"$PR_URL\">PR#"$PR_NUMBER"</a>"`
elif [[ ! -z "${{ github.event.comment }}" ]]; then
ESCAPED_TEXT=`echo -e "${{ env.COMMENT_BODY }}"| sed 's/\&/\&amp;/g' | sed 's/</\&lt;/g' | sed 's/>/\&gt;/g'`
ESCAPED_TEXT=`echo -e "$COMMENT_BODY"| sed 's/\&/\&amp;/g' | sed 's/</\&lt;/g' | sed 's/>/\&gt;/g'`
if [[ ! -z "${{ github.event.pull_request }}" ]]; then
TEXT=`echo -e "<b>${{ env.COMMENT_AUTHOR }}</b> posted the following comment to file <i>${{ env.COMMENT_FILE }}</i> in <a href=\"${{ env.COMMENT_URL }}\">PR#${{ env.PR_NUMBER }}</a>:\n<i>$ESCAPED_TEXT</i>"`
TEXT=`echo -e "<b>"$COMMENT_AUTHOR"</b> posted the following comment to file <i>"$COMMENT_FILE"</i> in <a href=\"$COMMENT_URL\">PR#"$PR_NUMBER"</a>:\n<i>"$ESCAPED_TEXT"</i>"`
else
TEXT=`echo -e "<b>${{ env.COMMENT_AUTHOR }}</b> posted the following comment to issue <a href=\"${{ env.COMMENT_URL }}\">#${{ env.COMMENT_NUMBER }}</a>:\n<i>$ESCAPED_TEXT</i>"`
TEXT=`echo -e "<b>"$COMMENT_AUTHOR"</b> posted the following comment to issue <a href=\"$COMMENT_URL\">#"$COMMENT_NUMBER"</a>:\n<i>"$ESCAPED_TEXT"</i>"`
fi
elif [[ ! -z "${{ github.event.review }}" && "${{ env.REVIEW_STATE }}" == "changes_requested" ]]; then
TEXT=`echo -e "<b>${{ env.REVIEW_AUTHOR }}</b> requested changes for <a href=\"${{ env.PR_URL }}\">PR#${{ env.PR_NUMBER }}</a>"`
elif [[ ! -z "${{ github.event.review }}" && "${{ env.REVIEW_STATE }}" == "commented" && ! -z "${{ env.REVIEW_COMMENT }}" ]]; then
ESCAPED_TEXT=`echo -e "${{ env.REVIEW_COMMENT }}"| sed 's/\&/\&amp;/g' | sed 's/</\&lt;/g' | sed 's/>/\&gt;/g'`
TEXT=`echo -e "<b>${{ env.REVIEW_AUTHOR }}</b> posted the following comment to <a href=\"${{ env.PR_URL }}\">PR#${{ env.PR_NUMBER }}</a>:\n<i>$ESCAPED_TEXT</i>"`
elif [[ ! -z "${{ github.event.review }}" && "${{ env.REVIEW_STATE }}" != "commented" ]]; then
TEXT=`echo -e "<b>${{ env.REVIEW_AUTHOR }}</b> ${{ env.REVIEW_STATE }} <a href=\"${{ env.PR_URL }}\">PR#${{ env.PR_NUMBER }}</a>"`
elif [[ ! -z "${{ github.event.review }}" && "$REVIEW_STATE" == "changes_requested" ]]; then
TEXT=`echo -e "<b>"$REVIEW_AUTHOR"</b> requested changes for <a href=\"$PR_URL\">PR#"$PR_NUMBER"</a>"`
elif [[ ! -z "${{ github.event.review }}" && "$REVIEW_STATE" == "commented" && ! -z "$REVIEW_COMMENT" ]]; then
ESCAPED_TEXT=`echo -e "$REVIEW_COMMENT"| sed 's/\&/\&amp;/g' | sed 's/</\&lt;/g' | sed 's/>/\&gt;/g'`
TEXT=`echo -e "<b>"$REVIEW_AUTHOR"</b> posted the following comment to <a href=\"$PR_URL\">PR#"$PR_NUMBER"</a>:\n<i>"$ESCAPED_TEXT"</i>"`
elif [[ ! -z "${{ github.event.review }}" && "$REVIEW_STATE" != "commented" ]]; then
TEXT=`echo -e "<b>"$REVIEW_AUTHOR"</b> "$REVIEW_STATE" <a href=\"$PR_URL\">PR#"$PR_NUMBER"</a>"`
elif [[ -z "${{ github.event.review }}" && "${{ github.event.action }}" == "submitted" ]]; then
TEXT=`echo -e "Due to GitHub Actions bug we cannot identify, who approved <a href=\"${{ env.PR_URL }}\">PR#${{ env.PR_NUMBER }}</a>"`
TEXT=`echo -e "Due to GitHub Actions bug we cannot identify, who approved <a href=\"$PR_URL\">PR#"$PR_NUMBER"</a>"`
elif [[ ! -z "${{ github.event.workflow_run }}" && "${{ github.event.workflow_run.conclusion }}" == "success" ]]; then
TEXT=`echo -e "<a href=\"${{ env.UNIVERSUM_LOG }}\">Universum run for branch '${{ env.UNIVERSUM_BRANCH }}'</a> <b>SUCCEDED</b>; commit ${{ env.UNIVERUM_COMMIT }} "`
ESCAPED_TEXT=`echo -e "$UNIVERSUM_BRANCH"| sed 's/\&/\&amp;/g' | sed 's/</\&lt;/g' | sed 's/>/\&gt;/g'`
TEXT=`echo -e "<a href=\"$UNIVERSUM_LOG\">Universum run for branch "$ESCAPED_TEXT"</a> <b>SUCCEDED</b>; commit "$UNIVERUM_COMMIT" "`
elif [[ ! -z "${{ github.event.workflow_run }}" && "${{ github.event.workflow_run.conclusion }}" == "failure" ]]; then
TEXT=`echo -e "<a href=\"${{ env.UNIVERSUM_LOG }}\">Universum run for branch '${{ env.UNIVERSUM_BRANCH }}'</a> <b>FAILED</b>; commit ${{ env.UNIVERUM_COMMIT }} "`
ESCAPED_TEXT=`echo -e "$UNIVERSUM_BRANCH"| sed 's/\&/\&amp;/g' | sed 's/</\&lt;/g' | sed 's/>/\&gt;/g'`
TEXT=`echo -e "<a href=\"$UNIVERSUM_LOG\">Universum run for branch "$ESCAPED_TEXT"</a> <b>FAILED</b>; commit "$UNIVERUM_COMMIT" "`
fi
if [[ ! -z $TEXT ]]; then
if [[ ! -z "$TEXT" ]]; then
curl --get --data-urlencode "chat_id=${{ secrets.TELEGRAM_CHAT_ID }}" --data-urlencode "disable_web_page_preview=True" \
--data-urlencode "text=$TEXT" --data-urlencode "parse_mode=HTML" $URL
--data-urlencode "text=$TEXT" --data-urlencode "parse_mode=HTML" "$URL"
fi
env:
Expand Down
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,18 @@ and then use the commands listed below. Please note we use `venv` to properly se
python interpreter version and to isolate development environment from the system.

Prerequisites:
1. Install all of the VCS extras as described in the [Universum installation manual](
1. Make sure the libssl-dev and libcrypto++-dev packages are available in your environment.
```bash
sudo apt install libssl-dev libcrypto++-dev
```
2. Install all of the VCS extras as described in the [Universum installation manual](
https://universum.readthedocs.io/en/latest/install.html#vcs-related-extras),
(including installation of Git and P4 CLI)
2. Install Docker (`docker-ce`, `docker-ce-cli`) as described in the [official installation manual](
3. Install Docker (`docker-ce`, `docker-ce-cli`) as described in the [official installation manual](
https://docs.docker.com/engine/installation/linux/ubuntu/#install-using-the-repository)

* Also add current user to 'docker' group (use `sudo usermod -a -G docker $USER` and then relogin)
3. Install Mozilla WebDriver: `sudo apt install firefox-geckodriver`
4. Install Mozilla WebDriver: `sudo apt install firefox-geckodriver`

Further commands:
```bash
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ def readme():
'types-requests',
'selenium==3.141',
'urllib3==1.26.15', # This is required for selenium-3.141 to work correctly
'types-PyYAML==6.0'
'types-PyYAML==6.0',
'wheel'
]
},
package_data={'': ['*.css', '*.js']}
Expand Down
17 changes: 17 additions & 0 deletions tests/test_code_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,3 +405,20 @@ def test_code_report_extended_arg_search_embedded(tmp_path: pathlib.Path, stdout

env.run()
stdout_checker.assert_absent_calls_with_param("${CODE_REPORT_FILE}")


def test_clang_format_analyzer_with_subfolder(runner_with_analyzers: UniversumRunner):
root = runner_with_analyzers.local.root_directory
source_file = root / "subdir" / "source_file"
source_file.parent.mkdir(parents=True, exist_ok=True)
source_file.write_text(source_code_c)
common_args = [
"--result-file", "${CODE_REPORT_FILE}",
"--files", "subdir/source_file"
]

(root / ".clang-format").write_text(config_clang_format)
log = runner_with_analyzers.run(ConfigData().add_analyzer("clang_format", common_args).finalize())

assert not re.findall(r'No such file or directory', log), f"'No such file or directory' is found in '{log}'"
assert re.findall(log_fail, log), f"'{log_fail}' is not found in '{log}'"
2 changes: 1 addition & 1 deletion universum/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__title__ = "Universum"
__version__ = "0.19.19"
__version__ = "0.19.20"
1 change: 1 addition & 0 deletions universum/analyzers/clang_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def main(settings: argparse.Namespace) -> List[utils.ReportData]:
cmd = [settings.executable, src_file_absolute]
_add_style_param_if_present(cmd, settings)
output, _ = utils.run_for_output(cmd)
target_file_absolute.parent.mkdir(parents=True, exist_ok=True)
with open(target_file_absolute, "w", encoding="utf-8") as output_file:
output_file.write(output)

Expand Down
2 changes: 1 addition & 1 deletion universum/analyzers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def expand_files_argument(settings: argparse.Namespace) -> None:
# TODO: subclass argparse.Action
result: Set[str] = set()
for pattern in settings.file_list:
file_list: List[str] = glob.glob(pattern)
file_list: List[str] = glob.glob(pattern, recursive=True)
if not file_list:
sys.stderr.write(f"Warning: no files found for input pattern {pattern}\n")
else:
Expand Down

0 comments on commit 640a12d

Please sign in to comment.