###############################
# This file is auto-generated #
###############################

variables:
    APP_NAME: decorder

stages:
    - test
    - build
    - release

test:
    stage: test
    image: golang:1.18.4@sha256:9349ed889adb906efa5ebc06485fe1b6a12fb265a01c9266a137bb1352565560
    before_script:
        - set -eu
        - if [[ -f .env.pipeline ]];then cp .env.pipeline .env;fi
        - mkdir -p ~/.ssh
        - touch ~/.ssh/known_hosts
        - ssh-keyscan gitlab.com > ~/.ssh/known_hosts
    retry: 2
    script:
        - '### run tests ###'
        - make test
        - make test-cover

lint:source-code:
    stage: test
    image: golangci/golangci-lint:v1.47.2-alpine@sha256:10ed4891fdd1f7249f5e39d7c17ea746ce26adada3c05686c6aa31290abcd180
    script:
        - '### run linter ###'
        - golangci-lint run ./...

license-check:
    stage: test
    image: golang:1.18.4@sha256:9349ed889adb906efa5ebc06485fe1b6a12fb265a01c9266a137bb1352565560
    before_script:
        - set -eu
        - if [[ -f .env.pipeline ]];then cp .env.pipeline .env;fi
        - mkdir -p ~/.ssh
        - touch ~/.ssh/known_hosts
        - ssh-keyscan gitlab.com > ~/.ssh/known_hosts
    script:
        - '### run license-check ###'
        - make check-licenses
    artifacts:
        paths:
            - LICENSES-3RD-PARTY
        expire_in: 7 days

pages:
    stage: release
    image: golang:1.18.4@sha256:9349ed889adb906efa5ebc06485fe1b6a12fb265a01c9266a137bb1352565560
    only:
        - tags
    script:
        - make gitlab-pages
    artifacts:
        paths:
            - public/
