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**
|
**Role Variables**
|
||||||
|
|
||||||
|
.. zuul:rolevar:: cabal_target
|
||||||
|
|
||||||
|
The cabal target(s) to test.
|
||||||
|
|
||||||
.. zuul:rolevar:: zuul_work_dir
|
.. zuul:rolevar:: zuul_work_dir
|
||||||
:default: {{ zuul.project.src_dir }}
|
:default: {{ zuul.project.src_dir }}
|
||||||
|
|
||||||
|
@ -1 +1,7 @@
|
|||||||
|
cabal_target: ""
|
||||||
|
|
||||||
zuul_work_dir: "{{ zuul.project.src_dir }}"
|
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
|
- name: Run cabal install {{ _cabal_install_args }}
|
||||||
command: cabal install --only-dependencies
|
command: "cabal install {{ _cabal_install_args }}"
|
||||||
args:
|
args:
|
||||||
chdir: "{{ zuul_work_dir }}"
|
chdir: "{{ zuul_work_dir }}"
|
||||||
|
|
||||||
- name: Run cabal configure --enable-test
|
- name: Run cabal build {{ _cabal_build_args }}
|
||||||
command: cabal configure --enable-test
|
command: "cabal build {{ _cabal_build_args }}"
|
||||||
args:
|
args:
|
||||||
chdir: "{{ zuul_work_dir }}"
|
chdir: "{{ zuul_work_dir }}"
|
||||||
|
|
||||||
- name: Run cabal build
|
- name: Run cabal test {{ _cabal_test_args }}
|
||||||
command: cabal build
|
command: "cabal test {{ _cabal_test_args }}"
|
||||||
args:
|
|
||||||
chdir: "{{ zuul_work_dir }}"
|
|
||||||
|
|
||||||
- name: Run cabal test
|
|
||||||
command: cabal test
|
|
||||||
args:
|
args:
|
||||||
chdir: "{{ zuul_work_dir }}"
|
chdir: "{{ zuul_work_dir }}"
|
||||||
|
@ -2,3 +2,4 @@ Ensure cabal is installed
|
|||||||
|
|
||||||
This role installs the cabal-install package and ensures
|
This role installs the cabal-install package and ensures
|
||||||
the hackage packages list exists.
|
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
|
- name: Check cabal version
|
||||||
command: cabal --version
|
command: cabal --version
|
||||||
failed_when: false
|
failed_when: false
|
||||||
register: _cabal_version
|
register: _cabal_version
|
||||||
|
|
||||||
- name: Install cabal
|
- block:
|
||||||
|
- name: Install cabal copr
|
||||||
|
command: dnf copr enable -y petersen/cabal-install
|
||||||
|
become: true
|
||||||
|
|
||||||
|
- name: Install cabal
|
||||||
package:
|
package:
|
||||||
name: cabal-install
|
name: cabal-install
|
||||||
state: present
|
state: present
|
||||||
become: yes
|
become: true
|
||||||
when: "_cabal_version.rc != 0"
|
when: _cabal_version.rc != 0
|
||||||
|
|
||||||
- name: Check package
|
- name: Check package
|
||||||
stat:
|
stat:
|
||||||
|
@ -5,6 +5,10 @@
|
|||||||
|
|
||||||
Responds to these variables:
|
Responds to these variables:
|
||||||
|
|
||||||
|
.. zuul:jobvar:: cabal_target
|
||||||
|
|
||||||
|
The cabal target(s) to test.
|
||||||
|
|
||||||
.. zuul:jobvar:: ghc_version
|
.. zuul:jobvar:: ghc_version
|
||||||
|
|
||||||
Use the specified ghc version (``latest`` picks the latest).
|
Use the specified ghc version (``latest`` picks the latest).
|
||||||
|
Loading…
Reference in New Issue
Block a user