mirror of
https://github.com/saltstack-formulas/openssh-formula.git
synced 2026-05-11 16:14:49 +02:00
236 lines
10 KiB
YAML
236 lines
10 KiB
YAML
# -*- coding: utf-8 -*-
|
|
# vim: ft=yaml
|
|
---
|
|
###############################################################################
|
|
# Define all YAML node anchors
|
|
###############################################################################
|
|
.node_anchors:
|
|
# `only` (also used for `except` where applicable)
|
|
only_branch_master_parent_repo: &only_branch_master_parent_repo
|
|
- 'master@saltstack-formulas/openssh-formula'
|
|
# `stage`
|
|
stage_cache: &stage_cache 'cache'
|
|
stage_lint: &stage_lint 'lint'
|
|
stage_release: &stage_release 'release'
|
|
stage_test: &stage_test 'test'
|
|
# `image`
|
|
# yamllint disable rule:line-length
|
|
image_commitlint: &image_commitlint 'techneg/ci-commitlint:v1.1.98@sha256:f227ba6da3c684b5506fa338bdb82b17e7a7a3f75f56b2407632b43a7e7276a2'
|
|
image_dindruby: &image_dindruby 'techneg/ci-docker-python-ruby:v2.2.67@sha256:2887fb02ee694a97241777b043b1942b7e6803080e06dd18633f083eed463844'
|
|
image_dindrubybionic: &image_dindrubybionic 'techneg/ci-docker-python-ruby:v2.2.67@sha256:2887fb02ee694a97241777b043b1942b7e6803080e06dd18633f083eed463844'
|
|
image_precommit: &image_precommit 'techneg/ci-pre-commit:v2.4.32@sha256:fa9eef397583add95f4fccefa6ecbbf7a3845d6168f07393da7bc619696b246b'
|
|
image_rubocop: &image_rubocop 'pipelinecomponents/rubocop:latest@sha256:fe69f9642c7edde46bbd78326d2c42c6e13fc73694efb142e92e206725479328'
|
|
image_semantic-release: &image_semanticrelease 'techneg/ci-semantic-release:v1.1.0'
|
|
# `services`
|
|
services_docker_dind: &services_docker_dind
|
|
- 'docker:28.3.2-dind@sha256:44383404ebf0c36243f5969f0dddd23c204ea3bb185e7473a4141f6ccfd07b53'
|
|
# yamllint enable rule:line-length
|
|
# `variables`
|
|
# https://forum.gitlab.com/t/gitlab-com-ci-caching-rubygems/5627/3
|
|
# https://bundler.io/v2.3/man/bundle-config.1.html
|
|
variables_bundler: &variables_bundler
|
|
BUNDLE_PATH: '${CI_PROJECT_DIR}/.cache/bundler'
|
|
BUNDLE_DEPLOYMENT: 'true'
|
|
bundle_install: &bundle_install
|
|
- 'bundle version'
|
|
- 'bundle config list'
|
|
# `--no-cache` means don't bother caching the downloaded .gem files
|
|
- 'time bundle install --no-cache'
|
|
cache_bundler: &cache_bundler
|
|
key:
|
|
files:
|
|
- 'Gemfile.lock'
|
|
prefix: 'bundler'
|
|
paths:
|
|
- '${BUNDLE_PATH}'
|
|
# https://pre-commit.com/#gitlab-ci-example
|
|
variables_pre-commit: &variables_pre-commit
|
|
PRE_COMMIT_HOME: '${CI_PROJECT_DIR}/.cache/pre-commit'
|
|
cache_pre-commit: &cache_pre-commit
|
|
key:
|
|
files:
|
|
- '.pre-commit-config.yaml'
|
|
prefix: 'pre-commit'
|
|
paths:
|
|
- '${PRE_COMMIT_HOME}'
|
|
|
|
###############################################################################
|
|
# Define stages and global variables
|
|
###############################################################################
|
|
stages:
|
|
- *stage_cache
|
|
- *stage_lint
|
|
- *stage_test
|
|
- *stage_release
|
|
variables:
|
|
DOCKER_DRIVER: 'overlay2'
|
|
|
|
|
|
###############################################################################
|
|
# `cache` stage: build up the bundler cache required before the `test` stage
|
|
###############################################################################
|
|
build-cache:
|
|
stage: *stage_cache
|
|
image: *image_dindruby
|
|
variables: *variables_bundler
|
|
cache: *cache_bundler
|
|
script: *bundle_install
|
|
|
|
###############################################################################
|
|
# `lint` stage: `commitlint`, `pre-commit` & `rubocop` (latest, failure allowed)
|
|
###############################################################################
|
|
.lint_job:
|
|
stage: *stage_lint
|
|
needs: []
|
|
|
|
commitlint:
|
|
extends: '.lint_job'
|
|
image: *image_commitlint
|
|
script:
|
|
# Add `upstream` remote to get access to `upstream/master`
|
|
- 'git remote add upstream
|
|
https://gitlab.com/saltstack-formulas/openssh-formula.git'
|
|
- 'git fetch --all'
|
|
# Set default commit hashes for `--from` and `--to`
|
|
- 'export COMMITLINT_FROM="$(git merge-base upstream/master HEAD)"'
|
|
- 'export COMMITLINT_TO="${CI_COMMIT_SHA}"'
|
|
# `coqbot` adds a merge commit to test PRs on top of the latest commit in
|
|
# the repo; amend this merge commit message to avoid failure
|
|
- |
|
|
if [ "${GITLAB_USER_LOGIN}" = "coqbot" ] \
|
|
&& [ "${CI_COMMIT_BRANCH}" != "master" ]; then
|
|
git commit --amend -m \
|
|
'chore: reword coqbot merge commit message for commitlint'
|
|
export COMMITLINT_TO=HEAD
|
|
fi
|
|
# Run `commitlint`
|
|
- 'commitlint --from "${COMMITLINT_FROM}"
|
|
--to "${COMMITLINT_TO}"
|
|
--verbose'
|
|
|
|
pre-commit:
|
|
extends: '.lint_job'
|
|
image: *image_precommit
|
|
# https://pre-commit.com/#gitlab-ci-example
|
|
variables: *variables_pre-commit
|
|
cache: *cache_pre-commit
|
|
script:
|
|
- 'pre-commit run --all-files --color always --verbose'
|
|
- 'pre-commit run --color always --hook-stage manual commitlint-ci'
|
|
|
|
# Use a separate job for `rubocop` other than the one potentially run by `pre-commit`
|
|
# - The `pre-commit` check will only be available for formulas that pass the default
|
|
# `rubocop` check -- and must continue to do so
|
|
# - This job is allowed to fail, so can be used for all formulas
|
|
# - Furthermore, this job uses all of the latest `rubocop` features & cops,
|
|
# which will help when upgrading the `rubocop` linter used in `pre-commit`
|
|
rubocop:
|
|
extends: '.lint_job'
|
|
allow_failure: true
|
|
image: *image_rubocop
|
|
script:
|
|
- 'rubocop -d -P -S --enable-pending-cops'
|
|
|
|
###############################################################################
|
|
# Define `test` template
|
|
###############################################################################
|
|
.test_instance: &test_instance
|
|
stage: *stage_test
|
|
image: *image_dindruby
|
|
services: *services_docker_dind
|
|
variables: *variables_bundler
|
|
cache:
|
|
<<: *cache_bundler
|
|
policy: 'pull'
|
|
before_script: *bundle_install
|
|
script:
|
|
# Alternative value to consider: `${CI_JOB_NAME}`
|
|
- 'bin/kitchen verify "${DOCKER_ENV_CI_JOB_NAME}"'
|
|
|
|
###############################################################################
|
|
# Define `test` template (`allow_failure: true`)
|
|
###############################################################################
|
|
.test_instance_failure_permitted:
|
|
<<: *test_instance
|
|
allow_failure: true
|
|
|
|
###############################################################################
|
|
# `test` stage: each instance below uses the `test` template above
|
|
###############################################################################
|
|
## Define the rest of the matrix based on Kitchen testing
|
|
# Make sure the instances listed below match up with
|
|
# the `platforms` defined in `kitchen.yml`
|
|
# yamllint disable rule:line-length
|
|
# Fedora 41+ will permit failure until this PR is merged into kitchen-docker
|
|
# https://github.com/test-kitchen/kitchen-docker/pull/427 is merged
|
|
# OpenSUSE master branch will fail until zypperpkg module is back in salt core
|
|
# https://github.com/saltstack/great-module-migration/issues/14
|
|
#
|
|
almalinux-9-master: {extends: '.test_instance_failure_permitted'}
|
|
almalinux-8-master: {extends: '.test_instance_failure_permitted'}
|
|
amazonlinux-2023-master: {extends: '.test_instance_failure_permitted'}
|
|
amazonlinux-2-master: {extends: '.test_instance_failure_permitted'}
|
|
centos-stream9-master: {extends: '.test_instance_failure_permitted'}
|
|
debian-12-master: {extends: '.test_instance_failure_permitted'}
|
|
debian-11-master: {extends: '.test_instance_failure_permitted'}
|
|
fedora-41-master: {extends: '.test_instance_failure_permitted'}
|
|
fedora-40-master: {extends: '.test_instance_failure_permitted'}
|
|
opensuse-leap-156-master: {extends: '.test_instance_failure_permitted'}
|
|
opensuse-tmbl-latest-master: {extends: '.test_instance_failure_permitted'}
|
|
oraclelinux-9-master: {extends: '.test_instance_failure_permitted'}
|
|
oraclelinux-8-master: {extends: '.test_instance_failure_permitted'}
|
|
rockylinux-9-master: {extends: '.test_instance_failure_permitted'}
|
|
rockylinux-8-master: {extends: '.test_instance_failure_permitted'}
|
|
ubuntu-2404-master: {extends: '.test_instance_failure_permitted'}
|
|
ubuntu-2204-master: {extends: '.test_instance_failure_permitted'}
|
|
ubuntu-2004-master: {extends: '.test_instance_failure_permitted'}
|
|
almalinux-9-3007-6: {extends: '.test_instance'}
|
|
almalinux-8-3007-6: {extends: '.test_instance'}
|
|
amazonlinux-2023-3007-6: {extends: '.test_instance'}
|
|
amazonlinux-2-3007-6: {extends: '.test_instance_failure_permitted'}
|
|
centos-stream9-3007-6: {extends: '.test_instance'}
|
|
debian-12-3007-6: {extends: '.test_instance'}
|
|
debian-11-3007-6: {extends: '.test_instance'}
|
|
fedora-41-3007-6: {extends: '.test_instance_failure_permitted'}
|
|
fedora-40-3007-6: {extends: '.test_instance'}
|
|
opensuse-leap-156-3007-6: {extends: '.test_instance'}
|
|
opensuse-tmbl-latest-3007-6: {extends: '.test_instance'}
|
|
oraclelinux-9-3007-6: {extends: '.test_instance'}
|
|
oraclelinux-8-3007-6: {extends: '.test_instance'}
|
|
rockylinux-9-3007-6: {extends: '.test_instance'}
|
|
rockylinux-8-3007-6: {extends: '.test_instance'}
|
|
ubuntu-2404-3007-6: {extends: '.test_instance'}
|
|
ubuntu-2204-3007-6: {extends: '.test_instance'}
|
|
ubuntu-2004-3007-6: {extends: '.test_instance'}
|
|
almalinux-9-3006-14: {extends: '.test_instance'}
|
|
almalinux-8-3006-14: {extends: '.test_instance'}
|
|
amazonlinux-2023-3006-14: {extends: '.test_instance'}
|
|
amazonlinux-2-3006-14: {extends: '.test_instance_failure_permitted'}
|
|
centos-stream9-3006-14: {extends: '.test_instance'}
|
|
debian-12-3006-14: {extends: '.test_instance'}
|
|
debian-11-3006-14: {extends: '.test_instance'}
|
|
fedora-41-3006-14: {extends: '.test_instance_failure_permitted'}
|
|
fedora-40-3006-14: {extends: '.test_instance'}
|
|
opensuse-leap-156-3006-14: {extends: '.test_instance'}
|
|
opensuse-tmbl-latest-3006-14: {extends: '.test_instance'}
|
|
oraclelinux-9-3006-14: {extends: '.test_instance'}
|
|
oraclelinux-8-3006-14: {extends: '.test_instance'}
|
|
rockylinux-9-3006-14: {extends: '.test_instance'}
|
|
rockylinux-8-3006-14: {extends: '.test_instance'}
|
|
ubuntu-2404-3006-14: {extends: '.test_instance'}
|
|
ubuntu-2204-3006-14: {extends: '.test_instance'}
|
|
ubuntu-2004-3006-14: {extends: '.test_instance'}
|
|
# yamllint enable rule:line-length
|
|
|
|
###############################################################################
|
|
# `release` stage: `semantic-release`
|
|
###############################################################################
|
|
semantic-release:
|
|
stage: *stage_release
|
|
image: *image_semanticrelease
|
|
variables:
|
|
MAINTAINER_TOKEN: '${GH_TOKEN}'
|
|
script:
|
|
# Run `semantic-release`
|
|
- 'semantic-release'
|