Skip to content

lf-edge/eden Test suite #17172

lf-edge/eden Test suite

lf-edge/eden Test suite #17172

Workflow file for this run

---
name: lf-edge/eden Test suite
# yamllint disable-line rule:truthy
on:
push:
branches:
- "master"
- "[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+-stable"
paths-ignore:
- '**/*.md'
- '.github/**'
pull_request_review:
types: [submitted]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
check_md_wf_files:
if: ${{ github.event.review.state == 'approved' }}
runs-on: ubuntu-latest
outputs:
only_md: ${{ steps.check_md_wf.outputs.only_md }}
workflow_files_modified: ${{ steps.check_md_wf.outputs.workflow_files_modified }}
steps:
- name: Check if only Markdown files are changed
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Get the list of modified files
PR_API_URL="${{ github.event.pull_request._links.self.href }}/files"
RESPONSE=$(curl -s -H "Authorization: token $GITHUB_TOKEN" $PR_API_URL)
# Check if the response is valid JSON
echo "$RESPONSE" | jq . > /dev/null || exit 1
MODIFIED_FILES=$(echo "$RESPONSE" | jq -r '.[].filename')
NON_MD_FILES=$(echo "$MODIFIED_FILES" | grep -v '\.md$' || true)
if [ -z "$NON_MD_FILES" ]; then
echo "All files are Markdown (.md) files."
echo "only_md=true" >> $GITHUB_ENV
else
echo "Non-Markdown files detected."
echo "only_md=false" >> $GITHUB_ENV
fi
# Check if any GitHub workflow files in .github/workflows are modified
if echo "$MODIFIED_FILES" | grep -qE '^\.github/workflows/.*\.(yml|yaml)$'; then
echo "GitHub workflow files in .github/workflows are modified."
echo "workflow_files_modified=true" >> $GITHUB_ENV
else
echo "No GitHub workflow files in .github/workflows are modified."
echo "workflow_files_modified=false" >> $GITHUB_ENV
fi
- name: Output result
id: check_md_wf
run: |
echo "${{ env.only_md }}"
echo "only_md=${{ env.only_md }}" >> $GITHUB_OUTPUT
echo "${{ env.workflow_files_modified }}"
echo "workflow_files_modified=${{ env.workflow_files_modified }}" >> $GITHUB_OUTPUT
get_run_id:
if: ${{ github.event.review.state == 'approved' && needs.check_md_wf_files.outputs.only_md == 'false' && needs.check_md_wf_files.outputs.workflow_files_modified == 'false' }}
runs-on: ubuntu-latest
needs: check_md_wf_files
outputs:
run_id: ${{ steps.get_run_id.outputs.run_id }}
steps:
- name: Get the GitHub context
run: echo "github context is $GITHUB_CONTEXT"
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
- name: Print the head SHA
run: |
echo ${{ github.event.pull_request.head.sha }}
- name: Print pull request url
run: |
echo ${{ github.event.pull_request._links.self.href }}
- name: Get run ID for the artifact upload
id: get_run_id
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
RESPONSE=$(curl -s -L "https://api.github.com/repos/${{ github.repository }}/actions/workflows/build.yml/runs?head_sha=${{ github.event.pull_request.head.sha }}&status=success" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "Accept: application/vnd.github+json")
# Check if RESPONSE is empty
if [ -z "$RESPONSE" ]; then
echo "API call returned no response."
exit 1
fi
RUN_ID=$(echo $RESPONSE | jq -r '.workflow_runs[0].id')
# Check if the RUN_ID is empty
if [ "$RUN_ID" == "null" ] || [ -z "$RUN_ID" ]; then
echo "No successful runs found"
exit 1
fi
echo $RUN_ID
echo "run_id=$RUN_ID" >> $GITHUB_OUTPUT
- name: Report Run ID # useful for debugging
run: echo "Run ID is ${{ steps.get_run_id.outputs.run_id }}"
test_suite_pr:
needs: get_run_id
strategy:
fail-fast: false
# we do not really need a matrix, as we only do amd64/kvm,
# but this makes it more consistent with the build, and will
# let us expand in the future, if we want
matrix:
arch: [amd64]
hv: [kvm]
platform: ["generic"]
if: github.event.review.state == 'approved'
uses: lf-edge/eden/.github/workflows/test.yml@0.9.12
secrets: inherit
with:
eve_image: "evebuild/pr:${{ github.event.pull_request.number }}"
eve_artifact_name: eve-${{ matrix.hv }}-${{ matrix.arch }}-${{ matrix.platform }}
artifact_run_id: ${{ needs.get_run_id.outputs.run_id }}
eden_version: "0.9.12"
test_suite_master:
if: github.ref == 'refs/heads/master'
uses: lf-edge/eden/.github/workflows/test.yml@0.9.12
secrets: inherit
with:
eve_image: "lfedge/eve:snapshot"
eden_version: "0.9.12"
test_suite_tag:
if: startsWith(github.ref, 'refs/tags')
uses: lf-edge/eden/.github/workflows/test.yml@0.9.12
secrets: inherit
with:
eve_image: "lfedge/eve:${{ github.ref_name }}"
eden_version: "0.9.12"