Files
powertrain-build/playbooks/powertrain-build-and-compile.yaml
Henrik Wahlqvist 38a1ecd2dc ARTCSF-3856: Set up simple sample projects and jobs/tests
Change-Id: I5b397ad0e490343ee9a751f81c40e3ebc9ff2bb5
2025-09-04 12:04:07 +00:00

37 lines
1.4 KiB
YAML

---
- name: powertrain-build build and compile
hosts: all
pre_tasks:
- name: Install pip3
ansible.builtin.apt:
name: python3-pip
become: true
- name: Install gcc
ansible.builtin.apt:
name: gcc-multilib
become: true
tasks:
- name: Create virtual python env
ansible.builtin.command: python3 -m venv {{ venv_folder }}
args:
chdir: "{{ zuul.project.src_dir }}"
- name: Install powertrain-build
ansible.builtin.command: ./{{ venv_folder }}/bin/python -m pip install .
args:
chdir: "{{ zuul.project.src_dir }}"
- name: Build test projects
ansible.builtin.command: ../../{{ venv_folder }}/bin/python -m powertrain_build.wrapper build-specific --project-config Projects/{{ item.project }}/ProjectCfg.json --no-abort --complete-a2l --rte-dummy
args:
chdir: "{{ zuul.project.src_dir }}/test_data/test_repo"
loop: "{{ test_projects }}"
- name: Create dummy main file
ansible.builtin.copy:
dest: "{{ zuul.project.src_dir }}/test_data/test_repo/Projects/{{ item.project }}/output/SourceCode/main.c"
content: int main() {return 0;}
loop: "{{ test_projects }}"
- name: Compile test project
ansible.builtin.shell: gcc -Wall -I. *.c -o {{ item.name | lower }}
args:
chdir: "{{ zuul.project.src_dir }}/test_data/test_repo/Projects/{{ item.project }}/output/SourceCode"
loop: "{{ test_projects }}"