Skip to content

Commit

Permalink
add ci
Browse files Browse the repository at this point in the history
Signed-off-by: fengshunli <[email protected]>
  • Loading branch information
fengshunli committed Apr 15, 2024
1 parent 8fdc440 commit d07b337
Show file tree
Hide file tree
Showing 7 changed files with 175 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/linters/.markdown-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
MD013:
line_length: 600
10 changes: 10 additions & 0 deletions .github/linters/ct.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# See https://github.com/helm/chart-testing#configuration
remote: origin
target-branch: main
chart-dirs:
- charts
chart-repos:
- openyurt-community=https://cubefs.github.io/cubefs-helm
helm-extra-args: --timeout 600s
additional-commands:
- helm unittest --helm3 --strict --file unittests/*.yaml --file 'unittests/**/*.yaml' {{ .Path }}
48 changes: 48 additions & 0 deletions .github/workflows/lint-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Lint and Test Charts

on: pull_request

jobs:
lint-test:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/[email protected]
with:
version: v3.8.1

- uses: actions/setup-python@v3
with:
python-version: 3.7

- name: Set up chart-testing
uses: helm/[email protected]

- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --config .github/linters/ct.yaml)
if [[ -n "$changed" ]]; then
echo "::set-output name=changed::true"
fi
- name: install helm unittest plugin
if: steps.list-changed.outputs.changed == 'true'
run: |
helm env
helm plugin install https://github.com/quintush/helm-unittest.git --version 0.2.8
- name: Run chart-testing (lint)
run: ct lint --config .github/linters/ct.yaml

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

- name: Run chart-testing (install)
run: ct install --config .github/linters/ct.yaml
31 changes: 31 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Release Charts

on:
push:
branches:
- master

jobs:
release:
if: github.repository == 'cubefs/cubefs-helm'
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Fetch history
run: git fetch --prune --unshallow

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Set up Helm
uses: azure/[email protected]
with:
version: v3.8.1

- name: Run chart-releaser
uses: helm/[email protected]
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
32 changes: 32 additions & 0 deletions .github/workflows/superlinter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Lint Code Base

# Documentation:
# https://help.github.com/en/articles/workflow-syntax-for-github-actions

on: pull_request

jobs:
build:
name: Lint Code Base
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Lint Code Base
uses: docker://github/super-linter:slim-v4
env:
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LINTER_RULES_PATH: .github/linters
VALIDATE_ALL_CODEBASE: false
VALIDATE_BASH: false
VALIDATE_JSCPD: false
VALIDATE_KUBERNETES_KUBEVAL: false
VALIDATE_PYTHON: false
VALIDATE_PYTHON_FLAKE8: false
VALIDATE_PYTHON_BLACK: false
VALIDATE_YAML: false
VALIDATE_NATURAL_LANGUAGE: false
29 changes: 29 additions & 0 deletions .github/workflows/sync-codeowners.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Sync CODEOWNERS

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- run: |
./scripts/check-codeowners.sh > ${{ runner.temp }}/CODEOWNERS
- name: Checkout Code
uses: actions/checkout@v2
with:
ref: main
- name: install yq
run: |
sudo snap install yq
- name: commit codeowners
run: |
cp -f ${{ runner.temp }}/CODEOWNERS .github/CODEOWNERS
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
git add .github/CODEOWNERS
git commit --signoff -m "change code owners"
git push
23 changes: 23 additions & 0 deletions .github/workflows/sync-readme.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
on:
push:
branches:
- master
paths:
- README.md
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: |
cp -f README.md ${{ runner.temp }}/README.md
- uses: actions/checkout@v3
with:
ref: gh-pages
- run: |
cp -f ${{ runner.temp }}/README.md .
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
git add README.md
git commit --signoff -m "Sync README from main"
git push

0 comments on commit d07b337

Please sign in to comment.