From 38d407e87cfb6587d89db2021f33467ca6ac75d5 Mon Sep 17 00:00:00 2001 From: biancabnd Date: Wed, 5 Apr 2023 11:16:49 +0200 Subject: [PATCH] Add workflows and linters --- .clang-format | 4 +++ .flake8 | 2 ++ .github/CODEOWNERS | 4 +++ .github/PULL_REQUEST_TEMPLATE.md | 37 +++++++++++++++++++ .github/workflows/delete_docker_image.yaml | 20 +++++++++++ .github/workflows/jira_ticket_from_issue.yml | 38 ++++++++++++++++++++ .github/workflows/test_docker_build.yaml | 33 +++++++++++++++++ .pre-commit-config.yaml | 19 ++++++++++ CPPLINT.cfg | 2 ++ 9 files changed, 159 insertions(+) create mode 100644 .clang-format create mode 100644 .flake8 create mode 100644 .github/CODEOWNERS create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/workflows/delete_docker_image.yaml create mode 100644 .github/workflows/jira_ticket_from_issue.yml create mode 100644 .github/workflows/test_docker_build.yaml create mode 100644 .pre-commit-config.yaml create mode 100644 CPPLINT.cfg diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000..60ea455b --- /dev/null +++ b/.clang-format @@ -0,0 +1,4 @@ +--- +BasedOnStyle: Google +AlwaysBreakAfterDefinitionReturnType: All +BreakBeforeBraces: Allman diff --git a/.flake8 b/.flake8 new file mode 100644 index 00000000..2bcd70e3 --- /dev/null +++ b/.flake8 @@ -0,0 +1,2 @@ +[flake8] +max-line-length = 88 diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..b819734e --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,4 @@ +# Each line is a file pattern followed by one or more owners. + +# These owners will be the default owners for everything in the repo. +* @umdlife/reviewers diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..da6919c3 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,37 @@ + + +--- + +## Basic Info + +| Info | Please fill out this column | +| ------ | ----------- | +| Ticket(s) this addresses | (add tickets here #1) | +| Primary OS tested on | (Ubuntu, MacOS, Windows) | +| Robotic platform tested on | (Steve's Robot, gazebo simulation of Tally, hardware turtlebot) | + +--- + +## Description of contribution in a few bullet points + + + +## Description of documentation updates required from your changes + + + +--- + +## Future work that may be required in bullet points + + diff --git a/.github/workflows/delete_docker_image.yaml b/.github/workflows/delete_docker_image.yaml new file mode 100644 index 00000000..460d4894 --- /dev/null +++ b/.github/workflows/delete_docker_image.yaml @@ -0,0 +1,20 @@ +name: Delete PR Docker Image + +# Controls when the workflow will run +on: + pull_request: + types: + - closed + branches: + - 'dev' +jobs: + delete-docker: + strategy: + matrix: + parent_repo: [umd_robot_essentials] + uses: umdlife/umd_workflows/.github/workflows/delete_docker.yaml@main + with: + repository: ${{ matrix.parent_repo }} + secrets: + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} diff --git a/.github/workflows/jira_ticket_from_issue.yml b/.github/workflows/jira_ticket_from_issue.yml new file mode 100644 index 00000000..83f74621 --- /dev/null +++ b/.github/workflows/jira_ticket_from_issue.yml @@ -0,0 +1,38 @@ +# Create a Jira ticket in UML Jira every time a Github issue is opened +name: Create Jira Ticket from Github Issue +on: + issues: + types: opened + +jobs: + create_jira_ticket: + runs-on: ubuntu-latest + name: Create Jira Ticket from Issue + steps: + + # Login to Jira + - name: Login + uses: atlassian/gajira-login@master + env: + JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} + JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} + JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} + + # Create ticket + - name: Create + id: create + uses: atlassian/gajira-create@master + with: + project: UP # UL-Platform + issuetype: Story + summary: | + Github Issue #${{ github.event.issue.number }} in ${{ github.repository }}: ${{ github.event.issue.title }} + description: | + Issue #${{ github.event.issue.number }} in ${{ github.repository }} (${{ github.event.issue.html_url }}) + + ${{ github.event.issue.title }}: + ${{ github.event.issue.body }} + fields: '{"customfield_10028": 0}' # Initializing Story points. Custom field can vary depending on the project/platform + + - name: Log created issue + run: echo "Issue ${{ steps.create.outputs.issue }} was created" diff --git a/.github/workflows/test_docker_build.yaml b/.github/workflows/test_docker_build.yaml new file mode 100644 index 00000000..e7e750c0 --- /dev/null +++ b/.github/workflows/test_docker_build.yaml @@ -0,0 +1,33 @@ +name: Test Docker Build + +# Controls when the workflow will run +on: + pull_request: + types: [opened, synchronize, reopened] +permissions: + contents: write + statuses: write +concurrency: + group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' + cancel-in-progress: true +jobs: + clang_format: + uses: umdlife/umd_workflows/.github/workflows/clang_format_lint.yaml@main + secrets: + PAT: ${{ secrets.UMDLIFEDEV_TOKEN }} + + rebuild_docker: + strategy: + matrix: + parent_repo: [umd_robot_essentials] + stage: [dev_stage, prod_stage] + uses: umdlife/umd_workflows/.github/workflows/rebuild_docker_dep.yaml@main + with: + repository: ${{ matrix.parent_repo }} + arch: linux/amd64 + stage: ${{ matrix.stage }} + push: true + secrets: + PAT: ${{ secrets.UMDLIFEDEV_TOKEN }} + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..c1f6b346 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,19 @@ +repos: + - repo: https://github.com/psf/black + rev: stable + hooks: + - id: black + language_version: python3.8 + - repo: https://gitlab.com/pycqa/flake8 + rev: '3.7.9' # pick a git hash / tag to point to + hooks: + - id: flake8 + - repo: https://gitlab.com/daverona/pre-commit/cpp + rev: 0.8.0 # use the most recent version + hooks: + # Hooks using native + - id: clang-format # formatter for C/C++ code based on a style guide + args: ['-style=file'] + - id: cpplint # linter (or style-error checker) for Google C++ Style Guide + - id: cppcheck # static analyzer for C/C++ code + diff --git a/CPPLINT.cfg b/CPPLINT.cfg new file mode 100644 index 00000000..ddac138c --- /dev/null +++ b/CPPLINT.cfg @@ -0,0 +1,2 @@ +linelength=88 +filter=-build/include_order,-whitespace/braces,-whitespace/newline