Skip to content

Check Modules for Integration Tests #127

Check Modules for Integration Tests

Check Modules for Integration Tests #127

name: Check Modules for Integration Tests
on:
workflow_dispatch:
schedule:
- cron: "0 2 * * *"
jobs:
get-modules:
name: Get Modules
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.get-modules.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get modules
id: get-modules
run: |
MODULES=()
MODULES_WITHOUT_INTEG=()
for d in modules/*/* ; do
MODULES+=("$d")
done
exempt=(modules/dummy/blank modules/replication/dockerimage-replication)
for del in ${exempt[@]}; do
MODULES=("${MODULES[@]/$del}")
done
for m in "${MODULES[@]}" ; do
if [ ! -d "${m}"/integ/ ]; then
echo "No Integration tests for ${m}"
MODULES_WITHOUT_INTEG+=("$m")
fi
done
echo "${MODULES_WITHOUT_INTEG[@]}"
# Create our json structure [{"module_path": "..."}]
MODULES_JSON=$(echo "${MODULES_WITHOUT_INTEG[@]}" | jq -R -s 'split(" ")' | jq '[ .[] | select(length > 0) ]' | jq 'map({"module_path": .})')
# Export the modules as json to the outputs
echo 'matrix<<EOF' >> $GITHUB_OUTPUT
echo $MODULES_JSON >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
create-issues:
name: Create issue for ${{ matrix.modules.module_path }}
needs: get-modules
permissions:
contents: read
issues: write
strategy:
fail-fast: false
matrix:
modules: ${{ fromJson(needs.get-modules.outputs.matrix) }}
runs-on: ubuntu-latest
steps:
- name: Avoid Rate Limit With Wait
run: sleep $((RANDOM % 15))
- uses: actions/checkout@v4
- uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MODULE_PATH: ${{ matrix.modules.module_path }}
with:
filename: .github/ISSUE_TEMPLATE/missing_integ_tests_issue.md
update_existing: false