From b27b3a2396ba7559ab504ec527433d9ecac9fd1a Mon Sep 17 00:00:00 2001 From: lulivi Date: Fri, 5 Jun 2020 20:21:53 +0200 Subject: [PATCH 1/6] IMPR: Move Python and Markdown lint to GH Actions - Moved Markdown and Python formatting checks to GitHub Actions to allow more configurability. - Reordered travis steps to check C/C++ files format before the static analysis (to avoid getting a format error after the long static analysis wait). - Moved back to markdownlint-cli as the Markdown linter due to it's error hints. Also now with GitHub Actions, more configurability of the environment is allowed. Related #303 --- .github/workflows/format_lint.yml | 51 +++++++++++++++++++++++++++++++ .markdownlint.json | 23 ++++++++++++++ .mdl.rb | 7 ----- .travis.yml | 21 ++++++++++--- 4 files changed, 90 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/format_lint.yml create mode 100644 .markdownlint.json delete mode 100644 .mdl.rb diff --git a/.github/workflows/format_lint.yml b/.github/workflows/format_lint.yml new file mode 100644 index 000000000..a2fcf5dd6 --- /dev/null +++ b/.github/workflows/format_lint.yml @@ -0,0 +1,51 @@ +defaults: + run: + shell: bash + +on: + push: + branches: + - master + - develop + paths: + - '**/*.md' + - '**/*.py' + + pull_request: + branches: + - master + - develop + paths: + - '**/*.md' + - '**/*.py' + +jobs: + lint-python: + runs-on: ubuntu-18.04 + name: Python code format check" + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.7 + - name: Install necessary tools + run: pip install black + - name: Perform format check + working-directory: ${{ github.workspace }} + run: black -l 79 --diff --check . + + lint-markdown: + runs-on: ubuntu-18.04 + name: Markdown documents lint + steps: + - uses: actions/checkout@v2 + - name: Set up Node + uses: actions/setup-node@v2-beta + with: + node-version: '14' + - name: Install necessary tools + run: npm install markdownlint-cli@0.23.1 + - name: Perform linting + working-directory: ${{ github.workspace }} + run: markdownlint **/*.md diff --git a/.markdownlint.json b/.markdownlint.json new file mode 100644 index 000000000..8a192495c --- /dev/null +++ b/.markdownlint.json @@ -0,0 +1,23 @@ +{ + "default": true, + "MD004": { + "style": "dash" + }, + "MD007": { + "indent": 4 + }, + "MD013": { + "code_blocks": false, + "tables": false + }, + "MD026": { + "punctuation": ".,;!?" + }, + "MD029": false, + "MD030": { + "ul_single": 1, + "ol_single": 2, + "ul_multi": 3, + "ol_multi": 2 + } +} \ No newline at end of file diff --git a/.mdl.rb b/.mdl.rb deleted file mode 100644 index 8b871b839..000000000 --- a/.mdl.rb +++ /dev/null @@ -1,7 +0,0 @@ -all -rule 'MD004', :style => :dash -rule 'MD007', :indent => 4 -rule 'MD013', :code_blocks => false, :tables => false -rule 'MD026', :punctuation => '.,;!?' -exclude_rule 'MD029' -rule 'MD030', :ul_single => 1, :ol_single => 2, :ul_multi => 3, :ol_multi => 2 diff --git a/.travis.yml b/.travis.yml index 92bd3e87c..d32d66a8d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +os: linux dist: xenial language: python python: "3.7" @@ -11,10 +12,20 @@ addons: update: true before_install: - git config --global clangFormat.binary clang-format-9 - - gem install mdl -v 0.9.0 - - pip install Sultan scan-build black + - pip install Sultan scan-build install: - - 'if [ -n "$RTI_MIN_PACKAGE_URL" ]; then resources/travis/linux_install.py; fi' + - | + if [ -n "$RTI_MIN_PACKAGE_URL" ]; then + resources/travis/linux_install.py + fi script: - - 'if [ -n "$RTI_MIN_PACKAGE_URL" ]; then resources/travis/linux_static_analysis.py; fi' - - 'if [ -n "$TRAVIS_COMMIT_RANGE" ]; then resources/travis/linux_format.py --commit-range $TRAVIS_COMMIT_RANGE ; else resources/travis/linux_format.py --commit $TRAVIS_COMMIT; fi' + - | + if [ -n "$TRAVIS_COMMIT_RANGE" ]; then + resources/travis/linux_format.py -md -py -r $TRAVIS_COMMIT_RANGE + else + resources/travis/linux_format.py -md -py -c $TRAVIS_COMMIT + fi + - | + if [ -n "$RTI_MIN_PACKAGE_URL" ]; then + resources/travis/linux_static_analysis.py + fi From adff5e25e6218650940c9a972eddd9055d218955 Mon Sep 17 00:00:00 2001 From: lulivi Date: Fri, 5 Jun 2020 20:28:49 +0200 Subject: [PATCH 2/6] Change Markdown file title to allow Action run --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 90122ed6f..c45da77f2 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# rticonnextdds-examples +# RTI ConnextDDS examples [![Build Status](https://www.travis-ci.org/rticommunity/rticonnextdds-examples.svg?branch=master)](https://www.travis-ci.org/rticommunity/rticonnextdds-examples) From 36af83ea9a08a527cf4961f29c1b2e9e9949bcdc Mon Sep 17 00:00:00 2001 From: lulivi Date: Mon, 8 Jun 2020 17:29:58 +0200 Subject: [PATCH 3/6] FIX: Change npm for npx --- .github/workflows/format_lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/format_lint.yml b/.github/workflows/format_lint.yml index a2fcf5dd6..6eba76002 100644 --- a/.github/workflows/format_lint.yml +++ b/.github/workflows/format_lint.yml @@ -48,4 +48,4 @@ jobs: run: npm install markdownlint-cli@0.23.1 - name: Perform linting working-directory: ${{ github.workspace }} - run: markdownlint **/*.md + run: npx markdownlint **/*.md From 0004b368598b615429987d39d40bb855307a344a Mon Sep 17 00:00:00 2001 From: lulivi Date: Mon, 8 Jun 2020 17:32:53 +0200 Subject: [PATCH 4/6] REV: Revert README change to trigger workflow --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c45da77f2..90122ed6f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# RTI ConnextDDS examples +# rticonnextdds-examples [![Build Status](https://www.travis-ci.org/rticommunity/rticonnextdds-examples.svg?branch=master)](https://www.travis-ci.org/rticommunity/rticonnextdds-examples) From bd59597709b750d547c940565f345e4a03edc056 Mon Sep 17 00:00:00 2001 From: lulivi Date: Mon, 8 Jun 2020 17:40:57 +0200 Subject: [PATCH 5/6] FIX: Ignore node_modules folder for markdownlint --- .github/workflows/format_lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/format_lint.yml b/.github/workflows/format_lint.yml index 6eba76002..32386e765 100644 --- a/.github/workflows/format_lint.yml +++ b/.github/workflows/format_lint.yml @@ -48,4 +48,4 @@ jobs: run: npm install markdownlint-cli@0.23.1 - name: Perform linting working-directory: ${{ github.workspace }} - run: npx markdownlint **/*.md + run: npx markdownlint --ignore node_modules **/*.md From 92a18f13843f6021ea44280e52be47cb96482a65 Mon Sep 17 00:00:00 2001 From: lulivi Date: Mon, 8 Jun 2020 17:48:55 +0200 Subject: [PATCH 6/6] FIX: Format Markdown files correctly --- .github/workflows/format_lint.yml | 2 +- examples/connext_dds/builtin_qos_profiles/README.md | 2 +- examples/connext_dds/builtin_topics/README.md | 2 +- examples/connext_dds/coherent_presentation/README.md | 5 +++-- examples/connext_dds/ordered_presentation/README.md | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/format_lint.yml b/.github/workflows/format_lint.yml index 32386e765..f591cdacc 100644 --- a/.github/workflows/format_lint.yml +++ b/.github/workflows/format_lint.yml @@ -48,4 +48,4 @@ jobs: run: npm install markdownlint-cli@0.23.1 - name: Perform linting working-directory: ${{ github.workspace }} - run: npx markdownlint --ignore node_modules **/*.md + run: npx markdownlint --ignore node_modules . diff --git a/examples/connext_dds/builtin_qos_profiles/README.md b/examples/connext_dds/builtin_qos_profiles/README.md index 931e8fbce..3467984e1 100644 --- a/examples/connext_dds/builtin_qos_profiles/README.md +++ b/examples/connext_dds/builtin_qos_profiles/README.md @@ -5,7 +5,7 @@ *RTI Connext DDS* provides *Quality of Service* (QoS) that controls the behavior of the different DDS entities, and allows you to configure the *middleware* to enable features such as monitoring. To make this process easier, RTI includes a -set of built-in QoS profiles that provide useful *functionality, such as +set of built-in QoS profiles that provide useful functionality, such as enabling monitoring or configuring *DataWriters* and *DataReaders* to be strictly reliable. diff --git a/examples/connext_dds/builtin_topics/README.md b/examples/connext_dds/builtin_topics/README.md index 18ee12e50..251acb5bd 100644 --- a/examples/connext_dds/builtin_topics/README.md +++ b/examples/connext_dds/builtin_topics/README.md @@ -5,7 +5,7 @@ *Built-in Topics* are a special kind of topics that are used by *RTI Connext *DDS* applications to discover each other. These *Topics* are handled automatically by the middleware, but in certain scenarios it is useful to -*access to them. For instance, these *Topics* allow us to access some relevant +access to them. For instance, these *Topics* allow us to access some relevant information about Connext entities, such as: - The publications and subscriptions available. diff --git a/examples/connext_dds/coherent_presentation/README.md b/examples/connext_dds/coherent_presentation/README.md index daefcd8f1..99207dc89 100644 --- a/examples/connext_dds/coherent_presentation/README.md +++ b/examples/connext_dds/coherent_presentation/README.md @@ -28,8 +28,9 @@ allows us to do this. If there are additional dependencies *across* instances, topic level scope makes these changes atomic to the reader. This shows how coherent access can be used to ensure written samples are viewed -atomically; that is, all samples sent between begin_ and end_coherent changes -will be available before the reader is notified that there are samples to read. +atomically; that is, all samples sent between begin_coherent and end_coherent +changes will be available before the reader is notified that there are samples +to read. In this example, the subscriber receives updates for six state fields, a-f. Because we request coherent access at the topic level, on_data_available is not diff --git a/examples/connext_dds/ordered_presentation/README.md b/examples/connext_dds/ordered_presentation/README.md index 4d7852eda..e55fbd0f5 100644 --- a/examples/connext_dds/ordered_presentation/README.md +++ b/examples/connext_dds/ordered_presentation/README.md @@ -60,5 +60,5 @@ Note that using instance access_scope does not guarantee that samples will be read or taken from the queue in a particular manner. Subscriber 0 returns all of Instance 0's samples, then all of Instance 1's samples. However, it would also be valid to return samples in the same order as Subscriber 1. To guarantee that -samples from the same instance are return together, use the take/read_*instance +samples from the same instance are return together, use the take/read_\*instance calls. See the on-line API for *FooDataReader* for more information.