-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Add Validate Templates (#2387) - Add validate_templates.yml and support expect scripts. * Add Validate Templates (#2387) * Update CI to be 3 distinct steps and build each step. * Add Validate Templates (#2387) * Update expect scripts to use regex where needed to match strings. * Add Validate Templates (#2387) * Update CI run condition to match other F Prime CI. * Add Validate Templates (#2387) * Update to use devel fprime-tools and fprime-bootstrap instead of released version. * Update validation workflow * Fix expect files path * Add version-check run for easy debugging * Add comments and workflow dispatching pattern * Update fprime dependencies after overlay * Add some leeway in bootstrap expect pattern --------- Co-authored-by: thomas-bc <[email protected]>
- Loading branch information
Showing
4 changed files
with
131 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
set timeout 180 | ||
spawn fprime-bootstrap project | ||
expect -re {.*Project name.*} | ||
send "MyProject\r" | ||
expect eof |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
set timeout 60 | ||
spawn fprime-util new --component | ||
expect -re {.*Component name.*} | ||
send "MyComponent\r" | ||
expect -re {.*Component short description.*} | ||
send "test component\r" | ||
expect -re {.*Component namespace.*} | ||
send "Components\r" | ||
expect -re {.*Select component kind} | ||
send "1\r" | ||
expect -re {.*Enable Commands.*} | ||
send "1\r" | ||
expect -re {.*Enable Telemetry.*} | ||
send "1\r" | ||
expect -re {.*Enable Events.*} | ||
send "1\r" | ||
expect -re {.*Enable Parameters.*} | ||
send "1\r" | ||
expect -re {Add MyComponent to.*} | ||
send "yes\r" | ||
expect -re {Generate implementation files.*} | ||
send "yes\r" | ||
expect -re {.*Created new component.*} | ||
expect eof |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
set timeout 60 | ||
spawn fprime-util new --deployment | ||
expect -re {Deployment name.*} | ||
send "MyDeployment\r" | ||
expect -re {.*Select communication driver type} | ||
send "1\r" | ||
expect -re "Add .*MyDeployment.*" | ||
send "yes\r" | ||
expect eof |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
name: Cookiecutters Tests | ||
|
||
on: | ||
push: | ||
branches: [ devel, release/** ] | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: [ devel, release/** ] | ||
paths-ignore: | ||
- 'docs/**' | ||
- '**.md' | ||
- '.github/actions/spelling/**' | ||
- '.github/ISSUE_TEMPLATE/**' | ||
|
||
|
||
|
||
# This workflow tests the project bootstrapping and cookiecutter templates by creating | ||
# a new project, deployment and component and building them | ||
# This uses the `expect` utility to feed input into the various cookiecutter prompts | ||
|
||
jobs: | ||
|
||
Validate: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Checkout only the bootstrap.expect file, since the full F´ repo will be | ||
# checked out as part of the fprime-bootstrap process | ||
- name: "Retrieve bootstrap.expect file" | ||
uses: actions/checkout@v4 | ||
with: | ||
sparse-checkout: | | ||
.github/actions/cookiecutter-check/bootstrap.expect | ||
sparse-checkout-cone-mode: false | ||
fetch-depth: 0 | ||
|
||
- name: "Setup Python" | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: "Install expect and fprime-bootstrap@devel" | ||
run: | | ||
sudo apt-get install expect | ||
pip install git+https://github.com/fprime-community/fprime-bootstrap@devel | ||
- name: "Bootstrap Project" | ||
run: | | ||
expect .github/actions/cookiecutter-check/bootstrap.expect | ||
# Overlay fprime@current_rev in new project so that we build with it in the tests | ||
# current_rev is devel on the devel branch and the PR revision in PR checks | ||
- name: "Overlay fprime@current_rev in new project" | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
path: ./MyProject/fprime | ||
fetch-depth: 0 | ||
|
||
- name: "Update dependencies and install fprime-tools@devel" | ||
run: | | ||
cd MyProject | ||
. fprime-venv/bin/activate | ||
pip install -U -r ./fprime/requirements.txt | ||
pip install git+https://github.com/nasa/fprime-tools@devel | ||
- name: "Version Check" | ||
run: | | ||
cd MyProject | ||
. fprime-venv/bin/activate | ||
fprime-util version-check | ||
- name: "Test Generate and Build Project" | ||
run: | | ||
cd MyProject | ||
. fprime-venv/bin/activate | ||
fprime-util generate | ||
fprime-util build -j4 | ||
- name: "Test New Deployment and Build" | ||
run: | | ||
cd MyProject | ||
. fprime-venv/bin/activate | ||
expect ./fprime/.github/actions/cookiecutter-check/deployment.expect | ||
cd MyDeployment | ||
fprime-util build -j4 | ||
- name: "Test New Component and Build" | ||
run: | | ||
cd MyProject | ||
. fprime-venv/bin/activate | ||
expect ./fprime/.github/actions/cookiecutter-check/component.expect | ||
cd MyComponent | ||
fprime-util build -j4 |