Use AWS accelerated AMIs #74
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: | |
pull_request: | |
branches: [main] | |
jobs: | |
helm-chart-validation: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Helm | |
uses: azure/setup-helm@v4 | |
- name: Run helm lint | |
run: helm lint ./charts/deepgram-self-hosted | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.22 | |
- name: Install helm-docs | |
run: | | |
go install github.com/norwoodj/helm-docs/cmd/helm-docs@latest | |
- name: Run helm-docs | |
run: | | |
helm-docs | |
- name: Check if README.md is up to date | |
run: | | |
if ! git diff --quiet -- ./charts/deepgram-self-hosted/README.md; then | |
echo "README.md is out of date. Please run helm-docs and commit the changes." | |
exit 1 | |
fi | |
- name: Check that chart version is bumped if chart appVersion is bumped | |
run: | | |
CHART_DIR="charts/deepgram-self-hosted" | |
if [ ! -f "$CHART_DIR/Chart.yaml" ]; then | |
echo "Error: Chart.yaml not found in $CHART_DIR" | |
exit 1 | |
fi | |
OLD_VERSION=$(git show origin/$GITHUB_BASE_REF:$CHART_DIR/Chart.yaml | grep '^version:' | awk '{print $2}') | |
NEW_VERSION=$(grep '^version:' $CHART_DIR/Chart.yaml | awk '{print $2}') | |
OLD_APP_VERSION=$(git show origin/$GITHUB_BASE_REF:$CHART_DIR/Chart.yaml | grep '^appVersion:' | awk '{print $2}') | |
NEW_APP_VERSION=$(grep '^appVersion:' $CHART_DIR/Chart.yaml | awk '{print $2}') | |
if [[ "$OLD_VERSION" = "$NEW_VERSION" ]] && [[ "$OLD_APP_VERSION" != "$NEW_APP_VERSION" ]]; then | |
echo "Error: In $CHART_DIR/Chart.yaml, appVersion has been changed but version has not been bumped" | |
echo "Old appVersion: $OLD_APP_VERSION" | |
echo "New appVersion: $NEW_APP_VERSION" | |
echo "Chart version: $NEW_VERSION" | |
echo "Chart version should be bumped anytime the application version is bumped." | |
exit 1 | |
fi | |
- name: Check that the chart changelog has been updated if the chart has changes | |
run: | | |
CHART_DIR="charts/deepgram-self-hosted" | |
echo "Non-documentation files changed in chart directory:" | |
# If there are changes to the chart directory besides the changelog file or documentation... | |
if git diff --name-only origin/"$GITHUB_BASE_REF"... $CHART_DIR | grep -vE "^$CHART_DIR/(CHANGELOG\.md|README\.md(\..*)?)"; then | |
# ...make sure the changelog file is updated as well | |
if ! git diff --name-only origin/"$GITHUB_BASE_REF"... "$CHART_DIR/CHANGELOG.md" | grep -q "$CHART_DIR/CHANGELOG.md"; then | |
echo "Detected changes to non-documentation files the helm chart directory, but the chart CHANGELOG.md was not updated." | |
echo "Please add a short desription of changes to the changelog under the \"Unreleased\" header." | |
exit 1 | |
fi | |
fi | |
diagnostic-scripts-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Check for changes in diagnostic directory | |
id: check_changes | |
run: | | |
git diff --name-only origin/${{ github.base_ref }}..HEAD -- diagnostics/*.sh > changed_files.txt | |
if [ -s changed_files.txt ]; then | |
echo "changes_detected=true" >> $GITHUB_OUTPUT | |
else | |
echo "changes_detected=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Install ShellCheck | |
if: steps.check_changes.outputs.changes_detected == 'true' | |
run: sudo apt-get install -y shellcheck | |
- name: Install shfmt | |
if: steps.check_changes.outputs.changes_detected == 'true' | |
run: | | |
go install mvdan.cc/sh/v3/cmd/shfmt@latest | |
echo "$HOME/go/bin" >> $GITHUB_PATH | |
- name: Run ShellCheck | |
if: steps.check_changes.outputs.changes_detected == 'true' | |
run: | | |
while IFS= read -r file; do | |
if [[ "$file" == *.sh ]]; then | |
shellcheck "$file" | |
fi | |
done < changed_files.txt | |
- name: Run shfmt | |
if: steps.check_changes.outputs.changes_detected == 'true' | |
run: | | |
while IFS= read -r file; do | |
if [[ "$file" == *.sh ]]; then | |
if ! shfmt -d "$file"; then | |
echo "Error: $file is not correctly formatted. Run 'shfmt -w $file' to fix." | |
exit 1 | |
fi | |
fi | |
done < changed_files.txt |