Merge "Add nimble roles and job"

This commit is contained in:
Zuul 2020-11-12 22:44:33 +00:00 committed by Gerrit Code Review
commit 0c5dcd17ea
16 changed files with 274 additions and 0 deletions

View File

@ -12,5 +12,6 @@ Jobs
hashicorp-jobs
haskell-jobs
helm-jobs
nim-jobs
system-jobs
deprecated-jobs

4
doc/source/nim-jobs.rst Normal file
View File

@ -0,0 +1,4 @@
Nim Jobs
========
.. zuul:autojob:: nimble

6
doc/source/nim-roles.rst Normal file
View File

@ -0,0 +1,6 @@
Nim Roles
=========
.. zuul:autorole:: ensure-nimble
.. zuul:autorole:: nimble

View File

@ -23,6 +23,7 @@ Roles
js-roles
kubernetes-roles
launchpad-roles
nim-roles
puppet-roles
python-roles
rust-roles

View File

@ -0,0 +1,3 @@
- hosts: all
roles:
- ensure-nimble

View File

@ -0,0 +1,3 @@
- hosts: all
roles:
- nimble

View File

@ -0,0 +1,6 @@
Install nim
**Role Variables**
.. zuul:rolevar:: nim_version
:default: stable

View File

@ -0,0 +1 @@
nim_version: stable

View File

@ -0,0 +1,35 @@
- name: Set nim_path fact
set_fact:
nim_path: "{{ ansible_user_dir }}/.nimble/bin/"
cacheable: true
- name: Check if nimble is installed
command: nimble --version
environment:
PATH: "{{ nim_path }}:{{ ansible_env.PATH }}"
failed_when: false
changed_when: false
register: _nimble_installed
- when: _nimble_installed.rc != 0
block:
- name: Create tempfile for choosenim install script
tempfile:
register: choosenim_installer
- name: Install nim with choosenim
get_url:
url: https://nim-lang.org/choosenim/init.sh
dest: "{{ choosenim_installer.path }}"
mode: 0755
- name: Install nim
command: "{{ choosenim_installer.path }} -y"
environment:
CHOOSENIM_NO_ANALYTICS: 1
CHOOSENIM_CHOOSE_VERSION: "{{ nim_version }}"
always:
- name: Remove installer tempfile
file:
state: absent
path: "{{ choosenim_installer.path }}"

18
roles/nimble/README.rst Normal file
View File

@ -0,0 +1,18 @@
Run nimble command in a source directory. Assumes the appropriate version of nim and nimble is installed.
**Role Variables**
.. zuul:rolevar:: nimble_command
:default: build
Nimble command to run.
Examples are "build", "run" or "test".
.. zuul:rolevar:: nim_path
Path where nim and nimble are installed.
.. zuul:rolevar:: zuul_work_dir
:default: {{ zuul.project.src_dir }}
Directory to run nimble in.

View File

@ -0,0 +1,2 @@
nimble_command: build
zuul_work_dir: "{{ zuul.project.src_dir }}"

View File

@ -0,0 +1,6 @@
- name: Run nimble
command: "nimble {{ nimble_command }} --accept"
args:
chdir: "{{ zuul_work_dir }}"
environment:
PATH: "{{ nim_path }}:{{ ansible_env.PATH }}"

View File

@ -0,0 +1 @@
echo "Hello world!"

View File

@ -0,0 +1,13 @@
# Package
version = "0.1.0"
author = "Albin Vass"
description = "A new awesome nimble package"
license = "MIT"
srcDir = "src"
bin = @["test"]
# Dependencies
requires "nim >= 1.4.0"

152
zuul-tests.d/nim-jobs.yaml Normal file
View File

