Skip to content

Commit

Permalink
Merge branch 'main' into wxgui-nviz-fix-scrollbars
Browse files Browse the repository at this point in the history
  • Loading branch information
petrasovaa authored Apr 26, 2024
2 parents 274716a + 8cbe8fe commit 5b5a791
Show file tree
Hide file tree
Showing 910 changed files with 1,963,340 additions and 1,794,595 deletions.
4 changes: 3 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ per-file-ignores =
# F821 undefined name 'unicode'
# F841 local variable assigned to but never used
# E741 ambiguous variable name 'l'
__init__.py: F401, F403
lib/init/grass.py: E501, E722, F821, F841, W605
utils/mkrest.py: E501, W605
utils/gitlog2changelog.py: E722, E712, W605
Expand Down Expand Up @@ -50,6 +51,7 @@ per-file-ignores =
gui/wxpython/core/giface.py: E501
gui/wxpython/core/gthread.py: F841
gui/wxpython/core/gconsole.py: E722, W605
gui/wxpython/core/globalvar.py: W605
gui/wxpython/core/toolboxes.py: E722, E501
gui/wxpython/core/utils.py: E722, F841, W605
gui/wxpython/core/workspace.py: E722, E501
Expand All @@ -67,7 +69,7 @@ per-file-ignores =
gui/wxpython/gcp/g.gui.gcp.py: F841
gui/wxpython/gcp/manager.py: E501, F841, E722
gui/wxpython/gcp/mapdisplay.py: F841
gui/wxpython/gmodeler/*: F841, E722, W605, F405, F403, E402
gui/wxpython/gmodeler/*: E501
gui/wxpython/gui_core/*: F841, E266, E722, W605
gui/wxpython/gui_core/dialogs.py: E501, E722, F841, W605
gui/wxpython/gui_core/forms.py: E501, E722, F841
Expand Down
31 changes: 15 additions & 16 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,35 @@ assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.
## Describe the bug
<!-- A clear and concise description of what the bug is. -->

**To Reproduce**
Steps to reproduce the behavior:
## To reproduce
<!-- Describe the steps to reproduce the behavior, e.g.:
1. Go to '...'
2. Click on '...'
3. Compute '...'
4. See error
-->

**Expected behavior**
A clear and concise description of what you expected to happen.
## Expected behavior
<!-- If not obvious, describe what you expected to happen. -->

**Screenshots**
If applicable, add screenshots to help explain your problem.

**System description (please complete the following information):**
## Screenshots
<!-- If applicable, add screenshots to help explain your problem. -->

## System description
<!--
- Operating System: [e.g. Windows, Linux, ..., incl. version]
- GRASS GIS version [e.g. 7.8.4]

<!---
- GRASS GIS version: [e.g. 4.0]
- details about further software components
- run `g.version -rge` in a GRASS GIS terminal session or check in
the GUI menu "Help > About"
- run `python3 -c "import sys, wx; print(sys.version); print(wx.version())"`
to print the Python and wxPython version numbers
--->
-->

**Additional context**
Add any other context about the problem here.
## Additional context
<!-- Add any other context about the problem. -->
237 changes: 237 additions & 0 deletions .github/actions/create-upload-suggestions/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
name: "Create and upload suggestions"
description: "Creates a file containing changes applied by a tool"
author: echoix
inputs:
tool-name:
description: "The tool name, used for creating the file names"
required: true
upload-suggestions:
description: >-
If "true", the suggestions diff file will be uploaded here.
Otherwise, with "false" or any other value, the diff artifact won't be
uploaded. Not uploading directly could be used when multiple tools are
used, and each has a diff file that would be uploaded into one artifact.
default: "true"
required: false
extra-upload-suggestions:
description: >-
Extra paths to add to the diff artifact upload containing suggestions.
default: ""
required: false
upload-changes:
description: >-
If "true", the changed files will be uploaded to an artifact.
Otherwise, with "false" or any other value, the artifact containing
changed files won't be uploaded.
default: "true"
required: false
extra-upload-changes:
description: >-
Extra paths to add to the artifact containing changed files.
It is recommended to add at least one file from the root of the repo to
prevent flattening of the repo structure.
default: ""
required: false
fail-if-changed:
description: >-
If "true", the action will exit with a failure if there are some
uncommitted changed files.
default: "true"
required: false
fail-message:
description: >-
Message to display when files have changed and the `fail-if-changed`
input is set to `true`.
default: "Files have changed."
required: false
outputs:
changed-files:
description: List of files that were changed, line separated
value: ${{ steps.git-changed-files.outputs.CHANGED_FILES }}
files_changed:
description: '"true" if some files were changed, "false" otherwise.'
value: ${{ steps.files_changed.outputs.files_changed }}
diff-file-name:
description: Name of the diff file created
value: ${{ steps.diff-patch.outputs.diff-file-name }}
tool-name:
description: Name of the tool, sanitized
value: ${{ steps.tool-name-safe.outputs.tool-name }}
suggestions-artifact-id:
description: Artifact id of the suggestions if uploaded
value: ${{ steps.upload-diff.outputs.artifact-id }}
suggestions-artifact-url:
description: Artifact url of the suggestions if uploaded
value: ${{ steps.upload-diff.outputs.artifact-url }}
changes-artifact-id:
description: Artifact id of the changes if uploaded
value: ${{ steps.upload-changes.outputs.artifact-id }}
changes-artifact-url:
description: Artifact url of the changes if uploaded
value: ${{ steps.upload-changes.outputs.artifact-url }}
runs:
using: "composite"
steps:
- name: Pass inputs through environment variables
# To avoid directly using the inputs in scripts
id: inputs
shell: bash
run: |
echo "tool-name=${INPUT_TOOL_NAME}" >> "${GITHUB_OUTPUT}"
echo "upload-suggestions=${INPUT_UPLOAD_SUGGESTIONS}" >> "${GITHUB_OUTPUT}"
{
echo 'extra-upload-suggestions<<EOF'
echo "${INPUT_EXTRA_UPLOAD_SUGGESTIONS}"
echo EOF
} >> "${GITHUB_OUTPUT}"
echo "upload-changes=${INPUT_UPLOAD_CHANGES}" >> "${GITHUB_OUTPUT}"
{
echo 'extra-upload-changes<<EOF'
echo "${INPUT_EXTRA_UPLOAD_CHANGES}"
echo EOF
} >> "${GITHUB_OUTPUT}"
echo "fail-if-changed=${INPUT_FAIL_IF_CHANGED}" >> "${GITHUB_OUTPUT}"
{
echo 'fail-message<<EOF'
echo "${INPUT_FAIL_MESSAGE}"
echo EOF
} >> "${GITHUB_OUTPUT}"
env:
INPUT_TOOL_NAME: ${{ inputs.tool-name }}
INPUT_UPLOAD_SUGGESTIONS: ${{ inputs.upload-suggestions }}
INPUT_EXTRA_UPLOAD_SUGGESTIONS: ${{ inputs.extra-upload-suggestions }}
INPUT_UPLOAD_CHANGES: ${{ inputs.upload-changes }}
INPUT_EXTRA_UPLOAD_CHANGES: ${{ inputs.extra-upload-changes }}
INPUT_FAIL_IF_CHANGED: ${{ inputs.fail-if-changed }}
INPUT_FAIL_MESSAGE: ${{ inputs.fail-message }}
- name: Sanitize tool name for file name and diff file name
id: tool-name-safe
shell: bash
env:
INPUT_TOOL_NAME: ${{ steps.inputs.outputs.tool-name }}
run: |
sanitize() { # https://stackoverflow.com/a/44811468
local s="${1?need a string}" # receive input in first argument
s="${s//[^[:alnum:]]/-}" # replace all non-alnum characters to -
s="${s//+(-)/-}" # convert multiple - to single -
s="${s/#-}" # remove - from start
s="${s/%-}" # remove - from end
echo "${s,,}" # convert to lowercase
}
tool_name_safe=$(sanitize "${INPUT_TOOL_NAME}")
echo "New tool name value: ${tool_name_safe}"
echo "tool-name=${tool_name_safe}" >> "${GITHUB_OUTPUT}"
echo "diff-file-name=diff-${tool_name_safe}.patch" >> "${GITHUB_OUTPUT}"
- id: git-changed-files
shell: bash
run: |
{
echo 'CHANGED_FILES<<EOF'
git ls-files --other --modified --exclude-standard
echo EOF
} >> "${GITHUB_OUTPUT}"
- name: Get if has changed files (list of changed files is not empty)
id: files_changed
shell: bash
run: |
if [[ -n "$CHANGED_FILES" ]]; then
echo "files_changed=true" >> "${GITHUB_OUTPUT}"
else
echo "files_changed=false" >> "${GITHUB_OUTPUT}"
fi
env:
CHANGED_FILES: ${{ steps.git-changed-files.outputs.CHANGED_FILES }}
- name: List all changed files tracked and untracked files
shell: bash
run: |
echo "Changed files: ${{ steps.git-changed-files.outputs.CHANGED_FILES }}"
- name: Add job summary without changed files
shell: bash
if: ${{ steps.files_changed.outputs.files_changed == 'false' }}
run: |
{
echo "### Changed files:"
echo "No files were changed by ${INPUT_TOOL_NAME}"
} >> "${GITHUB_STEP_SUMMARY}"
env:
INPUT_TOOL_NAME: ${{ steps.inputs.outputs.tool-name }}
- name: Add job summary with changed files
if: ${{ steps.files_changed.outputs.files_changed == 'true' }}
shell: bash
run: |
{
echo '### Changed files:'
echo '```'
echo "${CHANGED_FILES}"
echo '```'
} >> "${GITHUB_STEP_SUMMARY}"
env:
CHANGED_FILES: ${{ steps.git-changed-files.outputs.CHANGED_FILES }}
- name: Create unified diff of changes
if: ${{ steps.files_changed.outputs.files_changed == 'true' }}
id: diff-patch
shell: bash
run: |
git diff --unified=0 --no-color --output="${INPUT_DIFF_FILE_NAME}"
echo "diff-file-name=${INPUT_DIFF_FILE_NAME}" >> "${GITHUB_OUTPUT}"
env:
INPUT_DIFF_FILE_NAME: ${{ steps.tool-name-safe.outputs.diff-file-name }}
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
id: upload-diff
if: >-
${{ (steps.files_changed.outputs.files_changed == 'true') &&
(steps.inputs.outputs.upload-suggestions == 'true') }}
with:
name: diff
if-no-files-found: ignore
retention-days: 1
path: |
${{ steps.diff-patch.outputs.diff-file-name }}
${{ steps.inputs.outputs.extra-upload-suggestions }}
- name: Add note to summary explaining that code suggestions will be applied if it is a PR
if: >-
${{ (github.event_name == 'pull_request') &&
(steps.files_changed.outputs.files_changed == 'true') }}
shell: bash
run: |
{
echo ''
echo 'Suggestions can only be added near to lines changed in this PR.'
echo 'If any fixes can be added as code suggestions, they will be added shortly from another workflow.'
} >> "${GITHUB_STEP_SUMMARY}"
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
id: upload-changes
if: >-
${{ always() &&
(steps.inputs.outputs.upload-changes == 'true') }}
with:
name: formatted-${{ steps.tool-name-safe.outputs.tool-name }}
if-no-files-found: ignore
retention-days: 10
path: |
${{ steps.inputs.outputs.extra-upload-changes }}
${{ steps.git-changed-files.outputs.CHANGED_FILES }}
- name: Explain that more files need to be fixed
if: ${{ steps.files_changed.outputs.files_changed == 'true' }}
shell: bash
run: |
{
echo ''
echo 'All fixed files are included in the '"${FORMATTED_URL}"' artifact. This artifact can be downloaded and copied to the repository to replace unformatted files with the formatted files.'
} >> "${GITHUB_STEP_SUMMARY}"
env:
FORMATTED_URL: >-
[`formatted-${{ steps.tool-name-safe.outputs.tool-name }}`](${{
steps.upload-changes.outputs.artifact-url }})
- name: Fail action if some files were changed
if: >-
${{ (steps.files_changed.outputs.files_changed == 'true') &&
(steps.inputs.outputs.fail-if-changed == 'true') }}
shell: bash
run: |
if [[ -n "$INPUT_FAIL_MESSAGE" ]]; then
echo "::error::$INPUT_FAIL_MESSAGE"
fi
exit 1
env:
INPUT_FAIL_MESSAGE: ${{ steps.inputs.outputs.fail-message }}
Loading

0 comments on commit 5b5a791

Please sign in to comment.