53a62e30ce
* Split integration tests into t.yaml (Full suite) and t-selective.yaml (PR suite). * In t-selective.yaml, use a separate 'check' job to decide if tests should run. * Explode runner logic into individual steps (Prepare, Build, Start, Test) for UI visibility. * Add automated log archiving via integration/common/archive-logs.sh on failure. * Use manual git checkout pattern for better reliability across history rewrites.
91 lines
2.6 KiB
YAML
91 lines
2.6 KiB
YAML
name: Integration (Selective)
|
|
|
|
on:
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
HOME: /var/lib/gitea-runner
|
|
REPO_URL: http://src.opensuse.org//git-workflow/autogits.git
|
|
|
|
jobs:
|
|
check:
|
|
runs-on: linux-x86_64
|
|
outputs:
|
|
skip: ${{ steps.check_changes.outputs.skip }}
|
|
tests: ${{ steps.check_changes.outputs.tests }}
|
|
steps:
|
|
- name: Checkout
|
|
run: |
|
|
git clone --no-checkout ${{ gitea.server_url }}/${{ gitea.repository }} .
|
|
git fetch origin ${{ gitea.ref }}
|
|
git checkout FETCH_HEAD
|
|
|
|
- name: Check for relevant changes
|
|
id: check_changes
|
|
working-directory: ./integration
|
|
run: |
|
|
if [ "${{ gitea.event_name }}" == "pull_request" ]; then
|
|
set -xeo pipefail
|
|
git fetch origin ${{ gitea.base_ref }}
|
|
MERGE_BASE=$(git merge-base origin/${{ gitea.base_ref }} HEAD)
|
|
TESTS=$(make print-tests BASE_BRANCH=$MERGE_BASE)
|
|
if [ -z "$TESTS" ]; then
|
|
echo "No relevant tests to run. Skipping integration pipeline."
|
|
echo "skip=true" >> "$GITEA_OUTPUT"
|
|
else
|
|
echo "Tests to run: $TESTS"
|
|
echo "skip=false" >> "$GITEA_OUTPUT"
|
|
echo "tests=$TESTS" >> "$GITEA_OUTPUT"
|
|
fi
|
|
else
|
|
echo "Manual trigger. Running all tests."
|
|
echo "skip=false" >> "$GITEA_OUTPUT"
|
|
fi
|
|
|
|
integration:
|
|
needs: check
|
|
if: needs.check.outputs.skip != 'true'
|
|
runs-on: linux-x86_64
|
|
steps:
|
|
- name: Checkout
|
|
run: |
|
|
git clone --no-checkout ${{ gitea.server_url }}/${{ gitea.repository }} .
|
|
git fetch origin ${{ gitea.ref }}
|
|
git checkout FETCH_HEAD
|
|
|
|
- name: Prepare binaries
|
|
run: make build_for_ci
|
|
|
|
- name: Prepare images
|
|
run: |
|
|
make -C integration build
|
|
podman rmi $(podman images -f "dangling=true" -q) || true
|
|
|
|
- name: Clean environment
|
|
run: make -C integration clean
|
|
|
|
- name: Start services
|
|
run: |
|
|
make -C integration up
|
|
make -C integration wait_healthy
|
|
podman ps
|
|
sleep 5
|
|
|
|
- name: Run tests
|
|
run: |
|
|
if [ -n "${{ needs.check.outputs.tests }}" ]; then
|
|
make -C integration pytest PYTEST_FILE="${{ needs.check.outputs.tests }}"
|
|
else
|
|
make -C integration pytest
|
|
fi
|
|
|
|
- name: Archive logs on failure
|
|
if: failure()
|
|
run: ./integration/common/archive-logs.sh
|
|
|
|
- name: Final Cleanup
|
|
if: always()
|
|
run: |
|
|
make -C integration clean
|