Merge pull request #58 from linux-kdevops/cel/remove-open-stack #172
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # SPDX-License-Identifier: GPL-2.0 | |
| --- | |
| name: Run kdevops CI Workflow - Push/PR/Manual/Schedule | |
| on: | |
| schedule: | |
| - cron: '0 14 * * *' # Daily at 2 PM UTC | |
| push: | |
| branches: | |
| - main | |
| - 'ci-testing/**' | |
| pull_request: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| inputs: | |
| ci_workflow: | |
| description: "CI Workflow" | |
| required: true | |
| default: 'blktests_nvme' | |
| type: choice | |
| options: | |
| - blktests | |
| - blktests_block | |
| - blktests_loop | |
| - blktests_meta | |
| - blktests_nbd | |
| - blktests_nvme | |
| - blktests_nvmemp | |
| - blktests_scsi | |
| - blktests_srp | |
| - blktests_zbd | |
| - lbs-xfs | |
| - lbs-xfs-bdev-large-nvme | |
| - lbs-xfs-bdev-nvme | |
| - lbs-xfs-small | |
| - xfs | |
| - xfs-soak | |
| - xfs_crc | |
| - xfs_crc_logdev | |
| - xfs_crc_rtdev | |
| - xfs_crc_rtdev_extsize_28k | |
| - xfs_crc_rtdev_extsize_64k | |
| - xfs_nocrc | |
| - xfs_nocrc_16k_4ks | |
| - xfs_nocrc_1k | |
| - xfs_nocrc_2k | |
| - xfs_nocrc_32_4ks | |
| - xfs_nocrc_4k | |
| - xfs_nocrc_512 | |
| - xfs_nocrc_64_4ks | |
| - xfs_nocrc_8k_4ks | |
| - xfs_nocrc_lbs | |
| - xfs_reflink | |
| - xfs_reflink_1024 | |
| - xfs_reflink_16k_4ks | |
| - xfs_reflink_2k | |
| - xfs_reflink_32k_4ks | |
| - xfs_reflink_4k | |
| - xfs_reflink_4k_8ks | |
| - xfs_reflink_64k_4ks | |
| - xfs_reflink_dir_bsize_8k | |
| - xfs_reflink_lbs | |
| - xfs_reflink_logdev | |
| - xfs_reflink_normapbt | |
| - xfs_reflink_nrext64 | |
| - xfs_reflink_stripe_len | |
| kernel_tree: | |
| description: "Linux kernel tree to use" | |
| required: true | |
| default: 'linux' | |
| type: choice | |
| options: | |
| - linux | |
| - linux-next | |
| - linux-stable | |
| - kdevops-linus | |
| kernel_ref: | |
| description: "Linux tree git reference (branch/tag/commit-id)" | |
| required: true | |
| default: 'master' | |
| type: string | |
| test_mode: | |
| description: 'Testing mode' | |
| required: false | |
| default: 'kdevops-ci' | |
| type: choice | |
| options: | |
| - 'kdevops-ci' | |
| - 'linux-ci' | |
| guest_os: | |
| description: 'Guest OS for testing' | |
| required: false | |
| default: 'default' | |
| type: choice | |
| options: | |
| - default # Use defconfig's default (typically Debian 13 on debian hosts) | |
| - debian-13 # Force Debian 13 Trixie | |
| - fedora-41 # Force Fedora 41 | |
| tests: | |
| description: 'Custom test to run (for kdevops-ci mode only)' | |
| required: false | |
| type: string | |
| default: '' | |
| jobs: | |
| generate_kernel_ref: | |
| name: Generate Kernel Reference for Scheduled Runs | |
| runs-on: [self-hosted] | |
| if: github.event_name == 'schedule' | |
| outputs: | |
| kernel_ref: ${{ steps.kernel_ref.outputs.kernel_ref }} | |
| kernel_tree: ${{ steps.kernel_ref.outputs.kernel_tree }} | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Generate kernel reference based on day of week | |
| id: kernel_ref | |
| run: | | |
| set -euxo pipefail | |
| day_of_week=$(date +%u) | |
| if [ "$day_of_week" -eq 1 ]; then | |
| # Monday: Use mainline | |
| kernel_ref=$(./scripts/korg-releases.py --moniker mainline) | |
| kernel_tree=linux | |
| else | |
| # Other days: Use linux-next | |
| kernel_ref=$(./scripts/korg-releases.py --moniker linux-next) | |
| kernel_tree=linux-next | |
| fi | |
| ./scripts/github_output.sh kernel_ref "$kernel_ref" | |
| ./scripts/github_output.sh kernel_tree "$kernel_tree" | |
| check_ref: | |
| name: Check Linux kernel Git Reference | |
| runs-on: [self-hosted] | |
| if: github.event_name == 'workflow_dispatch' | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Check kernel_ref exists | |
| id: check_kernel_ref | |
| run: | | |
| set -euxo pipefail | |
| ref="${{ github.event.inputs.kernel_ref }}" | |
| tree="${{ github.event.inputs.kernel_tree }}" | |
| mirror="/mirror/${tree}.git" | |
| ls_remote="$(git ls-remote "$mirror" "refs/*/${ref}" || true)" | |
| contains_branch="$(git -C "$mirror" branch --contains "${ref}" || true)" | |
| contains_tag="$(git -C "$mirror" branch --contains "${ref}" || true)" | |
| if [ -z "$ls_remote" ] && [ -z "$contains_branch" ] && [ -z "$contains_tag" ]; then | |
| echo "Linux kernel ${ref} does not exist." | |
| exit 1 | |
| fi | |
| ci-matrix: | |
| name: "${{ github.event_name == 'schedule' && 'linux-ci' || github.event.inputs.test_mode || 'kdevops-ci' }}: ${{ matrix.ci_workflow }}" | |
| runs-on: >- | |
| ${{ | |
| (github.event_name == 'schedule' && fromJSON('["self-hosted", "linux-ci"]')) || | |
| (github.event.inputs.test_mode == 'linux-ci' && fromJSON('["self-hosted", "linux-ci"]')) || | |
| fromJSON('["self-hosted", "kdevops-ci"]') | |
| }} | |
| needs: [check_ref, generate_kernel_ref] | |
| if: >- | |
| always() && | |
| ( | |
| needs.check_ref.result == 'success' || | |
| needs.check_ref.result == 'skipped' | |
| ) && | |
| ( | |
| needs.generate_kernel_ref.result == 'success' || | |
| needs.generate_kernel_ref.result == 'skipped' | |
| ) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| ci_workflow: >- | |
| ${{ | |
| github.event_name == 'schedule' | |
| && fromJSON('["blktests"]') | |
| || github.event_name == 'workflow_dispatch' | |
| && fromJSON(format('["{0}"]', github.event.inputs.ci_workflow)) | |
| || fromJSON('["blktests_nvme", "xfs_reflink_4k"]') | |
| }} | |
| steps: | |
| - name: Checkout repository for ${{ matrix.ci_workflow }} | |
| shell: bash | |
| run: | | |
| set -euxo pipefail | |
| # Start fresh | |
| rm -rfv ./* ./.* 2>/dev/null || true | |
| # Clone repository (with mirror optimization when available) | |
| if [[ -f "/mirror/kdevops.git/HEAD" ]]; then | |
| git clone --verbose --progress \ | |
| --reference /mirror/kdevops.git \ | |
| --depth=1 \ | |
| ${{ github.server_url }}/${{ github.repository }}.git . | |
| else | |
| git clone --verbose --progress \ | |
| --depth=1 \ | |
| ${{ github.server_url }}/${{ github.repository }}.git . | |
| fi | |
| # Checkout the appropriate ref based on event type | |
| if [[ "${{ github.event_name }}" == "pull_request" ]]; then | |
| git fetch --depth=1 origin refs/pull/${{ github.event.number }}/head:pr-branch | |
| git checkout pr-branch | |
| else | |
| git fetch --depth=1 origin ${{ github.ref }} | |
| git checkout FETCH_HEAD | |
| fi | |
| - name: Report kdevops commit information | |
| shell: bash | |
| run: | | |
| set -euxo pipefail | |
| # Get current commit info | |
| commit_sha=$(git rev-parse HEAD) | |
| commit_short=$(git rev-parse --short HEAD) | |
| commit_subject=$(git log -1 --pretty=format:"%s") | |
| # Report the kdevops version used | |
| echo "::notice title=kdevops Commit::Using kdevops commit $commit_short ($commit_sha): $commit_subject" | |
| # Also show in regular output for logs | |
| echo "✅ Running kdevops CI with commit: $commit_short" | |
| echo "📝 Commit message: $commit_subject" | |
| - name: Configure kdevops | |
| uses: ./.github/actions/configure | |
| with: | |
| ci_workflow: ${{ matrix.ci_workflow }} | |
| guest_os: ${{ github.event.inputs.guest_os || 'default' }} | |
| kernel_ref: >- | |
| ${{ | |
| github.event_name == 'schedule' && needs.generate_kernel_ref.outputs.kernel_ref | |
| || github.event.inputs.kernel_ref | |
| || 'v6.15' | |
| }} | |
| kernel_tree: >- | |
| ${{ | |
| github.event_name == 'schedule' && needs.generate_kernel_ref.outputs.kernel_tree | |
| || github.event.inputs.kernel_tree | |
| || 'linux' | |
| }} | |
| test_mode: >- | |
| ${{ | |
| github.event_name == 'schedule' && 'linux-ci' | |
| || github.event.inputs.test_mode | |
| || 'kdevops-ci' | |
| }} | |
| - name: Bringup guests | |
| uses: ./.github/actions/bringup | |
| - name: Install linux | |
| uses: ./.github/actions/linux | |
| - name: Install tests | |
| uses: ./.github/actions/build-test | |
| with: | |
| ci_workflow: ${{ matrix.ci_workflow }} | |
| - name: Run tests | |
| uses: ./.github/actions/test | |
| with: | |
| ci_workflow: ${{ matrix.ci_workflow }} | |
| test_mode: >- | |
| ${{ | |
| github.event_name == 'schedule' && 'linux-ci' | |
| || github.event.inputs.test_mode | |
| || 'kdevops-ci' | |
| }} | |
| tests: ${{ github.event.inputs.tests || '' }} | |
| # Timeout: linux-ci runs full test suite (24 hours), | |
| # kdevops-ci runs single test (2 hours) | |
| timeout-minutes: >- | |
| ${{ | |
| (github.event_name == 'schedule' && 1440) | |
| || (github.event.inputs.test_mode == 'linux-ci' && 1440) | |
| || 120 | |
| }} | |
| - name: Archive results | |
| uses: ./.github/actions/archive | |
| with: | |
| ci_workflow: ${{ matrix.ci_workflow }} | |
| ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| - name: Cleanup | |
| if: always() | |
| uses: ./.github/actions/cleanup |