Skip to content

Commit

Permalink
Make workflows in this repository reusable from other repositories (#…
Browse files Browse the repository at this point in the history
…1416)

* Make linter a reusable workflow
* Make lint and test with ct a resuable workflow
* Make check-codeowners part of CI workflow

Signed-off-by: György Krajcsovits <[email protected]>
  • Loading branch information
krajorama authored May 26, 2022
1 parent a0ca85f commit 4f13e08
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/check-codeowners.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Check CODEOWNERS

on: pull_request
on: workflow_call

jobs:
build:
runs-on: ubuntu-20.04
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: CI

on: pull_request

jobs:
call-check-codeowners:
uses: ./.github/workflows/check-codeowners.yaml
call-lint:
uses: ./.github/workflows/linter.yml
call-lint-test:
uses: ./.github/workflows/lint-test.yaml
20 changes: 15 additions & 5 deletions .github/workflows/lint-test.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
name: Lint and Test Charts

on: pull_request
on:
workflow_call:
inputs:
ct_configfile:
description: location of the ct config file
default: ct.yaml
required: false
type: string

env:
CT_CONFIGFILE: ${{ inputs.ct_configfile }}

jobs:
lint-test:
Expand Down Expand Up @@ -29,23 +39,23 @@ jobs:
- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --config ct.yaml)
changed=$(ct list-changed --config "${CT_CONFIGFILE}")
if [[ -n "$changed" ]]; then
echo "::set-output name=changed::true"
fi
- name: Run chart-testing (lint)
run: ct lint --config ct.yaml
run: ct lint --config "${CT_CONFIGFILE}"

- name: Create kind cluster
uses: helm/[email protected]
if: steps.list-changed.outputs.changed == 'true'

- name: Run chart-testing (install)
run: |
changed=$(ct list-changed --config ct.yaml)
changed=$(ct list-changed --config "${CT_CONFIGFILE}")
if [[ "$changed" == "charts/enterprise-metrics" ]]; then
# Do not run `ct install` for enterprise-metrics
exit 0
fi
ct install --config ct.yaml
ct install --config "${CT_CONFIGFILE}"
10 changes: 9 additions & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@ name: Lint Code Base
# Documentation:
# https://help.github.com/en/articles/workflow-syntax-for-github-actions

on: pull_request
on:
workflow_call:
inputs:
filter_regex_include:
description: this sets the scope of the super linter
default: ".*"
required: false
type: string

jobs:
build:
Expand All @@ -25,6 +32,7 @@ jobs:
uses: docker://github/super-linter:v3.12.0
env:
FILTER_REGEX_EXCLUDE: .*(README\.md|Chart\.yaml|NOTES.txt).*
FILTER_REGEX_INCLUDE: ${{ inputs.filter_regex_include }}
VALIDATE_ALL_CODEBASE: false
VALIDATE_KUBERNETES_KUBEVAL: false
VALIDATE_YAML: false
Expand Down

0 comments on commit 4f13e08

Please sign in to comment.