Merge "shake-build: add shake build system job"

This commit is contained in:
Zuul 2020-05-28 13:28:21 +00:00 committed by Gerrit Code Review
commit 5b194d277e
13 changed files with 124 additions and 0 deletions

View File

@ -7,5 +7,6 @@ General Purpose Jobs
.. zuul:autojob:: markdownlint
.. zuul:autojob:: multinode
.. zuul:autojob:: run-test-command
.. zuul:autojob:: shake-build
.. zuul:autojob:: upload-git-mirror
.. zuul:autojob:: validate-zone-db

View File

@ -18,6 +18,7 @@ General Purpose Roles
.. zuul:autorole:: ensure-dhall
.. zuul:autorole:: ensure-dstat-graph
.. zuul:autorole:: ensure-markdownlint
.. zuul:autorole:: ensure-shake
.. zuul:autorole:: fetch-markdownlint
.. zuul:autorole:: git-prepare-nodecache
.. zuul:autorole:: log-inventory
@ -38,6 +39,7 @@ General Purpose Roles
.. zuul:autorole:: remove-zuul-sshkey
.. zuul:autorole:: revoke-sudo
.. zuul:autorole:: run-dstat
.. zuul:autorole:: shake-build
.. zuul:autorole:: sign-artifacts
.. zuul:autorole:: stage-output
.. zuul:autorole:: start-zuul-console

3
playbooks/shake/pre.yaml Normal file
View File

@ -0,0 +1,3 @@
- hosts: all
roles:
- ensure-shake

3
playbooks/shake/run.yaml Normal file
View File

@ -0,0 +1,3 @@
- hosts: all
roles:
- shake-build

View File

@ -0,0 +1,3 @@
Ensure shake is installed
Installs the shake tool using the distro package.

View File

@ -0,0 +1,31 @@
- name: Make sure the role is run on supported distro
fail:
msg: |
This role supports Fedora only,
Add your distro package to: {{ opendev_url }}/roles/ensure-shake/vars/
when: "ansible_distribution != 'Fedora'"
vars:
opendev_url: https://opendev.org/zuul/zuul-jobs/src/branch/master/
- name: Check shake version
command: shake --version
failed_when: false
register: _shake_version
- block:
- name: Include OS-specific variables
include_vars: "{{ zj_distro_os }}"
loop_control:
loop_var: zj_distro_os
with_first_found:
- "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yaml"
- "{{ ansible_distribution }}.{{ ansible_architecture }}.yaml"
- "{{ ansible_distribution }}.yaml"
- "{{ ansible_os_family }}.yaml"
- name: Install shake
package:
name: "{{ shake_packages }}"
state: present
become: yes
when: "_shake_version.rc != 0"

View File

@ -0,0 +1,3 @@
shake_packages:
- shake
- ghc-shake-devel

View File

@ -0,0 +1,13 @@
Run the shake build system command.
**Role Variables**
.. zuul:rolevar:: shake_report_name
:default: shake.html
The name of the report.
.. zuul:rolevar:: zuul_work_dir
:default: {{ zuul.project.src_dir }}
Directory to run the shake command in.

View File

@ -0,0 +1,3 @@
shake_report_name: "shake.html"
zuul_work_dir: "{{ zuul.project.src_dir }}"

View File

@ -0,0 +1,16 @@
- block:
- name: Run shake
command: "shake --report={{ report_location }}"
vars:
report_location: "{{ ansible_user_dir }}/zuul-output/logs/{{ shake_report_name }}"
args:
chdir: "{{ zuul_work_dir }}"
always:
- name: Return report to Zuul
zuul_return:
data:
zuul:
artifacts:
- name: "Shake report"
url: "{{ shake_report_name }}"

View File

@ -0,0 +1,19 @@
- hosts: all
tasks:
- name: Setup shakefile
copy:
dest: "{{ zuul.project.src_dir }}/Shakefile.hs"
content: |
import Development.Shake
-- This Shakefile creates synthetic load using sha256sum on each .rst file
main :: IO ()
main = shakeArgs shakeOptions{shakeFiles="_build"} $ do
want [ "doc" ]
phony "doc" $ do
files <- getDirectoryFiles "" ["//*.rst"]
putNormal $ "Processing doc... with: " <> show files
need files
"//**.rst" %> \rst_file -> cmd_ "sha256sum " [rst_file]

View File

@ -692,6 +692,22 @@
- ^roles/upload-git-mirror/.*
- ^test-playbooks/upload-git-mirror.yaml
- job:
name: zuul-jobs-test-shake-build
description: Test the shake build job and roles
parent: shake-build
files:
- playbooks/shake/.*
- roles/ensure-shake/.*
- roles/shake-build/.*
- test-playbooks/shake/.*
pre-run:
- test-playbooks/shake/setup-project.yaml
nodeset:
nodes:
- name: fedora-31
label: fedora-31
# -* AUTOGENERATED *-
# The following project section is autogenerated by
# tox -e update-test-platforms
@ -746,6 +762,7 @@
- zuul-jobs-test-generate-zuul-manifest
- zuul-jobs-test-upload-artifactory
- zuul-jobs-test-upload-git-mirror
- zuul-jobs-test-shake-build
gate:
jobs:
- zuul-jobs-test-add-authorized-keys
@ -790,3 +807,4 @@
- zuul-jobs-test-generate-zuul-manifest
- zuul-jobs-test-upload-artifactory
- zuul-jobs-test-upload-git-mirror
- zuul-jobs-test-shake-build

View File

@ -119,3 +119,12 @@
pre-run: playbooks/dhall/prepare.yaml
run: playbooks/dhall/diff.yaml
- job:
name: shake-build
description: |
Run the shake build system command.
This job produces a shake.html report.
pre-run: playbooks/shake/pre.yaml
run: playbooks/shake/run.yaml