Skip to content

Commit

Permalink
Merge pull request #127 from xmidt-org/add-yml-checking
Browse files Browse the repository at this point in the history
Add yaml linting support to automatically be performed.
  • Loading branch information
schmidtw authored May 24, 2024
2 parents fc46838 + 4d08fe0 commit 1acfb51
Show file tree
Hide file tree
Showing 7 changed files with 124 additions and 55 deletions.
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# SPDX-FileCopyrightText: 2023 Comcast Cable Communications Management, LLC
# SPDX-License-Identifier: Apache-2.0
---

version: 2
updates:
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# SPDX-FileCopyrightText: 2024 Comcast Cable Communications Management, LLC
# SPDX-License-Identifier: Apache-2.0
---
name: 'Automatically relase patch versions.'
on:
schedule: # Run every day at 12:00 UTC
- cron: '0 12 * * *'
workflow_dispatch:
jobs:
release:
uses: ./.github/workflows/auto-releaser.yml
name: 'Automatically relase patch versions.'

on:
schedule: # Run every day at 12:00 UTC
- cron: '0 12 * * *'
workflow_dispatch:

jobs:
release:
uses: ./.github/workflows/auto-releaser.yml
4 changes: 2 additions & 2 deletions .github/workflows/auto-releaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
## SPDX-License-Identifier: Apache-2.0
#---
#name: 'Automatically relase patch versions.'
#
#
# on:
# schedule: # Run every day at 12:00 UTC
# - cron: '0 12 * * *'
# workflow_dispatch:
#
#
# jobs:
# release:
# uses: xmidt-org/shared-go/.github/workflows/ci.yml@826aa545bb56f6c7c551d44febb420c0293c8bff # v4.2.0
Expand Down
67 changes: 51 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2022-2023 Comcast Cable Communications Management, LLC
# SPDX-FileCopyrightText: 2022-2024 Comcast Cable Communications Management, LLC
# SPDX-FileCopyrightText: 2022 Weston Schmidt <weston_schmidt@alumni.purdue.edu>
# SPDX-License-Identifier: Apache-2.0
# Copied from github.com/goschtalt/.github
Expand Down Expand Up @@ -50,7 +50,9 @@ on:
type: boolean
default: true
go-generate-deps:
description: "The line sparated list of go generate dependencies to install via `go install` prior to running `go generate`."
description: |
The line sparated list of go generate dependencies to install via
`go install` prior to running `go generate`.
required: false
type: string
default: ''
Expand Down Expand Up @@ -143,12 +145,16 @@ on:
default: false

release-docker-extras:
description: "Provides a way to set the `extra_files` field with the list of files/dirs to make available."
description: |
Provides a way to set the `extra_files` field with the list of
files/dirs to make available.
required: false
type: string

release-docker-file:
description: "Set to the docker file and path if you don't want the default of `Dockerfile` in the project root."
description: |
Set to the docker file and path if you don't want the default of
`Dockerfile` in the project root.
required: false
type: string
default: 'Dockerfile'
Expand All @@ -160,7 +166,9 @@ on:
default: false

release-docker-major:
description: "If set to true, release this container as the latest for the major version."
description: |
If set to true, release this container as the latest for
the major version.
required: false
type: boolean
default: false
Expand Down Expand Up @@ -189,6 +197,12 @@ on:
type: boolean
default: true

release-skip:
description: 'Skip releasing the program.'
required: false
type: boolean
default: false

release-skip-publish:
description: "Set to --skip-publish to skip publishing."
required: false
Expand All @@ -201,13 +215,17 @@ on:
type: string

release-with-extra-contents:
description: "The list of any extra files to include in the packaged releases. See goreleaser nfpm contents for examples."
description: |
The list of any extra files to include in the packaged releases. See
goreleaser nfpm contents for examples.
required: false
type: string
default: ''

release-with-unique-user:
description: "If set to true will add a user and group with the same name as the program. Otherwise root is assumed."
description: |
If set to true will add a user and group with the same name as the
program. Otherwise root is assumed.
required: false
type: string
default: "true"
Expand All @@ -231,7 +249,9 @@ on:

# Unit test focused
tests-race:
description: 'If set to "true" (default), race condition checking will be performed during unit tests. Otherwise no race condition checking will be done.'
description: |
If set to "true" (default), race condition checking will be performed
during unit tests. Otherwise no race condition checking will be done.
required: false
type: boolean
default: true
Expand All @@ -241,12 +261,20 @@ on:
type: boolean
default: false

# Artifact uploading focused
upload-skip:
description: 'Skip uploading the artifacts.'
required: false
type: boolean
default: false

# YML linting focused
yaml-lint-skip:
description: 'Skip linting yaml files.'
required: false
type: boolean
default: false