@ -0,0 +1,152 @@
- job:
name: zuul-jobs-test-nimble
parent: nimble
description: Test the nimble job
tags: all-platforms
files:
- playbooks/nimble
- roles/ensure-nimble
- roles/nimble
- test-playbooks/nimble
vars:
zuul_work_dir: '{{ zuul.project.src_dir }}/test-playbooks/nimble'
- job:
name: zuul-jobs-test-nimble-centos-7
description: Test the nimble job on centos-7
parent: zuul-jobs-test-nimble
tags: auto-generated
nodeset:
nodes:
- name: centos-7
label: centos-7
- job:
name: zuul-jobs-test-nimble-centos-8
description: Test the nimble job on centos-8
parent: zuul-jobs-test-nimble
tags: auto-generated
nodeset:
nodes:
- name: centos-8
label: centos-8
- job:
name: zuul-jobs-test-nimble-centos-8-stream
description: Test the nimble job on centos-8-stream
parent: zuul-jobs-test-nimble
tags: auto-generated
nodeset:
nodes:
- name: centos-8-stream
label: centos-8-stream
- job:
name: zuul-jobs-test-nimble-debian-stretch
description: Test the nimble job on debian-stretch
parent: zuul-jobs-test-nimble
tags: auto-generated
nodeset:
nodes:
- name: debian-stretch
label: debian-stretch
- job:
name: zuul-jobs-test-nimble-fedora-32
description: Test the nimble job on fedora-32
parent: zuul-jobs-test-nimble
tags: auto-generated
nodeset:
nodes:
- name: fedora-32
label: fedora-32
- job:
name: zuul-jobs-test-nimble-gentoo-17-0-systemd
description: Test the nimble job on gentoo-17-0-systemd
parent: zuul-jobs-test-nimble
tags: auto-generated
nodeset:
nodes:
- name: gentoo-17-0-systemd
label: gentoo-17-0-systemd
- job:
name: zuul-jobs-test-nimble-opensuse-15
description: Test the nimble job on opensuse-15
parent: zuul-jobs-test-nimble
tags: auto-generated
nodeset:
nodes:
- name: opensuse-15
label: opensuse-15
- job:
name: zuul-jobs-test-nimble-opensuse-tumbleweed-nv
voting: false
description: Test the nimble job on opensuse-tumbleweed
parent: zuul-jobs-test-nimble
tags: auto-generated
nodeset:
nodes:
- name: opensuse-tumbleweed
label: opensuse-tumbleweed
- job:
name: zuul-jobs-test-nimble-ubuntu-bionic
description: Test the nimble job on ubuntu-bionic
parent: zuul-jobs-test-nimble
tags: auto-generated
nodeset:
nodes:
- name: ubuntu-bionic
label: ubuntu-bionic
- job:
name: zuul-jobs-test-nimble-ubuntu-xenial
description: Test the nimble job on ubuntu-xenial
parent: zuul-jobs-test-nimble
tags: auto-generated
nodeset:
nodes:
- name: ubuntu-xenial
label: ubuntu-xenial
- job:
name: zuul-jobs-test-nimble-ubuntu-focal
description: Test the nimble job on ubuntu-focal
parent: zuul-jobs-test-nimble
tags: auto-generated
nodeset:
nodes:
- name: ubuntu-focal
label: ubuntu-focal
- project:
check:
jobs:
- zuul-jobs-test-nimble-centos-7
- zuul-jobs-test-nimble-centos-8
- zuul-jobs-test-nimble-centos-8-stream
- zuul-jobs-test-nimble-debian-stretch
- zuul-jobs-test-nimble-fedora-32
- zuul-jobs-test-nimble-gentoo-17-0-systemd
- zuul-jobs-test-nimble-opensuse-15
- zuul-jobs-test-nimble-opensuse-tumbleweed-nv
- zuul-jobs-test-nimble-ubuntu-bionic
- zuul-jobs-test-nimble-ubuntu-xenial
- zuul-jobs-test-nimble-ubuntu-focal
gate:
jobs: &id001
- zuul-jobs-test-nimble-centos-7
- zuul-jobs-test-nimble-centos-8
- zuul-jobs-test-nimble-centos-8-stream
- zuul-jobs-test-nimble-debian-stretch
- zuul-jobs-test-nimble-fedora-32
- zuul-jobs-test-nimble-gentoo-17-0-systemd
- zuul-jobs-test-nimble-opensuse-15
- zuul-jobs-test-nimble-ubuntu-bionic
- zuul-jobs-test-nimble-ubuntu-xenial
- zuul-jobs-test-nimble-ubuntu-focal
periodic-weekly:
jobs: *id001

22
zuul.d/nim-jobs.yaml Normal file
View File

@ -0,0 +1,22 @@
- job:
name: nimble
parent: unittests
description: |
Base job for nim operations
Responds to these variables:
..zuul:jobvar:: nimble_command
:default: build
.. zuul:jobvar:: nim_version
:default: stable
The version of nim to use.
.. zuul:jobvar:: zuul_work_dir
::default: {{ zuul.project.src_dir }}
Path to operate in.
pre-run: playbooks/nimble/pre.yaml
run: playbooks/nimble/run.yaml