# This image is created from test/Dockerfile
image: registry.gitlab.com/sosy-lab/software/cpu-energy-meter/test:latest

variables:
  GIT_SUBMODULE_STRATEGY: recursive

before_script:
  - make clean

stages:
  - build
  - test
  - dist

build:
  stage: build
  script:
    - make
  artifacts:
    paths:
      - cpu-energy-meter

test:
  stage: test
  script:
    - make test

deb:
  stage: dist
  script:
    - scripts/create_deb.sh
  artifacts:
    paths:
      - "*.deb"

# This image is created from test/Dockerfile
image: registry.gitlab.com/sosy-lab/software/cpu-energy-meter/test:latest

variables:
  GIT_SUBMODULE_STRATEGY: recursive

before_script:
  - make clean

stages:
  - images
  - build
  - test
  - dist

build:
  stage: build
  script:
    - make
  artifacts:
    paths:
      - cpu-energy-meter

test:
  stage: test
  script:
    - make test

deb:
  stage: dist
  script:
    - scripts/create_deb.sh
  artifacts:
    paths:
      - "*.deb"

# Build Docker images
# following this guideline: https://docs.gitlab.com/ee/ci/docker/using_kaniko.html
.build-docker:
  stage: images
  image:
    name: gcr.io/kaniko-project/executor:debug
    entrypoint: [""]
  script:
    - mkdir -p /root/.docker
    - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
    - /kaniko/executor --dockerfile $CI_PROJECT_DIR/$DOCKERFILE --destination $CI_REGISTRY_IMAGE/$IMAGE
  only:
    - schedules
    - web

build-docker:test:
  extends: .build-docker
  variables:
    DOCKERFILE: test/Dockerfile
    IMAGE: test:latest

Add CI job for rebuilding Docker images
Add CI job for rebuilding Docker images
