-
Notifications
You must be signed in to change notification settings - Fork 1.3k
110 lines (105 loc) · 3.72 KB
/
reusable-project-builder.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# This workflow is intended for reuse by other workflows and will not run directly (no triggers).
# The behavior is to build an external F´ project (e.g. fprime-community/system-reference) using
# the current F´ version.
name: "F´ Project Builder - Reusable Workflow"
on:
workflow_call:
inputs:
build_location:
description: "Path to F´ module to build. E.g. MyDeployment/"
required: true
type: string
target_repository:
description: "Additional external repository to checkout (<owner>/<repo>)"
required: true
type: string
run_unit_tests:
description: "Run an additional job in parallel to run unit tests."
required: false
type: boolean
default: true
fprime_location:
description: "Relative path from the external project root to its F´ submodule"
required: false
type: string
default: "./fprime"
runs_on:
description: "Platform to run on. Defaults to ubuntu-22.04"
required: false
type: string
default: "ubuntu-22.04"
target_platform:
description: "Target platform to pass to fprime-util"
required: false
type: string
default: ""
target_ref:
description: "Branch on target to checkout"
required: false
type: string
default: "devel"
jobs:
build:
runs-on: ${{ inputs.runs_on }}
name: "Build"
steps:
- name: "Checkout target repository"
uses: actions/checkout@v4
with:
submodules: false
repository: ${{ inputs.target_repository }}
ref: ${{ inputs.target_ref }}
- name: "Overlay current F´ revision"
uses: actions/checkout@v4
with:
submodules: true
path: ${{ inputs.fprime_location }}
- name: "Install requirements.txt"
run: |
pip3 install -r ${{ inputs.fprime_location }}/requirements.txt
shell: bash
- name: "Generate build cache"
working-directory: ${{ inputs.build_location }}
run: |
fprime-util generate ${{ runner.debug == '1' && '--verbose' || '' }} ${{ inputs.target_platform }}
shell: bash
- name: "Build"
working-directory: ${{ inputs.build_location }}
run: |
fprime-util build ${{ runner.debug == '1' && '--verbose' || '' }} ${{ inputs.target_platform }}
shell: bash
runUT:
if: ${{ inputs.run_unit_tests }}
runs-on: ${{ inputs.runs_on }}
name: "Unit Tests"
steps:
- name: "Checkout target repository"
uses: actions/checkout@v4
with:
submodules: false
repository: ${{ inputs.target_repository }}
ref: ${{ inputs.target_ref }}
- name: "Overlay current F´ revision"
uses: actions/checkout@v4
with:
submodules: true
path: ${{ inputs.fprime_location }}
- name: "Install requirements.txt"
run: |
pip3 install -r ${{ inputs.fprime_location }}/requirements.txt
shell: bash
- name: "Generate UT build cache"
working-directory: ${{ inputs.build_location }}
run: |
fprime-util generate --ut ${{ runner.debug == '1' && '--verbose' || '' }} ${{ inputs.target_platform }}
shell: bash
- name: "Build UTs"
working-directory: ${{ inputs.build_location }}
run: |
fprime-util build --ut ${{ runner.debug == '1' && '--verbose' || '' }} ${{ inputs.target_platform }}
shell: bash
- name: "Run Unit Tests"
working-directory: ${{ inputs.build_location }}
run: |
fprime-util check ${{ runner.debug == '1' && '--verbose' || '' }} ${{ inputs.target_platform }}
shell: bash