Add test action for the chart #29
Workflow file for this run
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
name: CI | |
on: | |
workflow_dispatch: | |
push: | |
branches-ignore: [ staging-squash-merge.tmp ] | |
pull_request: | |
branches: [ main ] | |
types: [ opened, synchronize, reopened, ready_for_review ] | |
concurrency: | |
group: ${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
# refer: https://github.com/helm/chart-testing-action | |
lint-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Helm | |
uses: azure/setup-helm@v3 | |
with: | |
version: v3.12.1 | |
- name: Lint chart | |
run: helm lint mirrord-operator | |
- name: Start minikube | |
id: minikube | |
uses: medyagh/setup-minikube@latest | |
- name: Run chart-testing (install) | |
run: | | |
echo ${{ secrets.MIRRORD_OPERATOR_LICENSE }} | base64 --decode > ./test-license.pem | |
helm install mirrord ./mirrord-operator --wait --set-file license.file.data.license.pem=test-license.pem | |
- name: wait for operator status | |
run: | | |
end_time=$((SECONDS+60)) | |
log_file="error.log" | |
rm -f "$log_file" | |
while [ $SECONDS -lt $end_time ]; do | |
if target/debug/mirrord operator status 2>> "$log_file"; then | |
break | |
fi | |
kubectl logs $(kubectl get pods -n mirrord -o jsonpath='{.items[0].metadata.name}') -n mirrord | |
sleep 5 | |
done | |
if [ $SECONDS -ge $end_time ]; then | |
echo "Timed out!, error messages:" | |
cat "$log_file" | |
exit 1 | |
fi | |
- name: Install mirrord | |
run: curl -fsSL https://raw.githubusercontent.com/metalbear-co/mirrord/main/scripts/install.sh | bash | |
- name: Check mirrord-operator status | |
run: mirrord operator status | |