---
name: Daily Tests - basic

on:  # yamllint disable-line rule:truthy
    schedule:
        - cron: '30 23 * * *'   # every day at 23:30 UTC

    # Allows you to run this workflow manually from the Actions tab
    workflow_dispatch:

    pull_request:
        paths:
            - '.github/workflows/daily-basic.yml'

jobs:
    basic:
        name: ${{ matrix.test }} on ${{ matrix.container }} on ${{ matrix.architecture.tag }}
        runs-on: ${{ matrix.architecture.runner }}
        timeout-minutes: 20
        concurrency:
            group: >
                daily-basic-${{ github.workflow }}-${{ github.ref }}
                -${{ matrix.container }}-${{ matrix.test }}-${{ matrix.architecture.tag }}
            cancel-in-progress: true
        strategy:
            fail-fast: false
            matrix:
                architecture:
                    - {runner: 'ubuntu-24.04', tag: 'amd'}
                    - {runner: 'ubuntu-24.04-arm', tag: 'arm'}
                container:
                    - debian:latest
                    - debian:sid
                    - gentoo:latest
                    - opensuse:latest
                    - ubuntu:devel
                    - ubuntu:rolling
                    - void:latest
                test:
                    - "10"
                    - "11"
                    - "13"
                    - "14"
                    - "20"
                    - "21"
                    - "26"
                    - "30"
                    - "50"
                    - "80"
                    - "81"
                    - "82"
                exclude:
                    # https://github.com/dracut-ng/dracut-ng/issues/1988
                    - container: debian:sid
                      architecture: {runner: 'ubuntu-24.04-arm', tag: 'arm'}
        container:
            image: ghcr.io/dracut-ng/${{ matrix.container }}
            options: '--device=/dev/kvm --privileged'
        steps:
            - name: "Checkout Repository"
              uses: actions/checkout@v6
            - name: "${{ matrix.container }} TEST-${{ matrix.test }}"
              run: ./test/test-container.sh "TEST-${{ matrix.test }}" ${{ matrix.test }}
    extended:
        name: ${{ matrix.test }} on ${{ matrix.container }} on ${{ matrix.architecture.tag }}
        runs-on: ${{ matrix.architecture.runner }}
        timeout-minutes: 20
        concurrency:
            group: >
                daily-basic-extended-${{ github.workflow }}-${{ github.ref }}
                -${{ matrix.container }}-${{ matrix.test }}-${{ matrix.architecture.tag }}
            cancel-in-progress: true
        strategy:
            fail-fast: false
            matrix:
                architecture:
                    - {runner: 'ubuntu-24.04', tag: 'amd'}
                container:
                    - alpine:edge
                    - arch:latest
                    - azurelinux:3.0
                    - fedora:latest
                    - fedora:rawhide
                    - centos:latest
                    - gentoo:amd64-openrc
                test:
                    - "10"
                    - "11"
                    - "13"
                    - "14"
                    - "20"
                    - "21"
                    - "26"
                    - "30"
                    - "50"
                    - "80"
                    - "81"
                    - "82"
                exclude:
                    # btrfs kernel module is not available on CentOS Stream 10
                    - container: centos:latest
                      test: "11"
        container:
            image: ghcr.io/dracut-ng/${{ matrix.container }}
            options: '--device=/dev/kvm --privileged'
        steps:
            - name: "Checkout Repository"
              uses: actions/checkout@v6
            - name: "${{ matrix.container }} TEST-${{ matrix.test }}"
              run: ./test/test-container.sh "TEST-${{ matrix.test }}" ${{ matrix.test }}
