Skip to content

feat: Add OCI support to Helm repositories and update related logic #1620

feat: Add OCI support to Helm repositories and update related logic

feat: Add OCI support to Helm repositories and update related logic #1620

Workflow file for this run

name: Pr verify
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
workflow_dispatch:
jobs:
pr_verify:
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for accurate diff
ref: ${{ github.head_ref || github.ref_name }}
- name: Get changed files and Dagger version
id: get_changed_files
run: |
# get the list of changed folders
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]] || [[ "${{ github.event_name }}" == "push" ]] ; then
# For workflow_dispatch or push, include all folders except .github
mapfile -t CHANGED_MODULES <<< "$(git ls-tree -d --name-only HEAD | grep -v '.github' | sort -u)"
else
mapfile -t CHANGED_MODULES <<< "$(git diff --name-only origin/main '${{ github.head_ref }}' | grep -oE '^[^/]+/' | grep -v '.github' | sort -u)"
fi
echo "::notice::Changed folders: ${CHANGED_MODULES[@]}" | tr '\n' ' '
if [ -z "$CHANGED_MODULES" ]; then
echo "No modified dagger modules found."
echo "SKIP_UNIT_TEST=true" >> "$GITHUB_ENV"
else
# Get the highest Dagger version used in the modules
VERSIONS=""
for dir in "${CHANGED_MODULES[@]}"; do
V=$(cat "${dir}/dagger.json" | jq -r ."engineVersion")
VERSIONS+="${V}\n"
done
DAGGER_VERSION=$(echo -e "${VERSIONS}" | sort -V | tail -n 1)
echo "DAGGER_VERSION=$DAGGER_VERSION" >> $GITHUB_ENV
echo "SKIP_UNIT_TEST=false" >> "$GITHUB_ENV"
printf "%s\n" "${CHANGED_MODULES[@]}" > changed_modules.txt
fi
- name: Set up Go
uses: actions/setup-go@v4
if: env.SKIP_UNIT_TEST == 'false'
with:
go-version: '1.22'
- name: Install Dagger CLI
if: env.SKIP_UNIT_TEST == 'false'
run: |
curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=${{ env.DAGGER_VERSION }} sh
sudo mv bin/dagger /usr/local/bin/
- name: Run Unit Tests
if: env.SKIP_UNIT_TEST == 'false'
run: |
mapfile -t CHANGED_MODULES < "changed_modules.txt"
# iterate over each changed folder and run tests
for dir in "${CHANGED_MODULES[@]}"; do
# Check if the directory contains a SKIP_UNIT_TEST file
if [ -f "$dir/SKIP_UNIT_TEST" ]; then
echo "Skipping tests in $dir due to SKIP_UNIT_TEST file"
continue
fi
echo "Running tests in $dir"
cd "$dir"
dagger develop # set up module
dagger functions # ensures dagger can show the module functions
if [ -f go.mod ]; then
dagger run go test -v ./
elif [ -f requirements.txt ]; then
dagger run python -m unittest discover -s . -v
elif [ -f package.json ]; then
dagger run npm test
else
echo "Not supported technology found in $dir. Supported technologies are: Go, Python, Node.js"
exit 1
fi
cd -
done