-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial CI an ifindex metadata tool
Signed-off-by: Ed Warnicke <[email protected]>
- Loading branch information
1 parent
a41fcfc
commit 9d384da
Showing
14 changed files
with
1,270 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
## Copyright headers for source code | ||
This folder contains the copyright templates for source files of NSM project. | ||
|
||
Below is an example of valid copyright header for `.go` files: | ||
``` | ||
// Copyright (c) 2020 Doc.ai and/or its affiliates. | ||
// | ||
// Copyright (c) 2020 Cisco and/or its affiliates. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at: | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
``` | ||
Note you can use your company name instead of `Cisco and/or its affiliates`. | ||
Also, source code files can have multi copyright holders, for example: | ||
``` | ||
// Copyright (c) 2020 Doc.ai and/or its affiliates. | ||
// | ||
// Copyright (c) 2020 Cisco and/or its affiliates. | ||
// | ||
// Copyright (c) 2020 Red Hat Inc. and/or its affiliates. | ||
// | ||
// Copyright (c) 2020 VMware, Inc. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at: | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
``` |
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,13 @@ | ||
{{copyright-holders}}SPDX-License-Identifier: Apache-2.0 | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at: | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
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,13 @@ | ||
--- | ||
extends: default | ||
|
||
yaml-files: | ||
- '*.yaml' | ||
- '*.yml' | ||
|
||
rules: | ||
truthy: disable | ||
# 80 chars should be enough, but don't fail if a line is longer | ||
line-length: disable | ||
comments-indentation: | ||
ignore: .circleci/config.yml |
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,136 @@ | ||
--- | ||
name: ci | ||
on: pull_request | ||
jobs: | ||
yamllint: | ||
name: yamllint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
- name: Setup Python | ||
uses: actions/setup-python@v1 | ||
- name: Install yamllint | ||
run: pip install --user yamllint | ||
- name: Run yamllint | ||
run: ~/.local/bin/yamllint -c .ci/yamllint.yml --strict . | ||
build-and-test: | ||
name: build and test | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
- name: Setup Go | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.13.4 | ||
- name: Build | ||
run: go build -race ./... | ||
- name: Test | ||
run: go test -race ./... | ||
golangci-lint: | ||
name: golangci-lint | ||
runs-on: ubuntu-latest | ||
env: | ||
GOLANGCI_LINT_CONTAINER: golangci/golangci-lint:v1.23.2 | ||
steps: | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
- name: Pull golangci-lint docker container | ||
run: docker pull ${GOLANGCI_LINT_CONTAINER} | ||
- name: Run golangci-lint | ||
run: docker run --rm -v $(pwd):/app -w /app ${GOLANGCI_LINT_CONTAINER} golangci-lint run | ||
|
||
excludeFmtErrorf: | ||
name: exclude fmt.Errorf | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Exclude fmt.Errorf | ||
run: | | ||
if grep -r --include=*.go fmt.Errorf . ; then | ||
echo "Please use errors.Errorf (or errors.New or errors.Wrap or errors.Wrapf) as appropriate rather than fmt.Errorf" | ||
exit 1 | ||
fi | ||
restrictNSMDeps: | ||
name: Restrict dependencies on github.com/networkservicemesh/* | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Restrict dependencies on github.com/networkservicemesh/* | ||
run: | | ||
for i in $(grep github.com/networkservicemesh/ go.mod |grep -v '^module' | sed 's;.*\(github.com\/networkservicemesh\/[a-zA-z\/]*\).*;\1;g' | sort -u);do | ||
if [ "${i}" != "github.com/networkservicemesh/sdk" ] && [ "${i}" != "github.com/networkservicemesh/api" ]; then | ||
echo Dependency on "${i}" is forbidden | ||
exit 1 | ||
fi | ||
done | ||
checkgomod: | ||
name: check go.mod and go.sum | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.13 | ||
- run: go mod tidy | ||
- name: Check for changes in go.mod or go.sum | ||
run: | | ||
git diff --name-only --exit-code go.mod || ( echo "Run go tidy" && false ) | ||
git diff --name-only --exit-code go.sum || ( echo "Run go tidy" && false ) | ||
license: | ||
name: license header check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.13 | ||
- name: Install go-header | ||
run: 'go get github.com/denis-tingajkin/[email protected]' | ||
- name: Run go-header | ||
run: | | ||
eval $(go env) | ||
${GOPATH}/bin/go-header | ||
excludereplace: | ||
name: Exclude replace in go.mod | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the code | ||
uses: actions/checkout@v2 | ||
- name: Exclude replace in go.mod | ||
run: | | ||
grep -v 'replace github.com/satori/go.uuid' go.mod | grep ^replace || exit 0 | ||
exit 1 | ||
captureRunEnv: | ||
name: Capture CI Run Env | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: printenv | ||
automerge: | ||
name: automerge | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build-and-test | ||
if: github.actor == 'nsmbot' && github.base_ref == 'master' && github.event_name == 'pull_request' | ||
steps: | ||
- name: Check out the code | ||
uses: actions/checkout@v2 | ||
- name: Fetch master | ||
run: | | ||
git remote -v | ||
git fetch --depth=1 origin master | ||
- name: Only allow go.mod and go.sum changes | ||
run: | | ||
find . -type f ! -name 'go.mod' ! -name 'go.sum' -exec git diff --exit-code origin/master -- {} + | ||
- name: Automerge nsmbot PR | ||
uses: ridedott/merge-me-action@master | ||
with: | ||
GITHUB_LOGIN: nsmbot | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
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,72 @@ | ||
--- | ||
# For most projects, this workflow file will not need changing; you simply need | ||
# to commit it to your repository. | ||
# | ||
# You may wish to alter this file to override the set of languages analyzed, | ||
# or to provide custom queries or build logic. | ||
name: "CodeQL" | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: [master] | ||
schedule: | ||
- cron: '0 5 * * 0' | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
# Override automatic language detection by changing the below list | ||
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python'] | ||
language: ['go'] | ||
# Learn more... | ||
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
with: | ||
# We must fetch at least the immediate parents so that if this is | ||
# a pull request then we can checkout the head. | ||
fetch-depth: 2 | ||
|
||
# If this run was triggered by a pull request event, then checkout | ||
# the head of the pull request instead of the merge commit. | ||
- run: git checkout HEAD^2 | ||
if: ${{ github.event_name == 'pull_request' }} | ||
|
||
# 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 | ||
|
||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java). | ||
# If this step fails, then you should remove it and run the build manually (see below) | ||
- name: Autobuild | ||
uses: github/codeql-action/autobuild@v1 | ||
|
||
# ℹ️ Command-line programs to run using the OS shell. | ||
# 📚 https://git.io/JvXDl | ||
|
||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines | ||
# and modify them (or add more) to build your code if your project | ||
# uses a compiled language | ||
|
||
# - run: | | ||
# make bootstrap | ||
# make release | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v1 |
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,23 @@ | ||
--- | ||
name: Pull Request on update/* Branch Push | ||
on: | ||
push: | ||
branches: | ||
- update/** | ||
jobs: | ||
auto-pull-request: | ||
name: Pull Request on update/* Branch Push | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Construct PR message | ||
run: | | ||
PULL_REQUEST_BODY=$(git log -1) | ||
echo ${PULL_REQUEST_BODY} | ||
echo "::set-env name=PULL_REQUEST_BODY::${PULL_REQUEST_BODY}" | ||
- name: pull-request-action | ||
uses: vsoch/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.NSM_BOT_GITHUB_TOKEN }} | ||
BRANCH_PREFIX: "update/" | ||
PULL_REQUEST_BRANCH: "master" |
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,17 @@ | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
|
||
.idea/ |
Oops, something went wrong.