summary refs log tree commit diff
path: root/.gitlab-ci.yml
blob: eaee607b7c2d7f02500ca32636de69bfb133402b (plain)
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
variables:
  DOCKER_DRIVER: overlay2
  KERNEL: "bzImage"
  ROOTFS_NAME: "stretch.img"
  ROOTFS_IMAGE_URL: "https://gitlab.steamos.cloud/api/v4/projects/kernel-research%2Frootfs/jobs/128684/artifacts"
  GIT_AUTHOR_NAME: "Gitlab-ci"
  GIT_AUTHOR_EMAIL: "gitlab@gitlab.steamos.cloud"
  TAG: CI_${CI_PIPELINE_ID}_${CI_COMMIT_SHORT_SHA}

before_script:
  - apt-get update -y

stages:
  - build

kernel build:
  stage: build
  tags:
    - autoscaled
  before_script:
    - apt-get update -y
    - apt-get install -y rsync git build-essential bc kmod cpio flex libncurses5-dev bison libssl-dev libelf-dev openssh-client curl qemu-system* unzip python3
  script:
    - make x86_64_defconfig && make kvm_guest.config
    - ./scripts/kconfig/merge_config.sh .config .config-fragment
    - make -j`nproc`
    - git rev-parse HEAD &> commit_id_file
    - cp -v arch/x86/boot/bzImage .
    - cp .config kernel_config
    # download rootfs
    - 'curl -L --header "PRIVATE-TOKEN: ${KERNEL_RESEARCH_ROOTFS_TOKEN}" "${ROOTFS_IMAGE_URL}" --output artifact.zip'
    - unzip artifact.zip
    - qemu-system-x86_64 -enable-kvm -nographic -kernel ${KERNEL} -drive file=${ROOTFS_NAME},format=raw -device virtio-serial-pci -virtfs local,path=$(pwd),mount_tag=steamlogs,security_model=none -m 2G -smp 2 -cpu host -net user,hostfwd=tcp::2222-:22 -net nic,model=virtio --append "root=/dev/sda rw console=ttyS0" &
    - QEMU_PID=$!
    - echo "QEMU pid is $QEMU_PID"
    - sleep 90
    - tail --pid=$QEMU_PID -f kernel_results.log

    # notify
    - test -f "fail.txt" && exit 1
    - echo "All tests passed."

  artifacts:
    expire_in: 1 week
    when: always
    paths:
      - bzImage
      - kernel_config
      - kernel_results.log