cabal-test: add build target job variable
This change adds support for custom target and removes the configure step which is not necessary. This change also uses the copr of cabal-install to get a more up-to-date version. Change-Id: I538e2b24abb66181d1ead2779bf6aa3440ee58ff
This commit is contained in:
parent
64741aa73d
commit
7fdf0cc3ab
@ -2,6 +2,10 @@ Run the cabal test command.
|
||||
|
||||
**Role Variables**
|
||||
|
||||
.. zuul:rolevar:: cabal_target
|
||||
|
||||
The cabal target(s) to test.
|
||||
|
||||
.. zuul:rolevar:: zuul_work_dir
|
||||
:default: {{ zuul.project.src_dir }}
|
||||
|
||||
|
@ -1 +1,7 @@
|
||||
cabal_target: ""
|
||||
|
||||
zuul_work_dir: "{{ zuul.project.src_dir }}"
|
||||
|
||||
_cabal_install_args: "--only-dependencies {{ cabal_target }}"
|
||||
_cabal_build_args: "--enable-tests {{ cabal_target }}"
|
||||
_cabal_test_args: "{{ cabal_target }}"
|
||||
|
@ -1,19 +1,14 @@
|
||||
- name: Run cabal install --only-dependencies
|
||||
command: cabal install --only-dependencies
|
||||
- name: Run cabal install {{ _cabal_install_args }}
|
||||
command: "cabal install {{ _cabal_install_args }}"
|
||||
args:
|
||||
chdir: "{{ zuul_work_dir }}"
|
||||
|
||||
- name: Run cabal configure --enable-test
|
||||
command: cabal configure --enable-test
|
||||
- name: Run cabal build {{ _cabal_build_args }}
|
||||
command: "cabal build {{ _cabal_build_args }}"
|
||||
args:
|
||||
chdir: "{{ zuul_work_dir }}"
|
||||
|
||||
- name: Run cabal build
|
||||
command: cabal build
|
||||
args:
|
||||
chdir: "{{ zuul_work_dir }}"
|
||||
|
||||
- name: Run cabal test
|
||||
command: cabal test
|
||||
- name: Run cabal test {{ _cabal_test_args }}
|
||||
command: "cabal test {{ _cabal_test_args }}"
|
||||
args:
|
||||
chdir: "{{ zuul_work_dir }}"
|
||||
|
@ -2,3 +2,4 @@ Ensure cabal is installed
|
||||
|
||||
This role installs the cabal-install package and ensures
|
||||
the hackage packages list exists.
|
||||
This role uses the Fedora copr package.
|
||||
|
@ -1,14 +1,24 @@
|
||||
- name: Make sure the role is run on Fedora
|
||||
fail:
|
||||
msg: "This role supports Fedora only"
|
||||
when: "ansible_distribution != 'Fedora'"
|
||||
|
||||
- name: Check cabal version
|
||||
command: cabal --version
|
||||
failed_when: false
|
||||
register: _cabal_version
|
||||
|
||||
- name: Install cabal
|
||||
package:
|
||||
name: cabal-install
|
||||
state: present
|
||||
become: yes
|
||||
when: "_cabal_version.rc != 0"
|
||||
- block:
|
||||
- name: Install cabal copr
|
||||
command: dnf copr enable -y petersen/cabal-install
|
||||
become: true
|
||||
|
||||
- name: Install cabal
|
||||
package:
|
||||
name: cabal-install
|
||||
state: present
|
||||
become: true
|
||||
when: _cabal_version.rc != 0
|
||||
|
||||
- name: Check package
|
||||
stat:
|
||||
|
@ -5,6 +5,10 @@
|
||||
|
||||
Responds to these variables:
|
||||
|
||||
.. zuul:jobvar:: cabal_target
|
||||
|
||||
The cabal target(s) to test.
|
||||
|
||||
.. zuul:jobvar:: ghc_version
|
||||
|
||||
Use the specified ghc version (``latest`` picks the latest).
|
||||
|
Loading…
Reference in New Issue
Block a user