.gitlab-ci.yml 1.84 KB
Newer Older
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
stages:
- prepare
- build
- test

variables:
  DOCKER_FILE: Dockerfile
  DOCKER_TAG: latest
  DOCKER_IMAGE: ${CI_REGISTRY_IMAGE}
  GIT_SUBMODULE_STRATEGY: normal

.prepare:docker: &prepare_docker
  stage: prepare
  image:
    name: quay.io/buildah/stable
  variables:
    _BUILDAH_STARTED_IN_USERNS: ""
    BUILDAH_ISOLATION: chroot
    BUILDAH_LAYERS: "true"
  before_script:
  - buildah version
  - buildah login --username "${CI_REGISTRY_USER}" --password "${CI_REGISTRY_PASSWORD}" "${CI_REGISTRY}"
  script:
  - buildah bud -f ${DOCKER_FILE} -t ${DOCKER_IMAGE}:${DOCKER_TAG} .
  - buildah push ${DOCKER_IMAGE}:${DOCKER_TAG} docker://${DOCKER_IMAGE}:${DOCKER_TAG}
  after_script:
  - buildah logout "${CI_REGISTRY}"
  tags:
  - builder

prepare:docker:
  <<: *prepare_docker

build:uhyve:
  stage: build
  image: ${CI_REGISTRY_IMAGE}
  script:
    - cargo build
    - cargo build --release
  artifacts:
    paths:
      - target/debug/uhyve
      - target/release/uhyve

test:demo:
   stage: test
   dependencies:
     - build:uhyve
   image: ${CI_REGISTRY_IMAGE}
   script:
     - lscpu
     - kvm-ok
     - cargo test -- --nocapture
     - cd $CI_BUILDS_DIR
     - git clone --recurse-submodules https://github.com/hermitcore/rusty-hermit.git
     - cd -
     - cd $CI_BUILDS_DIR/rusty-hermit
     - cargo build -p rusty_demo
     - RUSTFLAGS="-Clinker-plugin-lto" cargo build -p rusty_demo --release
     - cd -
Stefan Lankes's avatar
Stefan Lankes committed
61
     - target/debug/uhyve -v -c 1 $CI_BUILDS_DIR/rusty-hermit/target/x86_64-unknown-hermit/debug/rusty_demo
62
63
64
65
66
     - target/debug/uhyve -v -c 2 $CI_BUILDS_DIR/rusty-hermit/target/x86_64-unknown-hermit/debug/rusty_demo
     - target/release/uhyve -v -c 1 $CI_BUILDS_DIR/rusty-hermit/target/x86_64-unknown-hermit/release/rusty_demo
     - target/release/uhyve -v -c 2 $CI_BUILDS_DIR/rusty-hermit/target/x86_64-unknown-hermit/release/rusty_demo
   tags:
     - privileged