File: action.yml

package info (click to toggle)
fio 3.41-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,012 kB
  • sloc: ansic: 82,290; python: 9,862; sh: 6,067; makefile: 813; yacc: 204; lex: 184
file content (60 lines) | stat: -rw-r--r-- 1,873 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: 'Start QEMU VM'
description: 'Start QEMU virtual machine'

inputs:
  qemu: # QEMU binary to use
    required: false
    default: "qemu-system-x86_64"
  image: # VM image file
    required: true
  ssh_fwd_port: # forward this host port to the guest's SSH port
    required: false
    default: 2022
  options: # Custom QEMU invocation options no \n at the end!
    required: false
  ram: # how much RAM to allocate to VM
    required: false
    default: "12G"
  host_key: # If true add guest host key to known_hosts
    required: false
    default: "false"

runs:
  using: "composite"
  steps:
    - name: install wait-for-it
      shell: bash
      run: sudo apt update && sudo apt-get -qq install wait-for-it
    - name: Enable KVM group perms
      shell: bash
      run: |
        echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
        sudo udevadm control --reload-rules
        sudo udevadm trigger --name-match=kvm
    - name: Start VM in background
      shell: bash
      run: |
        ${{ inputs.qemu }} \
          -cpu host \
          -drive file=${{ inputs.image }},format=raw,if=virtio \
          -enable-kvm \
          -smp $(nproc) \
          -nographic \
          -m ${{ inputs.ram }} \
          -display none \
          -machine q35,accel=kvm \
          -nic user,model=virtio-net-pci,hostfwd=tcp::${{ inputs.ssh_fwd_port }}-:22 \
          ${{ inputs.options }} \
          &
    - name: Wait for VM to boot
      shell: bash
      run: |
        wait-for-it localhost:${{ inputs.ssh_fwd_port }} -t 15
        sleep 3
    - name: Add guest host key to known_hosts
      shell: bash
      run: |
        if echo ${{ inputs.host_key }} | grep -c "true"
        then
          ssh root@localhost -p ${{ inputs.ssh_fwd_port }} -o StrictHostKeyChecking=no echo
        fi