Skip to content

Commit

Permalink
fix(lint): Linting workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
GoetzGoerisch committed Mar 23, 2022
1 parent a138439 commit 769938a
Show file tree
Hide file tree
Showing 10 changed files with 138 additions and 57 deletions.
10 changes: 5 additions & 5 deletions .github/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# MIT License
#
#
# Copyright 2020-2021 (c) Christian von Arnim, ISW University of Stuttgart (for umati and VDW e.V.)
# Copyright 2021 (c) Götz Görisch, VDW - Verein Deutscher Werkzeugmaschinenfabriken e.V.
# Copyright 2021 (c) Dennis Hezel, 3Yourmind GmbH
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
Expand Down Expand Up @@ -61,8 +61,8 @@ externalproject_add(
open62541External
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../deps/open62541
CMAKE_ARGS -DUA_ENABLE_SUBSCRIPTIONS_ALARMS_CONDITIONS:BOOL=ON -DUA_ENABLE_SUBSCRIPTIONS_EVENTS:BOOL=ON
-DUA_NAMESPACE_ZERO:STRING=FULL -DUA_ENABLE_ENCRYPTION:STRING=LIBRESSL -DLIBRESSL_ROOT_DIR:PATH=${CMAKE_INSTALL_PREFIX}
-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
-DUA_NAMESPACE_ZERO:STRING=FULL -DUA_ENABLE_ENCRYPTION:STRING=LIBRESSL
-DLIBRESSL_ROOT_DIR:PATH=${CMAKE_INSTALL_PREFIX} -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
INSTALL_DIR "${CMAKE_INSTALL_PREFIX}"
DEPENDS libreSSLExternal
)
Expand Down
59 changes: 59 additions & 0 deletions .github/linters/.yaml-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
###########################################
# These are the rules used for #
# linting all the yaml files in the stack #
# NOTE: #
# You can disable line with: #
# # yamllint disable-line #
###########################################
rules:
braces:
level: warning
min-spaces-inside: 0
max-spaces-inside: 0
min-spaces-inside-empty: 1
max-spaces-inside-empty: 5
brackets:
level: warning
min-spaces-inside: 0
max-spaces-inside: 0
min-spaces-inside-empty: 1
max-spaces-inside-empty: 5
colons:
level: warning
max-spaces-before: 0
max-spaces-after: 1
commas:
level: warning
max-spaces-before: 0
min-spaces-after: 1
max-spaces-after: 1
comments: disable
comments-indentation: disable
document-end: disable
document-start:
level: warning
present: true
empty-lines:
level: warning
max: 2
max-start: 0
max-end: 0
hyphens:
level: warning
max-spaces-after: 1
indentation:
level: warning
spaces: consistent
indent-sequences: true
check-multi-line-strings: false
key-duplicates: enable
line-length:
level: warning
max: 80
allow-non-breakable-words: true
allow-non-breakable-inline-mappings: true
new-line-at-end-of-file: disable
new-lines:
type: unix
trailing-spaces: disable
19 changes: 13 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: Build
---
# Automatic building in CI

on: [push, pull_request]
name: "Matrix Build"

on:
push:
pull_request:
branches: [main, develop]

jobs:
build:
Expand Down Expand Up @@ -43,13 +49,14 @@ jobs:
- name: Test Sample-Server
run: |
cd build/SampleServer-build/
ctest --output-on-failure ${{env.ARG_CTEST}}
ctest --output-on-failure ${{ env.ARG_CTEST }}
docker:
runs-on: ubuntu-20.04
env:
# Check if this is not a pull request and GITHUB_TOKEN is set
# As all env variables are strings, you need to compaire against "== 'true'" (not "== true")
# Check if this is not a pull request andGITHUB_TOKEN is set
# As all env variables are strings, you need to compare
# against "== 'true'" (not "== true")
IS_NOT_PR: "${{ !github.head_ref && true }}"
steps:
- name: Checkout Sample-Server
Expand All @@ -62,7 +69,7 @@ jobs:
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: PrepareReg Names
run: |
run: |
echo IMAGE_REPOSITORY="$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV"
echo IMAGE_TAG="$(echo "${{ github.ref }}" | tr '[:upper:]' '[:lower:]' | awk '{sub(/([^\/]*\/){2}/,""); gsub(/\/|_/, "-")}1')" >> "$GITHUB_ENV"
echo IS_NOT_PR="${{ env.IS_NOT_PR }})"
Expand Down
54 changes: 29 additions & 25 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
Expand All @@ -13,10 +14,10 @@ name: "CodeQL"

on:
push:
branches: [ main, develop ]
branches: [main, develop]
pull_request:
# The branches below must be a subset of the branches above
branches: [ develop ]
branches: [develop]
schedule:
- cron: '0 3 * * 1'

Expand All @@ -30,32 +31,35 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'cpp', 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
language: ['cpp', 'python']
# CodeQL supports ['cpp','csharp','go','java','javascript','python']
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout Sample-Server
uses: actions/checkout@v3
with:
submodules: recursive
- name: Checkout Sample-Server
uses: actions/checkout@v3
with:
submodules: recursive

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or
# in a config file. By default, queries listed here will override
# any specified in a config file.
# Prefix the list here with "+" to use these queries and those in
# the config file. queries: ./path/to/local/query,
# your-org/your-repo/queries@main

