Skip to content

Instantly share code, notes, and snippets.

@shantanoo-desai
Last active April 20, 2023 15:44
Show Gist options
  • Save shantanoo-desai/52a533c17a1e2613c27cdd7d5c12dcbe to your computer and use it in GitHub Desktop.
Save shantanoo-desai/52a533c17a1e2613c27cdd7d5c12dcbe to your computer and use it in GitHub Desktop.
include: '.gitlab-ci-config.yml'
stages:
- single_test
{% for testcase in tests %}
test_{{ testcase.number }}:
extends:
- .test
script:
- ci/prepare_tests.sh -s {{ testcase.number }}
- ci/run_test.sh
- ci/qemu/stop_qemu.sh
{% endfor %}
---
- hosts: localhost
gather_facts: false
tasks:
- name: Obtaining Test Cases Information from the "Tests" Directory
ansible.builtin.find:
paths: "{{ playbook_dir }}/../Tests"
recurse: false
excludes: '000_Template'
patterns: "{{ omit if custom is not defined else (custom | map('regex_replace', '^(.*)$', '\\1_*')) }}"
file_type: directory
register: testcases
- debug: var=testcases
- set_fact:
tests: "{{ tests|default([]) + [ { 'number': item | basename | split('_') | first, 'name': item | basename } ] }}"
loop: "{{ testcases.files | map(attribute='path') | list }}"
- name: generate Gitlab-CI File
template:
src: "{{ playbook_dir }}/templates/.gitlab-ci-single_test.yml.j2"
dest: "./.gitlab-ci-single_test.yml"
Tests/
├── 000_Template
├── 001_startup_completion
├── 002_NR_Influx_Std
├── 003_PY_Influx_Std
├── 004_PY_MYSQL_Std
├── 005_PY_Influx_MQTT
├── 007_Chronograf
├── 008_Grafana
├── 010_MQTT_Basic_Test
├── 011_MySQL_Basic_Test
├── 012_MySQL_User_Privileges
├── 013_influxdb_user_privileges_test
├── 014_Grafana_Datasources
├── 900_changePW_frontend_playwright
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment