Enable installing nimble siblings

Change-Id: I58f7b3038bd8239d5f04f66a18aad56ec77dad7d
This commit is contained in:
Albin Vass 2020-12-05 18:56:53 +01:00
parent 5b3a48e73b
commit 49b06e31de
8 changed files with 50 additions and 2 deletions

View File

@ -10,7 +10,22 @@ Run nimble command in a source directory. Assumes the appropriate version of nim
.. zuul:rolevar:: nim_path
Path where nim and nimble are installed.
Path to a directory where nim and nimble are installed.
.. zuul:rolevar:: nimble_use_siblings
:type: bool
:default: true
Whether to configure nimble to build with siblings or not.
.. zuul:rolevar:: nimble_siblings
:type: list
List of paths to directories containing nim projects to
configure nimble with ``nimble develop``. The projects
have to be managed by nimble and contain a ``.nimble``
file. By default this role will try to configure any
repos made available with ``job.required-projects``.
.. zuul:rolevar:: zuul_work_dir
:default: {{ zuul.project.src_dir }}

View File

@ -1,2 +1,5 @@
nimble_command: build
nimble_use_siblings: true
nimble_siblings: "{{ zuul.projects.values() | selectattr('required') | map(attribute='src_dir') | list }}"
zuul_work_dir: "{{ zuul.project.src_dir }}"

View File

@ -1,3 +1,14 @@
- name: Configure siblings
when: nimble_use_siblings
command: nimble develop
environment:
PATH: "{{ nim_path }}:{{ ansible_env.PATH }}"
args:
chdir: "{{ zj_nimble_siblings }}"
loop: "{{ nimble_siblings }}"
loop_control:
loop_var: zj_nimble_siblings
- name: Run nimble
command: "nimble {{ nimble_command }} --accept"
args:

View File

@ -0,0 +1,12 @@
# Package
version = "0.1.0"
author = "Albin Vass"
description = "A new awesome nimble package"
license = "MIT"
srcDir = "src"
# Dependencies
requires "nim >= 1.4.2"

View File

@ -0,0 +1,2 @@
proc helloWorld*() =
echo "Hello world!"

View File

@ -1 +1,3 @@
echo "Hello world!"
import sibling
helloWorld()

View File

@ -11,3 +11,4 @@ bin = @["test"]
# Dependencies
requires "nim >= 1.4.0"
requires "sibling"

View File

@ -10,6 +10,8 @@
- test-playbooks/nimble
vars:
zuul_work_dir: '{{ zuul.project.src_dir }}/test-playbooks/nimble'
nimble_siblings:
- '{{ zuul.project.src_dir }}/test-playbooks/nimble/sibling'
- job:
name: zuul-jobs-test-nimble-centos-7