Files
ansible_role_package/tasks/helpers/cargo_build.yml
Matthew Stobbs 3a39c083a8 basic installs working
need to run tests on all the builds alone, should use a container system
2026-03-27 22:04:05 -06:00

44 lines
1.6 KiB
YAML

# vim: set filetype=yaml.ansible :
#
## Helper: cargo_buil.yml
## Description: download source, build and install using cargo
## Variables: top level 'dict'
## source_dir: git source directory
## repo: git repository url
## depth: _int_ optional, Default 1. Git depth to clone
## force_git: _bool_ optional, default true. Force clone, overwriting existing dir
## recursive: _bool_ optional, default true. Do a recursive clone
## version: _string_ optional, default 'latest'. Version to checkout and build
## build_flags: _list[str]_ optional. If set, will append these to the build command
---
- name: Cargo source install helper
block:
- name: Fetch git repo
vars:
path: "{{ pkg.source_dir }}"
repo: "{{ pkg.repo }}"
depth: "{{ pkg.depth | default(1) }}"
force: "{{ pkg.force_git | default(true) }}"
recursive: "{{ pkg.recursive | default(true) }}"
version: "{{ pkg.version | default(omit) }}"
ansible.builtin.include_tasks: helpers/git.yml
- name: Build cargo release
ansible.builtin.command:
chdir: "{{ pkg.source_dir }}"
argv: "{{ ['cargo', 'build'] + pkg.build_flags }}"
- name: Clean existing install
vars:
files: "{{ pkg.files }}"
ansible.builtin.include_tasks: helpers/clean_install.yml
- name: Install cargo release
block:
- name: Create missing directories
vars:
do_become: "{{ install_become }}"
do_become_user: "{{ install_become_user | default(omit) }}"
source_dir: "{{ pkg.source_dir }}"
ansible.builtin.include_tasks: helpers/install.yml