1name: Build and Test CI 2 3on: 4 workflow_dispatch: 5 push: 6 branches: [ "next" ] 7 pull_request: 8 branches: [ "next" ] 9 10env: 11 URING_VER: "2.3" 12 13jobs: 14 build: 15 runs-on: ubuntu-22.04 16 steps: 17 - name: "acquire: ubdsrv" 18 uses: actions/checkout@v3 19 with: 20 path: ubdsrv 21 22 - name: "acquire: liburing" 23 run: | 24 wget https://brick.kernel.dk/snaps/liburing-$URING_VER.tar.gz 25 tar xzvf liburing-$URING_VER.tar.gz 26 27 - name: "build: liburing" 28 working-directory: liburing-${{ env.URING_VER }} 29 shell: bash 30 run: | 31 ./configure 32 make -j$(nproc) 33 sudo make install 34 35 - name: "build: ubdsrv with --enable-debug" 36 working-directory: ubdsrv 37 run: | 38 LIBURING_DIR=${{ github.workspace }}/liburing-$URING_VER ./build_with_liburing_src --enable-debug 39 40 - name: "build: ubdsrv" 41 working-directory: ubdsrv 42 run: | 43 make distclean 44 LIBURING_DIR=${{ github.workspace }}/liburing-$URING_VER ./build_with_liburing_src 45 46 - name: "build: installable artifacts" 47 working-directory: ubdsrv 48 shell: bash 49 run: | 50 mkdir -p ${{ github.workspace }}/files 51 make DESTDIR=${{ github.workspace }}/files install 52 53 - name: "publish: installable artifacts" 54 uses: actions/upload-artifact@v3 55 with: 56 name: ubdsrv 57 if-no-files-found: error 58 path: ${{ github.workspace }}/files/** 59 60 - name: "publish: logs" 61 uses: actions/upload-artifact@v3 62 if: always() 63 with: 64 name: build-logs 65 if-no-files-found: ignore 66 path: ubdsrv/*.log 67 68 test: 69 runs-on: ubuntu-22.04 70 timeout-minutes: 120 71 steps: 72 - name: "install: mkosi + dependencies" 73 shell: bash 74 run: | 75 sudo apt update -o Acquire::Retries=3 76 sudo apt install -y dnf rpm systemd-container qemu-system-x86 ovmf e2fsprogs btrfs-progs 77 #python3 -m pip install --user git+https://github.com/systemd/mkosi.git 78 #python3 -m pip install --user https://github.com/systemd/mkosi/archive/refs/tags/v14.tar.gz 79 wget https://github.com/systemd/mkosi/archive/refs/tags/v14.tar.gz 80 tar zxf v14.tar.gz 81 cd mkosi-14 82 sed -i '/gpgurl\ = \urllib.parse.urljoin/c \ gpgurl\ =\ \"https://fedoraproject.org/fedora.gpg\"' ./mkosi/__init__.py 83 sed -i 's/gpgcheck = True/gpgcheck = False/g' ./mkosi/__init__.py 84 python3 -m pip install --user ./ 85 86 # Required for ssh'ing into VM 87 - name: "setup: environment" 88 run: | 89 sudo systemctl enable --now systemd-networkd 90 91 - name: "cache: os packages" 92 uses: actions/cache@v3 93 with: 94 path: ~/mkosi.cache 95 key: fedora-cache-v2 96 97 - name: "acquire: ubdsrv" 98 uses: actions/checkout@v3 99 100 - name: "build: fedora image" 101 working-directory: ci 102 run: | 103 [ -d ~/mkosi.cache ] && ln -s mkosi.cache ~/mkosi.cache 104 sudo $(which mkosi) build 105 if [ ! -d ~/mkosi.cache ]; then cp -fr ./mkosi.cache ~/; fi 106 107 - name: "start: boot fedora in qemu" 108 working-directory: ci 109 run: | 110 RUNNER_TRACKING_ID="" && sudo $(which mkosi) qemu -serial none -monitor none -display none -device virtio-net-pci,netdev=network0 -netdev user,id=network0,hostfwd=tcp:127.0.0.1:5555-:22 | tee ${{ github.workspace }}/qemu.log & 111 112 - name: "connect: check ssh connection" 113 shell: bash 114 timeout-minutes: 10 115 working-directory: ci 116 run: | 117 until mkosi ssh uname -a; do 118 echo "Retrying..." 119 sleep 0.25 120 done 121 122 - name: "test: run ublk" 123 working-directory: ci 124 run: | 125 mkosi ssh ublk list 126 127 - name: "test: run tests" 128 working-directory: ci 129 run: | 130 mkosi ssh UBLK=ublk /usr/share/tests/run_test.sh all 10 tests/tmp/ 131 132 - name: "cleanup" 133 if: always() 134 continue-on-error: true 135 run: | 136 cat ${{ github.workspace }}/qemu.log 137 sudo pkill -f qemu 138