Skip to content

Commit 73ab962

Browse files
Ci zephyr (nasa#4141)
* Add reusable action and workflow for CI and set up * Add branch for testing * Call correct workflow * Remove superfluous input (tmp) * Switch to fprime-actions * Add with * Actions typo * Add plugin package installation * Add build stage * Fix container * Remove container * Trial of West * Add custom setup * Add push event * Fix event data mining for push * Fix push payload usage * Fix branch detection * Fix bash-foo * Fix resuable project CI * Add custom runner set up * Typo * Add intgration step * Fix archive download * Debug commands * Download after setup * Fix download path * adding workflow for pico2 zephyr * updated reusable workflow to clean up when done, otherwise garbase is left and it causes issues with subsequent runs * fixing formatting because it matters * Remove erroneous clean-up * sp * Add make space step * Fix review requests --------- Co-authored-by: Kevin F. Ortega <kevin.f.ortega@jpl.nasa.gov>
1 parent 8ad0b83 commit 73ab962

5 files changed

Lines changed: 164 additions & 4 deletions

File tree

.github/actions/spelling/expect.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ Campuzano
6161
carg
6262
CBF
6363
CBLOCK
64+
CCACHE
6465
CCB
6566
CComponent
6667
ccsds
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Cross-compile https://github.com/fprime-community/fprime-zephyr-reference
2+
3+
name: "External Repo: Zephyr Reference (Pico 2)"
4+
5+
on:
6+
push:
7+
branches: [ devel, release/** ]
8+
pull_request:
9+
# The branches below must be a subset of the branches above
10+
branches: [ devel, release/** ]
11+
paths-ignore:
12+
- 'docs/**'
13+
- '**.md'
14+
- '.github/actions/spelling/**'
15+
- '.github/ISSUE_TEMPLATE/**'
16+
# Cancel in-progress runs if a newer run is started on a given PR
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
19+
cancel-in-progress: ${{ !contains(github.ref, 'devel') && !contains(github.ref, 'release/')}}
20+
jobs:
21+
get-branch:
22+
name: "Get target branch"
23+
uses: ./.github/workflows/reusable-get-pr-branch.yml
24+
with:
25+
target_repository: fprime-community/fprime-zephyr-reference
26+
27+
build:
28+
name: "Zephyr Build"
29+
needs: get-branch
30+
uses: ./.github/workflows/reusable-project-ci.yml
31+
with:
32+
target_repository: fprime-community/fprime-zephyr-reference
33+
target_ref: ${{ needs.get-branch.outputs.target-branch }}
34+
ci_config_file: ./lib/fprime-zephyr/ci/sample-configs/pico2.yml
35+
36+
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Cross-compile https://github.com/fprime-community/fprime-zephyr-reference
2+
3+
name: "External Repo: Zephyr Reference (Teensy 4.1)"
4+
5+
on:
6+
push:
7+
branches: [ devel, release/** ]
8+
pull_request:
9+
# The branches below must be a subset of the branches above
10+
branches: [ devel, release/** ]
11+
paths-ignore:
12+
- 'docs/**'
13+
- '**.md'
14+
- '.github/actions/spelling/**'
15+
- '.github/ISSUE_TEMPLATE/**'
16+
# Cancel in-progress runs if a newer run is started on a given PR
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
19+
cancel-in-progress: ${{ !contains(github.ref, 'devel') && !contains(github.ref, 'release/')}}
20+
jobs:
21+
get-branch:
22+
name: "Get target branch"
23+
uses: ./.github/workflows/reusable-get-pr-branch.yml
24+
with:
25+
target_repository: fprime-community/fprime-zephyr-reference
26+
27+
build:
28+
name: "Zephyr Build"
29+
needs: get-branch
30+
uses: ./.github/workflows/reusable-project-ci.yml
31+
with:
32+
target_repository: fprime-community/fprime-zephyr-reference
33+
target_ref: ${{ needs.get-branch.outputs.target-branch }}
34+
ci_config_file: ./lib/fprime-zephyr/ci/sample-configs/teensy41.yml
35+
36+

.github/workflows/reusable-get-pr-branch.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,16 @@ jobs:
3434
- name: "Get target branch"
3535
id: get_target_branch
3636
run: |
37+
BRANCH_NAME="${GITHUB_REF#refs/heads/}"
38+
echo "Looking for 'pr-${{ github.event.number }}'/'${BRANCH_NAME}'"
3739
response_code_pr=`curl -w '%{response_code}' https://api.github.com/repos/${{ inputs.target_repository }}/branches/pr-${{ github.event.number }} -o /dev/null`
38-
response_code_base=`curl -w '%{response_code}' https://api.github.com/repos/${{ inputs.target_repository }}/branches/${{ github.event.pull_request.base.ref }} -o /dev/null`
40+
response_code_branch=`curl -w '%{response_code}' https://api.github.com/repos/${{ inputs.target_repository }}/branches/${BRANCH_NAME} -o /dev/null`
3941
if [[ "${{ github.event_name }}" == "pull_request" && "$response_code_pr" == "200" ]]; then
4042
echo "TARGET_BRANCH=pr-${{ github.event.number }}" >> $GITHUB_OUTPUT
4143
echo "PR branch found, using pr-${{ github.event.number }}"
42-
elif [[ "${{ github.event_name }}" == "pull_request" && "$response_code_base" == "200" ]]; then
43-
echo "TARGET_BRANCH=${{ github.event.pull_request.base.ref }}" >> $GITHUB_OUTPUT
44-
echo "Base branch found, using ${{ github.event.pull_request.base.ref }}"
44+
elif [[ "$response_code_branch" == "200" ]]; then
45+
echo "TARGET_BRANCH=${BRANCH_NAME}" >> $GITHUB_OUTPUT
46+
echo "Base branch found, using ${BRANCH_NAME}"
4547
else
4648
echo "TARGET_BRANCH=${{ inputs.default_target_ref }}" >> $GITHUB_OUTPUT
4749
echo "PR branch not found, using ${{ inputs.default_target_ref }}"
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# This workflow is intended for reuse by other workflows and will not run directly (no triggers).
2+
# The behavior is to run the steps of fprime-ci.
3+
name: "F´ CI - Reusable Workflow"
4+
5+
on:
6+
workflow_call:
7+
inputs:
8+
target_repository:
9+
description: "Additional external repository to checkout (<owner>/<repo>)"
10+
required: true
11+
type: string
12+
fprime_location:
13+
description: "Relative path from the external project root to its F´ submodule"
14+
required: false
15+
type: string
16+
default: "./lib/fprime"
17+
target_ref:
18+
description: "Branch on target to checkout"
19+
required: false
20+
type: string
21+
default: "devel"
22+
ci_config_file:
23+
required: true
24+
type: string
25+
run_unit_tests:
26+
description: "Run an additional job in parallel to run unit tests."
27+
required: false
28+
type: boolean
29+
default: true
30+
runs_on:
31+
description: "Platform to run on. Defaults to ubuntu-22.04"
32+
required: false
33+
type: string
34+
default: "ubuntu-22.04"
35+
runs_on_int:
36+
description: "Platform to run integration tests on. Defaults to: apple-ci"
37+
required: false
38+
type: string
39+
default: "apple-ci"
40+
runs_on_ut:
41+
description: "Platform to run UTs on. Defaults to ubuntu-22.04"
42+
required: false
43+
type: string
44+
default: "ubuntu-22.04"
45+
jobs:
46+
build:
47+
runs-on: ${{ inputs.runs_on }}
48+
name: "Build"
49+
steps:
50+
- name: "Make Space"
51+
uses: nasa/fprime-actions/make-space@devel
52+
- name: "Set up target repository"
53+
uses: nasa/fprime-actions/external-repository-setup@devel
54+
with:
55+
target_repository: ${{ inputs.target_repository }}
56+
fprime_location: ${{ inputs.fprime_location }}
57+
target_ref: ${{ inputs.target_ref }}
58+
stage: build
59+
- name: "Build Binary"
60+
run: |
61+
CCACHE_DISABLE=1 fprime-ci -c ${{ inputs.ci_config_file }} --add-stage build
62+
- name: Archive Results
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: archive.tar.gz
66+
path: ./archive.tar.gz
67+
integration-tests:
68+
needs: build
69+
name: "Integration Tests"
70+
runs-on: ${{ inputs.runs_on_int }}
71+
steps:
72+
- name: "Set up target repository"
73+
uses: nasa/fprime-actions/external-repository-setup@devel
74+
with:
75+
target_repository: ${{ inputs.target_repository }}
76+
fprime_location: ${{ inputs.fprime_location }}
77+
target_ref: ${{ inputs.target_ref }}
78+
stage: int
79+
- name: Pull Archive Results
80+
uses: actions/download-artifact@v4
81+
with:
82+
name: archive.tar.gz
83+
- name: "Integration tests"
84+
run: |
85+
fprime-ci -c ${{ inputs.ci_config_file }} --skip-stage build

0 commit comments

Comments
 (0)