Merge "haskell-stack-test: add build target job variable"

This commit is contained in:
Zuul 2020-05-11 16:20:03 +00:00 committed by Gerrit Code Review
commit 1ab22a3b44
4 changed files with 20 additions and 2 deletions

View File

@ -2,6 +2,10 @@ Run the Haskell stack test command.
**Role Variables** **Role Variables**
.. zuul:rolevar:: haskell_stack_target
The stack target(s) to test.
.. zuul:rolevar:: lts_version .. zuul:rolevar:: lts_version
The lts version. The lts version.

View File

@ -1,2 +1,7 @@
haskell_stack_target: ""
lts_version: "" lts_version: ""
zuul_work_dir: "{{ zuul.project.src_dir }}" zuul_work_dir: "{{ zuul.project.src_dir }}"
_stack_resolver_args: "{% if lts_version %}--resolver {{ lts_version }}{% endif %}"
_stack_build_args: "{{ _stack_resolver_args }} --test --no-run-tests {{ haskell_stack_target }}"
_stack_test_args: "{{ _stack_resolver_args }} {{ haskell_stack_target }}"

View File

@ -1,4 +1,9 @@
- name: Run stack test - name: Run stack build {{ _stack_build_args }}
command: "stack {% if lts_version %}--resolver {{ lts_version }}{% endif %} test" command: "stack build {{ _stack_build_args }}"
args:
chdir: "{{ zuul_work_dir }}"
- name: Run stack test {{ _stack_test_args }}
command: "stack test {{ _stack_test_args }}"
args: args:
chdir: "{{ zuul_work_dir }}" chdir: "{{ zuul_work_dir }}"

View File

@ -22,6 +22,10 @@
description: | description: |
Run stack test for a Haskell project. Run stack test for a Haskell project.
.. zuul:jobvar:: haskell_stack_target
The stack target(s) to test.
.. zuul:jobvar:: lts_version .. zuul:jobvar:: lts_version
Use the specified lts version. Use the specified lts version.