name: Coriolis Integration Tests

on:
  workflow_dispatch:
  pull_request:
    branches: [ "master" ]

permissions:
  contents: read

jobs:
  integration:
    runs-on: ubuntu-24.04

    steps:
    - name: Checkout repository
      uses: actions/checkout@v4

    - name: Set up Python 3.10
      uses: actions/setup-python@v4
      with:
        python-version: "3.10"
        architecture: "x64"

    - name: Update apt package lists
      shell: bash
      run: sudo apt-get update -y

    - name: Install tox
      shell: bash
      run: |
        sudo apt install tox

    - name: Install scsi_debug kernel module
      shell: bash
      run: |
        sudo apt-get install -y linux-modules-extra-$(uname -r)

    - name: Build write_data resource binary
      shell: bash
      run: |
        sudo apt-get install -y build-essential zlib1g-dev
        make -C coriolis/resources

    - name: Build Docker image for integration test minions
      shell: bash
      run: |
        docker build -t coriolis-data-minion:test \
          coriolis/tests/integration/dockerfiles/data-minion/

    - name: Run integration tests
      shell: bash
      run: |
        sudo -E tox -e integration -v