- name: Build server with dependencies
run: |
mkdir -p build
cd build
cmake ../.github/ -DCMAKE_INSTALL_PREFIX:PATH="${{ env.CMAKE_INSTALL_PREFIX }}"
cmake --build .
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Build server with dependencies
run: |
mkdir -p build
cd build
cmake ../.github/ \
-DCMAKE_INSTALL_PREFIX:PATH="${{ env.CMAKE_INSTALL_PREFIX }}"
cmake --build .
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
7 changes: 5 additions & 2 deletions .github/workflows/delete-images.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
name: Clean up docker images
on:
workflow_dispatch:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 0 1 * *'
- cron: '0 0 1 * *'

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04

steps:
- uses: actions/github-script@v6
Expand All @@ -18,12 +19,14 @@ jobs:
with:
github-token: ${{ secrets.DELETE_PACKAGES_TOKEN }}
script: |
# yamllint disable-line
const response = await github.request("GET /orgs/${{ github.repository_owner }}/packages/container/${{ env.PACKAGE_NAME }}/versions",
{ per_page: ${{ env.PER_PAGE }}
});
for(version of response.data) {
if (version.metadata.container.tags.length == 0) {
console.log("delete " + version.id)
# yamllint disable-line
const deleteResponse = await github.request("DELETE /orgs/${{ github.repository_owner }}/packages/container/${{ env.PACKAGE_NAME }}/versions/" + version.id, { });
console.log("status " + deleteResponse.status)
}
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ name: Lint Code Base
#############################
on:
push:
branches-ignore: []
pull_request:
branches: [main, develop]

Expand All @@ -28,7 +27,7 @@ jobs:
# Name the Job
name: Lint Code Base (super-linter)
# Set the agent to run on
runs-on: ubuntu-latest
runs-on: ubuntu-20.04

##################
# Load all steps #
Expand All @@ -40,7 +39,8 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v3
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
# Full git history is needed to get a proper list
# of changed files within `super-linter`
fetch-depth: 0

################################
Expand All @@ -57,11 +57,11 @@ jobs:
# CMake Format
cmake-format-linter:
name: Lint Code Base (cmake-format-lint)
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Format CMake files
id: cmake-format
uses: PuneetMatharu/[email protected]
with:
args: --config-files cmake-format.yaml
- uses: actions/checkout@v3
- name: Format CMake files
id: cmake-format
uses: PuneetMatharu/[email protected]
with:
args: --config-files cmake-format.yaml
5 changes: 4 additions & 1 deletion .github/workflows/rebase.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
---
name: Automatic Rebase
on:
issue_comment:
types: [created]
jobs:
rebase:
name: Rebase
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase') && github.event.comment.author_association == 'MEMBER'
if: github.event.issue.pull_request != '' &&
contains(github.event.comment.body, '/rebase') &&
github.event.comment.author_association == 'MEMBER'
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
Expand Down
13 changes: 9 additions & 4 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# MIT License
#
# Copyright 2018 (c) TypeFox GmbH
Expand Down Expand Up @@ -26,7 +27,8 @@ image:

tasks:
- init: bash ./initialbuild.sh

command: npm install opcua-commander -g

github:
prebuilds:
# enable for the master/default branch (defaults to true)
Expand All @@ -39,9 +41,12 @@ github:
pullRequestsFromForks: true
# add a check to pull requests (defaults to true)
addCheck: true
# add a "Review in Gitpod" button as a comment to pull requests (defaults to false)
# add a "Review in Gitpod" button as a comment to pull requests
# (defaults to false)
addComment: true
# add a "Review in Gitpod" button to the pull request's description (defaults to false)
# add a "Review in Gitpod" button to the pull request's description
# (defaults to false)
addBadge: false
# add a label once the prebuild is ready to pull requests (defaults to false)
# add a label once the prebuild is ready to pull requests
# (defaults to false)
addLabel: false
7 changes: 3 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# MIT License
#
#
# Copyright 2020-2021 (c) Christian von Arnim, ISW University of Stuttgart (for umati and VDW e.V.)
# Copyright 2021 (c) Götz Görisch, VDW - Verein Deutscher Werkzeugmaschinenfabriken e.V.
# Copyright 2021 (c) Dennis Hezel, 3Yourmind GmbH
# Copyright 2021 (c) Hermann Leinweber, basysKom GmbH
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
Expand All @@ -23,7 +23,6 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.


cmake_minimum_required(VERSION 3.15)
project(SampleServer VERSION 0.3)

Expand Down
1 change: 1 addition & 0 deletions UmatiServerLib/Instantiation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ void InstantiateOptional(BINDABLEMEMBER_T<T> &memberPar, UA_Server *pServer, Nod
if (member.ParentNodeId.NodeId == nullptr || UA_NodeId_isNull(member.MemberInTypeNodeId.NodeId)) {
throw std::runtime_error("Parent not bind.");
}

// Initialize nodeid, so memory is allocated and the resulting nodeid can be written into it.
member.NodeId = open62541Cpp::UA_NodeId((UA_UInt16)0, 0);
auto browseName = readBrowseName(pServer, member.MemberInTypeNodeId);
Expand Down

0 comments on commit 769938a

Please sign in to comment.