Merge "hlint: add haskell source code suggestions job"
This commit is contained in:
commit
e863680df7
@ -2,3 +2,4 @@ Haskell Jobs
|
||||
============
|
||||
|
||||
.. zuul:autojob:: cabal-test
|
||||
.. zuul:autojob:: hlint
|
||||
|
@ -3,4 +3,6 @@ Haskell Roles
|
||||
|
||||
.. zuul:autorole:: ensure-cabal
|
||||
.. zuul:autorole:: ensure-ghc
|
||||
.. zuul:autorole:: ensure-hlint
|
||||
.. zuul:autorole:: cabal-test
|
||||
.. zuul:autorole:: hlint
|
||||
|
3
playbooks/haskell/hlint.yaml
Normal file
3
playbooks/haskell/hlint.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
- hosts: all
|
||||
roles:
|
||||
- hlint
|
3
playbooks/haskell/pre-hlint.yaml
Normal file
3
playbooks/haskell/pre-hlint.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
- hosts: all
|
||||
roles:
|
||||
- ensure-hlint
|
3
roles/ensure-hlint/README.rst
Normal file
3
roles/ensure-hlint/README.rst
Normal file
@ -0,0 +1,3 @@
|
||||
Ensure hlint is installed
|
||||
|
||||
Installs the hlint tool using the distro package.
|
11
roles/ensure-hlint/tasks/main.yaml
Normal file
11
roles/ensure-hlint/tasks/main.yaml
Normal file
@ -0,0 +1,11 @@
|
||||
- name: Check hlint version
|
||||
command: hlint --version
|
||||
failed_when: false
|
||||
register: _hlint_version
|
||||
|
||||
- name: Install hlint
|
||||
package:
|
||||
name: "hlint"
|
||||
state: present
|
||||
become: yes
|
||||
when: "_hlint_version.rc != 0"
|
13
roles/hlint/README.rst
Normal file
13
roles/hlint/README.rst
Normal file
@ -0,0 +1,13 @@
|
||||
Run the hlint command.
|
||||
|
||||
**Role Variables**
|
||||
|
||||
.. zuul:rolevar:: hlint_report_name
|
||||
:default: hlint.html
|
||||
|
||||
The name of the report.
|
||||
|
||||
.. zuul:rolevar:: zuul_work_dir
|
||||
:default: {{ zuul.project.src_dir }}
|
||||
|
||||
Directory to run the hlint command in.
|
3
roles/hlint/defaults/main.yaml
Normal file
3
roles/hlint/defaults/main.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
hlint_report_name: "hlint.html"
|
||||
|
||||
zuul_work_dir: "{{ zuul.project.src_dir }}"
|
16
roles/hlint/tasks/main.yaml
Normal file
16
roles/hlint/tasks/main.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
- block:
|
||||
- name: Run hlint
|
||||
command: "hlint --report={{ report_location }} ."
|
||||
vars:
|
||||
report_location: "{{ ansible_user_dir }}/zuul-output/logs/{{ hlint_report_name }}"
|
||||
args:
|
||||
chdir: "{{ zuul_work_dir }}"
|
||||
|
||||
always:
|
||||
- name: Return report to Zuul
|
||||
zuul_return:
|
||||
data:
|
||||
zuul:
|
||||
artifacts:
|
||||
- name: "HLint report"
|
||||
url: "{{ hlint_report_name }}"
|
@ -3,7 +3,8 @@
|
||||
description: Test the cabal-test job and roles
|
||||
parent: cabal-test
|
||||
files:
|
||||
- playbooks/haskell/.*
|
||||
- playbooks/haskell/cabal.yaml
|
||||
- playbooks/haskell/pre.yaml
|
||||
- roles/ensure-cabal/.*
|
||||
- roles/ensure-ghc/.*
|
||||
- roles/cabal-test/.*
|
||||
@ -13,9 +14,27 @@
|
||||
- name: fedora-31
|
||||
label: fedora-31
|
||||
|
||||
- job:
|
||||
name: zuul-jobs-test-hlint
|
||||
description: Test the hlint job and roles
|
||||
parent: hlint
|
||||
files:
|
||||
- playbooks/haskell/hlint.yaml
|
||||
- playbooks/haskell/pre-hlint.yaml
|
||||
- roles/ensure-hlint/.*
|
||||
- roles/hlint/.*
|
||||
pre-run:
|
||||
- playbooks/haskell/pre.yaml
|
||||
- test-playbooks/haskell/setup-project.yaml
|
||||
nodeset:
|
||||
nodes:
|
||||
- name: fedora-31
|
||||
label: fedora-31
|
||||
|
||||
- project:
|
||||
check:
|
||||
jobs: &id001
|
||||
- zuul-jobs-test-cabal-test
|
||||
- zuul-jobs-test-hlint
|
||||
gate:
|
||||
jobs: *id001
|
||||
|
@ -12,3 +12,12 @@
|
||||
pre-run: playbooks/haskell/pre.yaml
|
||||
vars:
|
||||
ghc_version: latest
|
||||
|
||||
- job:
|
||||
name: hlint
|
||||
description: |
|
||||
Run haskell source code suggestions.
|
||||
|
||||
This job produces an hlint.html report.
|
||||
run: playbooks/haskell/hlint.yaml
|
||||
pre-run: playbooks/haskell/pre-hlint.yaml
|
||||
|
Loading…
Reference in New Issue
Block a user