zuul-jobs/roles/ensure-ghc/tasks/main.yaml
Tristan Cacqueray d92b39cae2 cabal-test: add initial haskell job
This change adds a new job to test cabal based haskell project.

Change-Id: Idb24eb5f8f9bd1409bae07bf4da415f1d05568e4
2020-04-24 13:12:13 +00:00

26 lines
760 B
YAML

- name: Make sure the role is run on Fedora
fail:
msg: "This role supports Fedora only"
when: "ansible_distribution != 'Fedora'"
- name: Check requested version
fail:
msg: |
Unknown ghc version: {{ ghc_version }}.
It needs to be defined in {{ opendev_url }}/roles/ensure-ghc/defaults/main.yaml
when: ghc_versions[ghc_version] is not defined
vars:
opendev_url: https://opendev.org/zuul/zuul-jobs/src/branch/master/
- name: Check ghc version
command: ghc --version
failed_when: false
register: _ghc_version
- name: Install ghc
dnf:
name: "@ghc:{{ ghc_versions[ghc_version]|string }}"
state: present
become: yes
when: "_ghc_version.rc != 0 or (ghc_versions[ghc_version]|string) not in _ghc_version.stdout"