add service monitor #170
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
name: chart-releaser | |
jobs: | |
helm-chart-release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Configure Git | |
run: | | |
git config user.name 'github-actions' | |
git config user.email '[email protected]' | |
- name: Install Helm | |
uses: azure/setup-helm@v1 | |
with: | |
version: v3.8.1 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
check-latest: true | |
- name: Install helm unittests | |
run: | | |
helm env | |
helm plugin install https://github.com/quintush/helm-unittest | |
- name: Install chart-testing | |
uses: helm/[email protected] | |
- if: github.event_name == 'pull_request' | |
name: Set target branch on pull_request | |
run: | | |
echo "TARGET_BRANCH=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV | |
echo "SINCE=HEAD" >> $GITHUB_ENV | |
- if: github.event_name == 'push' | |
name: Set target branch on push | |
run: | | |
echo "TARGET_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV | |
echo "SINCE=${{ github.event.before }}" >> $GITHUB_ENV | |
- name: Run chart-testing list-changed | |
id: list-changed | |
run: | | |
changed=$(ct list-changed --target-branch ${{ env.TARGET_BRANCH }} --since ${{ env.SINCE }}) | |
if [[ -n "$changed" ]]; then | |
echo "changed=true" >> "$GITHUB_OUTPUT" | |
fi | |
- name: Lint helm charts | |
if: steps.list-changed.outputs.changed == 'true' || github.event_name == 'push' | |
run: ct lint --config ct.yaml --validate-maintainers=false --target-branch ${{ env.TARGET_BRANCH }} --check-version-increment=${{ github.event_name == 'pull_request' }} --since=${{ env.SINCE }} | |
- name: Create k8s Kind Cluster | |
if: steps.list-changed.outputs.changed == 'true' || github.event_name == 'push' | |
uses: helm/[email protected] | |
- name: Install and test helm charts | |
if: steps.list-changed.outputs.changed == 'true' || github.event_name == 'push' | |
run: | | |
for TEST_DIR in tests/ci/* | |
do | |
echo "Running test $(pwd)/${TEST_DIR}" | |
ct install --target-branch ${{ env.TARGET_BRANCH }} --charts $(pwd)/${TEST_DIR} | |
done | |
- name: Run an upgrade test | |
if: steps.list-changed.outputs.changed == 'true' || github.event_name == 'push' | |
run: | | |
ct install --upgrade --target-branch ${{ env.TARGET_BRANCH }} | |
- if: github.event_name == 'push' && github.ref_name == 'main' | |
name: Run chart-releaser | |
uses: helm/[email protected] | |
with: | |
charts_dir: charts | |
env: | |
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |