-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from sebhmg/GEOPY-1162
GEOPY-1162: review dependencies and CI script in las-geoh5
- Loading branch information
Showing
12 changed files
with
183 additions
and
80 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -9,3 +9,4 @@ updates: | |
directory: "/" | ||
schedule: | ||
interval: "monthly" | ||
target-branch: "develop" |
This file contains 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,36 @@ | ||
# This workflow will create a JIRA issue upon creation of a GitHub issue | ||
|
||
name: Create JIRA issue | ||
|
||
on: | ||
issues: | ||
types: [opened] | ||
|
||
jobs: | ||
new_jira_issue: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: JIRA Login | ||
uses: atlassian/[email protected] | ||
env: | ||
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} | ||
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} | ||
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} | ||
- name: Jira Create issue | ||
id: create_jira_issue | ||
uses: atlassian/[email protected] | ||
with: | ||
project: GEOPY | ||
issuetype: Story | ||
summary: ${{ github.event.issue.title }} | ||
description: "_from [GitHub issue #${{ github.event.issue.number }}|${{ github.event.issue.html_url }}]_" | ||
# Additional fields in JSON format | ||
fields: '{"components": [{"name": "LAS"}]}' | ||
- name: Post JIRA link | ||
uses: peter-evans/create-or-update-comment@v3 | ||
with: | ||
# The number of the issue or pull request in which to create a comment. | ||
issue-number: ${{ github.event.issue.number }} | ||
# The comment body. | ||
body: "JIRA issue [${{ steps.create_jira_issue.outputs.issue }}] was created." |
This file contains 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,50 @@ | ||
# This workflow will comment the PR with the JIRA issue summary | ||
# if a JIRA issue number is detected in the branch name or title | ||
|
||
name: Add JIRA issue summary | ||
|
||
on: | ||
pull_request_target: | ||
types: [opened] | ||
|
||
jobs: | ||
add_jira_summary: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Find JIRA issue key | ||
id: find_jira_key | ||
env: | ||
HEAD_REF: ${{ github.head_ref}} | ||
PR_TITLE: ${{ github.event.pull_request.title }} | ||
run: > | ||
echo $HEAD_REF $PR_TITLE | ||
| echo "issue_key=$(grep -os "\b\(GA\|GEOPY\)-[0-9]\+" | head -n1)" >> $GITHUB_OUTPUT | ||
- name: Get JIRA summary | ||
id: get_jira_summary | ||
if: ${{ steps.find_jira_key.outputs.issue_key }} | ||
env: | ||
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} | ||
JIRA_BASIC_AUTH: ${{ secrets.JIRA_BASIC_AUTH }} | ||
run: > | ||
curl -sS -X GET | ||
-H "Authorization: Basic $JIRA_BASIC_AUTH" | ||
-H "Content-Type: application/json" | ||
"$JIRA_BASE_URL/rest/api/2/issue/${{ steps.find_jira_key.outputs.issue_key }}" | ||
| echo "summary=$(jq -r '.fields.summary')" >> $GITHUB_OUTPUT | ||
- name: Add comment | ||
if: ${{ steps.find_jira_key.outputs.issue_key }} | ||
env: | ||
ISSUE_SUMMARY: ${{ steps.get_jira_summary.outputs.summary }} | ||
PR_BODY: ${{ github.event.pull_request.body }} | ||
run: > | ||
jq | ||
--arg ISSUE_ID "${{ steps.find_jira_key.outputs.issue_key }}" | ||
--arg ISSUE_SUMMARY "$(cat <<< $ISSUE_SUMMARY)" | ||
--arg PR_BODY "$(cat <<< $PR_BODY)" | ||
-c '."body"="**" + $ISSUE_ID + " - " + $ISSUE_SUMMARY + "**\n" + $PR_BODY' <<< {} | ||
| curl -sS -X POST -d @- | ||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" | ||
-H "Content-Type: application/json" | ||
"$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/pulls/${{ github.event.pull_request.number }}" | ||
> /dev/null |
This file contains 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 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 |
---|---|---|
|
@@ -24,34 +24,6 @@ env: | |
source_dir: las_geoh5 | ||
|
||
jobs: | ||
pre-commit: | ||
name: pre-commit | ||
strategy: | ||
fail-fast: false | ||
runs-on: ubuntu-latest | ||
env: | ||
SKIP: pylint | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v4 | ||
- name: capture modified files | ||
if: github.event_name == 'pull_request' | ||
run: >- | ||
git fetch --deepen=500 origin ${{github.base_ref}} | ||
&& echo "FILES_PARAM=$( | ||
git diff --diff-filter=AM --name-only refs/remotes/origin/${{github.base_ref}}... -- | grep -E "^(${source_dir}|tests)/.*\.py$" | xargs | ||
)" >> $GITHUB_ENV | ||
- name: Run pre-commit on modified files | ||
if: github.event_name == 'pull_request' && env.FILES_PARAM | ||
uses: pre-commit/[email protected] | ||
with: | ||
extra_args: --hook-stage push --files ${{ env.FILES_PARAM }} | ||
- name: Run pre-commit on all files | ||
if: github.event_name == 'push' | ||
uses: pre-commit/[email protected] | ||
with: | ||
extra_args: --hook-stage push --all-files | ||
|
||
pylint: | ||
name: pylint | ||
runs-on: ubuntu-latest | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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,10 @@ | ||
- name: No import os.path | ||
pattern: 'from os import\b.*\bpath\b' | ||
hint: Use from pathlib import Path | ||
filePattern: .*\.pyi? | ||
error: false | ||
- name: No os.path | ||
pattern: '\bos\.path\b' | ||
hint: Use pathlib.Path | ||
filePattern: .*\.pyi? | ||
error: false |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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 @@ | ||
# Copyright (c) 2023 Mira Geoscience Ltd. | ||
# | ||
# This file is part of las_geoh5 project. | ||
# | ||
# All rights reserved. | ||
|
||
from __future__ import annotations | ||
|
||
from pathlib import Path | ||
|
||
import pytest | ||
import tomli as toml | ||
|
||
|
||
@pytest.fixture | ||
def pyproject() -> dict: | ||
"""Return the pyproject.toml as a dictionary.""" | ||
|
||
pyproject_path = Path(__file__).resolve().parents[1] / "pyproject.toml" | ||
with open(pyproject_path, "rb") as pyproject_file: | ||
return toml.load(pyproject_file) |
This file contains 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