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

variables:
    APP_NAME: decorder

stages:
    - test
    - build
    - release

test:
    stage: test
    image: golang:1.21.0@sha256:b490ae1f0ece153648dd3c5d25be59a63f966b5f9e1311245c947de4506981aa
    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.54.2-alpine@sha256:e950721f6ae622dcc041f57cc0b61c3a78d4bbfc588facfc8b0166901a9f4848
    script:
        - apk add make bash
        - make settings
        - '### run linter ###'
        - golangci-lint run ./...

license-check:
    stage: test
    image: golang:1.21.0@sha256:b490ae1f0ece153648dd3c5d25be59a63f966b5f9e1311245c947de4506981aa
    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.21.0@sha256:b490ae1f0ece153648dd3c5d25be59a63f966b5f9e1311245c947de4506981aa
    only:
        - tags
    script:
        - make gitlab-pages
    artifacts:
        paths:
            - public/
