Skip to content

Commit

Permalink
Merge branch 'main' into test-pr-tnf-secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
shirmoran authored Oct 25, 2023
2 parents 4fdf90e + 88d57b5 commit 56d7224
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 70 deletions.
2 changes: 2 additions & 0 deletions .checkmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[maxbodylength]
disabled = true
103 changes: 34 additions & 69 deletions .github/workflows/pre-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,8 @@ env:

jobs:
lint:
name: Run Linter and Vet
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, macos-latest]
name: Run Linters and Vet
runs-on: ubuntu-latest
env:
SHELL: /bin/bash

Expand Down Expand Up @@ -64,79 +61,47 @@ jobs:
- name: Install golangci-lint
run: make install-lint

- name: Install checkmake (Linux)
run: curl --location --output $CM_BIN --silent $CM_URL_LINUX
if: runner.os == 'Linux'

- name: Install checkmake (MacOS)
run: brew install checkmake
if: runner.os == 'macOS'

- run: chmod +x $CM_BIN
if: runner.os == 'Linux'

- name: Install hadolint (Linux)
run: |
curl \
--location \
--output /usr/local/bin/hadolint \
https://github.com/hadolint/hadolint/releases/download/v2.12.0/hadolint-Linux-x86_64
chmod +x /usr/local/bin/hadolint
if: runner.os == 'Linux'

- name: Install hadolint (MacOS)
- name: Install checkmake
run: |
brew install hadolint
if: runner.os == 'macOS'

- name: Install shfmt (Linux)
run: make install-shfmt
if: runner.os == 'Linux'
curl --location --output $CM_BIN --silent $CM_URL_LINUX
chmod +x $CM_BIN
- name: Install shfmt (MacOS)
run: brew install shfmt
if: runner.os == 'macOS'
- name: Install Shfmt
uses: mfinelli/setup-shfmt@v3

- name: make lint
run: make lint
- name: Checkmake
run: checkmake --config=.checkmake Makefile

- name: make vet
run: make vet
action-linters:
name: Checkmake, hadolint, markdownlint, shellcheck, shfmt, typos, yamllint
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- run: |
curl --location --output $CM_BIN --silent $CM_URL_LINUX
chmod +x $CM_BIN
$CM_BIN Makefile
- uses: hadolint/[email protected]
- name: Hadolint
uses: hadolint/[email protected]
with:
dockerfile: Dockerfile
recursive: true
- uses: nosborn/[email protected]

- name: Shfmt
run: shfmt -d *.sh script

- name: markdownlint
uses: nosborn/[email protected]
with:
files: .
ignore_files: cmd/tnf/generate/catalog/{INTRO,TEST_CASE_CATALOG}.md
- uses: ludeeus/action-shellcheck@master
- uses: mfinelli/setup-shfmt@v3
- run: shfmt -d *.sh script
- uses: crate-ci/typos@master
- uses: ibiqlik/action-yamllint@v3
with:
config_data: |
extends: default
rules:
line-length:
max: 180
level: warning
trailing-spaces:
level: warning
brackets:
level: warning
empty-lines:
level: warning

- name: ShellCheck
uses: ludeeus/action-shellcheck@master

- name: Typos
uses: crate-ci/typos@master

- name: Yamllint
uses: ibiqlik/action-yamllint@v3
with:
config_file: .yamllint.yml

- name: Golangci-lint
run: golangci-lint run --timeout 10m0s

- name: make vet
run: make vet
unit-tests:
name: Run Unit Tests
runs-on: ${{ matrix.os }}
Expand Down
12 changes: 12 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
extends: default
rules:
line-length:
max: 180
level: warning
trailing-spaces:
level: warning
brackets:
level: warning
empty-lines:
level: warning
no_warnings: true
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ LINKER_TNF_RELEASE_FLAGS+= -X github.com/test-network-function/cnf-certification
LINKER_TNF_RELEASE_FLAGS+= -X github.com/test-network-function/cnf-certification-test/cnf-certification-test.GitPreviousRelease=${GIT_PREVIOUS_RELEASE}
LINKER_TNF_RELEASE_FLAGS+= -X github.com/test-network-function/cnf-certification-test/cnf-certification-test.ClaimFormatVersion=${CLAIM_FORMAT_VERSION}
PARSER_RELEASE=$(shell jq .parserTag version.json)
BASH_SCRIPTS=$(shell find -name "*.sh" -not -path "./.git/*")

all: build

Expand All @@ -77,10 +78,14 @@ clean:

# Runs configured linters
lint:
checkmake Makefile
checkmake --config=.checkmake Makefile
golangci-lint run --timeout 10m0s
hadolint Dockerfile
shfmt -d *.sh script
typos
markdownlint '**/*.md'
yamllint --no-warnings .
shellcheck --format=gcc ${BASH_SCRIPTS}

# Builds and runs unit tests
test: coverage-qe
Expand Down

0 comments on commit 56d7224

Please sign in to comment.