jobs:


Expand Down Expand Up @@ -426,7 +454,6 @@ jobs:
retention-days: 10



golint:
runs-on: [ ubuntu-latest ]
name: Go Lint
Expand Down Expand Up @@ -467,14 +494,21 @@ jobs:
version: ${{ inputs.lint-version }}
working-directory: ${{ inputs.working-directory }}
args: --timeout ${{ inputs.lint-timeout }}
skip-pkg-cache: true
skip-build-cache: true
skip-cache: true

ymllint:
runs-on: [ ubuntu-latest ]
if: inputs.yaml-lint-skip == false
steps:
- name: Checkout the code
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- uses: ibiqlik/action-yamllint@2576378a8e339169678f9939646ee3ee325e845c # v3.1.1

copyright:
runs-on: [ ubuntu-latest ]
if: inputs.copyright-skip == false
steps:
steps:
- name: Checkout the code
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

Expand Down Expand Up @@ -506,8 +540,8 @@ jobs:
- name: Setup licensed
uses: jonabc/setup-licensed@d6b3a6f7058c2b40c06d205e13e15c2418977566 # v1.1.4
with:
version: 4.x
github_token: ${{ secrets.GITHUB_TOKEN }}
version: 4.x
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Fetch Org Approved Licenses & merge to local
shell: bash
Expand Down Expand Up @@ -562,7 +596,7 @@ jobs:
packages: write

name: Release
needs: [ build_program, unit_test, style, golint, license, copyright ]
needs: [ build_program, unit_test, style, golint, license, copyright, ymllint ]
if: |
always() &&
inputs.release-skip == false &&
Expand All @@ -571,6 +605,7 @@ jobs:
needs.unit_test.result != 'failure' &&
needs.style.result != 'failure' &&
needs.golint.result != 'failure' &&
needs.ymllint.result != 'failure' &&
needs.copyright.result != 'failure' &&
needs.license.result != 'failure'
runs-on: [ ubuntu-latest ]
Expand Down Expand Up @@ -852,7 +887,7 @@ jobs:
if [[ "${{ inputs.license }}" != "" ]]; then
echo "LICENSE='${{ inputs.license }}'" >> $GITHUB_ENV
fi
- name: Generate the rpm generation section
if: |
inputs.release-custom-file == false &&
Expand Down
52 changes: 26 additions & 26 deletions .github/workflows/cleanup-tags.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
# SPDX-FileCopyrightText: 2024 Comcast Cable Communications Management, LLC
# SPDX-License-Identifier: Apache-2.0
---
name: 'Cleanup testing tags.'
on:
schedule:
- cron: '52 1 * * 1' # Monday at 1:52am UTC clean everything up
workflow_dispatch:
jobs:
remove-tags:
runs-on: [ ubuntu-latest ]
steps:
- name: Checkout the code
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
fetch-depth: 0
token: ${{ secrets.PUSH_TAG_TOKEN }}
- name: Search for v1.x.x or v2.x.x tags to remove
shell: bash
run: |
mapfile -t tags< <(git tag | grep "v[12]\.")
for tag in "${tags[@]}"; do
echo "Removing $tag"
git tag -d $tag
git push origin :refs/tags/$tag
done
name: 'Cleanup testing tags.'

on:
schedule:
- cron: '52 1 * * 1' # Monday at 1:52am UTC clean everything up
workflow_dispatch:

jobs:
remove-tags:
runs-on: [ ubuntu-latest ]
steps:
- name: Checkout the code
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
fetch-depth: 0
token: ${{ secrets.PUSH_TAG_TOKEN }}

- name: Search for v1.x.x or v2.x.x tags to remove
shell: bash
run: |
mapfile -t tags< <(git tag | grep "v[12]\.")
for tag in "${tags[@]}"; do
echo "Removing $tag"
git tag -d $tag
git push origin :refs/tags/$tag
done
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ jobs:
secrets: inherit

tag:
needs:
needs:
- command
- program
- library
Expand Down
33 changes: 33 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# SPDX-FileCopyrightText: 2024 Comcast Cable Communications Management, LLC
# SPDX-License-Identifier: Apache-2.0
---

extends: default

rules:
braces:
level: warning
max-spaces-inside: 1
brackets:
level: warning
max-spaces-inside: 1
colons:
level: warning
max-spaces-after: -1
commas:
level: warning
comments: disable
comments-indentation: disable
document-start: disable
empty-lines:
level: warning
hyphens:
level: warning
indentation:
level: error
indent-sequences: consistent
line-length:
level: warning
max: 110
allow-non-breakable-inline-mappings: true
truthy: disable

0 comments on commit 1acfb51

Please sign in to comment.