Skip to content

Manual Flow Testing #32

Manual Flow Testing

Manual Flow Testing #32

Workflow file for this run

name: Manual Flow Testing
on: workflow_dispatch
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
languages: ${{ steps.prep-matrix.outputs.languages }}
language_paths: ${{ steps.prep-matrix.outputs.language_paths }}
env:
FUNC_VERSION: "knative-v1.16.1"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install func
uses: gauron99/knative-func-action@main
with:
version: ${{ env.FUNC_VERSION }}
name: f
- name: Prep Matrix
id: prep-matrix
run: |
## NOTE: ls -d returns absolute path
## GITHUB_WORKSPACE is the root directory
language_paths="$(ls -d ${GITHUB_WORKSPACE}/*/ | jq -R -s 'split("\n")[:-1]')"
languages="$(ls -d ${GITHUB_WORKSPACE}/*/ | xargs -n 1 basename | jq -R -s 'split("\n")[:-1]')"
# set output
echo language_paths=$language_paths >> $GITHUB_OUTPUT
echo languages=$languages >> $GITHUB_OUTPUT
deploy:
needs: prepare
runs-on: ubuntu-latest
strategy:
matrix:
language: ${{ fromJSON(needs.prepare.outputs.languages) }}
env:
ACTIONS_STEP_DEBUG: true
language_paths: ${{needs.prepare.outputs.language_paths}}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build Functions
run: |
echo "Current language: ${{ matrix.language }}"
index=$(echo $language_paths | jq -r ".[] | select(contains(\"${{matrix.language}}\"))"
# Use the index to get the corresponding value from 'language_paths'
echo "Corresponding language path: ${language_paths_array[$index]}"
WORKDIR=$(mktemp -d)
cd $WORKDIR
echo "Building funcs in language $language"
for template_dir_abs in $(ls -d ${{env.language_path}}*/); do
echo "ls -la"
ls -la
echo "pwd"
pwd
echo "ls -la ${GITHUB_WORKSPACE}"
ls -la ${GITHUB_WORKSPACE}
template=$(basename "$template_dir_abs")
echo "f create $lang-$template -r=$url -l=$lang -t=$template"
f create $lang-$template -r "$url" -l "$lang" -t "$template"
#FUNC_ENABLE_HOST_BUILDER=1 FUNC_BUILDER=host FUNC_CONTAINER=false FUNC_REGISTRY=docker.io/4141gauron3268 f
done