Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add helm-related CI #3

Merged
merged 1 commit into from
Jan 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/workflows/helm-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Release Charts

on:
push:
tags:
- 'chart-v*'

jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v1
with:
version: v3.6.3

- name: Check chart version
run: |
tag_version=${GITHUB_REF##*/chart-v}
chart_version=$(cat charts/tenet/Chart.yaml | grep 'version:' | sed 's/version:\s//')
if [ "$tag_version" != "$chart_version" ]; then
echo "Different versions: tag \"$tag_version\", chart \"$chart_version\""
exit 1
fi
- name: Packaging the chart
run: helm package ./charts/tenet/

- uses: actions/upload-artifact@v2
with:
name: helm-charts
path: ./tenet-*.tgz
retention-days: 1

publish:
name: Publish charts on GitHub Pages
runs-on: ubuntu-20.04
needs: build
steps:
- uses: actions/checkout@v2
with:
ref: gh-pages

- name: Set up Helm
uses: azure/setup-helm@v1
with:
version: v3.6.3

- uses: actions/download-artifact@v2
with:
name: helm-charts

- name: Update charts index
run: helm repo index --url https://cybozu-go.github.io/tenet/ --merge index.yaml .

- run: git add .

- name: Check diffs
run: |
diffs=$(git status -s)
if [ "$diffs" = "" ]; then
echo "NO_DIFF=1" >> $GITHUB_ENV
else
printf "%s\n" "$diffs"
fi
- name: Commit changes
if: env.NO_DIFF != '1'
run: |
git config --global user.name 'Cybozu Neco'
git config --global user.email 'cybozu-neco@users.noreply.github.com'
git commit -m 'update'
- name: Push to gh-pages
if: env.NO_DIFF != '1'
run: git push origin gh-pages
47 changes: 47 additions & 0 deletions .github/workflows/helm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Lint and Test Charts

on:
pull_request:
paths:
- "charts/**"
- '!**.md'

jobs:
lint-test:
runs-on: ubuntu-20.04

steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

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

- name: Set up chart-testing
uses: helm/chart-testing-action@v2.0.1

- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --config ct.yaml)
if [[ -n "$changed" ]]; then
echo "::set-output name=changed::true"
fi
- name: Run chart-testing (lint)
run: ct lint --config ct.yaml

- name: Create kind cluster
uses: helm/kind-action@v1.2.0
if: steps.list-changed.outputs.changed == 'true'
with:
node_image: kindest/node:v1.22.4

- name: Apply cert-manager
run: |
kubectl apply -f https://github.com/jetstack/cert-manager/releases/latest/download/cert-manager.yaml
kubectl -n cert-manager wait --for=condition=available --timeout=180s --all deployments
- name: Run chart-testing (install)
run: ct install --config ct.yaml