From 7587794ed40379bb19ab19539f300640ccc9c21d Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Thu, 17 Oct 2024 13:08:28 -0700 Subject: [PATCH 1/4] Add Validate Templates (#2387) - Add validate_templates.yml and support expect scripts. --- .github/workflows/bootstrap.exp | 5 +++ .github/workflows/component.exp | 15 ++++++++ .github/workflows/deployment.exp | 9 +++++ .github/workflows/validate_templates.yml | 44 ++++++++++++++++++++++++ 4 files changed, 73 insertions(+) create mode 100644 .github/workflows/bootstrap.exp create mode 100644 .github/workflows/component.exp create mode 100644 .github/workflows/deployment.exp create mode 100644 .github/workflows/validate_templates.yml diff --git a/.github/workflows/bootstrap.exp b/.github/workflows/bootstrap.exp new file mode 100644 index 0000000000..18a23df88f --- /dev/null +++ b/.github/workflows/bootstrap.exp @@ -0,0 +1,5 @@ +set timeout 120 +spawn fprime-bootstrap project +expect "Project name (MyProject):" +send -- "MyProject\r" +expect eof diff --git a/.github/workflows/component.exp b/.github/workflows/component.exp new file mode 100644 index 0000000000..fd5b295cd5 --- /dev/null +++ b/.github/workflows/component.exp @@ -0,0 +1,15 @@ +set timeout 120 +spawn fprime-util new --component +expect "Component name (MyComponent):" +send -- "MyComponent\r" +expect "Select component kind" +send -- "1\r" +expect "Enable Commands?" +send -- "1\r" +expect "Enable Telemetry?" +send -- "1\r" +expect "Enable Parameters?" +send -- "1\r" +expect "Add MyComponent to" +send -- "yes\r" +expect eof diff --git a/.github/workflows/deployment.exp b/.github/workflows/deployment.exp new file mode 100644 index 0000000000..4cdee06b5c --- /dev/null +++ b/.github/workflows/deployment.exp @@ -0,0 +1,9 @@ +set timeout 120 +spawn fprime-util new --deployment +expect "Deployment name (MyDeployment):" +send -- "MyDeployment\r" +expect "Select communication driver type" +send -- "2\r" +expect "Add MyDeployment to fprime/CMakeLists.txt" +send -- "yes\r" +expect eof diff --git a/.github/workflows/validate_templates.yml b/.github/workflows/validate_templates.yml new file mode 100644 index 0000000000..d442f6fe69 --- /dev/null +++ b/.github/workflows/validate_templates.yml @@ -0,0 +1,44 @@ +name: validate_templates-actions +run-name: ${{ github.actor }} running Validate Templates CI actions +on: [push] + + +jobs: + + validate_templates: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: "Checkout F' Repository" + uses: actions/checkout@v4 + with: + submodules: true + path: ${{ inputs.fprime_location }} + + - name: "Test bootstrap" + run: | + pip install fprime-bootstrap + sudo apt-get install expect + mkdir test_dev + cd test_dev + expect ../.github/workflows/bootstrap.exp + + - name: "Activate Venv and Generate" + run: | + cd test_dev/MyProject + . fprime-venv/bin/activate + fprime-util generate + + - name: "Test Deployment and build" + run: | + cd test_dev/MyProject + . fprime-venv/bin/activate + expect ../../.github/workflows/deployment.exp + fprime-util build + + - name: "Test Component and build" + run: | + cd test_dev/MyProject + . fprime-venv/bin/activate + expect ../../.github/workflows/component.exp + fprime-util build From 985088c9bcb7a4f8be3812a631cb47fe3b2deb97 Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Mon, 28 Oct 2024 13:55:21 -0700 Subject: [PATCH 2/4] Add Validate Templates (#2387) * Update CI to be 3 distinct steps and build each step. --- .github/workflows/validate_templates.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/validate_templates.yml b/.github/workflows/validate_templates.yml index d442f6fe69..1ac5387123 100644 --- a/.github/workflows/validate_templates.yml +++ b/.github/workflows/validate_templates.yml @@ -15,25 +15,24 @@ jobs: submodules: true path: ${{ inputs.fprime_location }} - - name: "Test bootstrap" + - name: "Test Bootstrap and build" run: | pip install fprime-bootstrap sudo apt-get install expect mkdir test_dev cd test_dev expect ../.github/workflows/bootstrap.exp - - - name: "Activate Venv and Generate" - run: | - cd test_dev/MyProject + cd MyProject . fprime-venv/bin/activate fprime-util generate + fprime-util build - name: "Test Deployment and build" run: | cd test_dev/MyProject . fprime-venv/bin/activate expect ../../.github/workflows/deployment.exp + cd MyDeployment fprime-util build - name: "Test Component and build" @@ -41,4 +40,5 @@ jobs: cd test_dev/MyProject . fprime-venv/bin/activate expect ../../.github/workflows/component.exp + cd MyComponent fprime-util build From a60294468ce3db027fc57861e729d1c0bfc5aef0 Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Mon, 28 Oct 2024 14:23:47 -0700 Subject: [PATCH 3/4] Add Validate Templates (nasa#2387) * Update expect scripts to use regex where needed to match strings. --- .github/workflows/bootstrap.exp | 4 ++-- .github/workflows/component.exp | 35 ++++++++++++++++++++------------ .github/workflows/deployment.exp | 14 ++++++------- 3 files changed, 31 insertions(+), 22 deletions(-) diff --git a/.github/workflows/bootstrap.exp b/.github/workflows/bootstrap.exp index 18a23df88f..a7c6d16cba 100644 --- a/.github/workflows/bootstrap.exp +++ b/.github/workflows/bootstrap.exp @@ -1,5 +1,5 @@ -set timeout 120 +set timeout 180 spawn fprime-bootstrap project expect "Project name (MyProject):" -send -- "MyProject\r" +send "MyProject\r" expect eof diff --git a/.github/workflows/component.exp b/.github/workflows/component.exp index fd5b295cd5..23271780a9 100644 --- a/.github/workflows/component.exp +++ b/.github/workflows/component.exp @@ -1,15 +1,24 @@ -set timeout 120 +set timeout 60 spawn fprime-util new --component -expect "Component name (MyComponent):" -send -- "MyComponent\r" -expect "Select component kind" -send -- "1\r" -expect "Enable Commands?" -send -- "1\r" -expect "Enable Telemetry?" -send -- "1\r" -expect "Enable Parameters?" -send -- "1\r" -expect "Add MyComponent to" -send -- "yes\r" +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 diff --git a/.github/workflows/deployment.exp b/.github/workflows/deployment.exp index 4cdee06b5c..75924082e9 100644 --- a/.github/workflows/deployment.exp +++ b/.github/workflows/deployment.exp @@ -1,9 +1,9 @@ -set timeout 120 +set timeout 60 spawn fprime-util new --deployment -expect "Deployment name (MyDeployment):" -send -- "MyDeployment\r" -expect "Select communication driver type" -send -- "2\r" -expect "Add MyDeployment to fprime/CMakeLists.txt" -send -- "yes\r" +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 From f49730532304bc7280b592bfc6bc142592b9a167 Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Tue, 29 Oct 2024 13:54:57 -0700 Subject: [PATCH 4/4] Add Validate Templates (#2387) * Update CI run condition to match other F Prime CI. --- .github/workflows/validate_templates.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/validate_templates.yml b/.github/workflows/validate_templates.yml index 1ac5387123..61283dbf69 100644 --- a/.github/workflows/validate_templates.yml +++ b/.github/workflows/validate_templates.yml @@ -1,7 +1,16 @@ name: validate_templates-actions run-name: ${{ github.actor }} running Validate Templates CI actions -on: [push] - +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/**' jobs: