diff --git a/.github/workflows/ext-build-examples-repo.yml b/.github/workflows/ext-build-examples-repo.yml index bf02485004..1005db4b93 100644 --- a/.github/workflows/ext-build-examples-repo.yml +++ b/.github/workflows/ext-build-examples-repo.yml @@ -38,5 +38,11 @@ jobs: target_repository: nasa/fprime-examples build_location: FlightExamples run_unit_tests: true + run_integration_tests: true + integration_gds_working_directory: FlightExamples/ExamplesDeployment + integration_test_working_directory: FlightExamples + integration_binary: ../build-artifacts/*/ExamplesDeployment/bin/ExamplesDeployment + integration_gds_args: "--dictionary ../build-artifacts/*/ExamplesDeployment/dict/ExamplesDeploymentTopologyDictionary.json" + integration_pytest_args: "DataProduct/test/int ManagerWorker/Subtopology/test/int --dictionary build-artifacts/*/ExamplesDeployment/dict/ExamplesDeploymentTopologyDictionary.json --no-zmq" target_ref: ${{ needs.get-branch.outputs.target-branch }} fprime_location: ./FlightExamples/lib/fprime diff --git a/.github/workflows/reusable-project-builder.yml b/.github/workflows/reusable-project-builder.yml index 6e4fd9e65e..3f8398212d 100644 --- a/.github/workflows/reusable-project-builder.yml +++ b/.github/workflows/reusable-project-builder.yml @@ -19,6 +19,41 @@ on: required: false type: boolean default: true + run_integration_tests: + description: "Run an additional job to build the deployment and run integration tests against it." + required: false + type: boolean + default: false + integration_gds_working_directory: + description: "Directory to start fprime-gds from (relative to repo root). Required when run_integration_tests is true." + required: false + type: string + default: "" + integration_test_working_directory: + description: "Directory to run pytest from (relative to repo root). Required when run_integration_tests is true." + required: false + type: string + default: "" + integration_binary: + description: "Path to the FSW binary to run (relative to integration_gds_working_directory). Required when run_integration_tests is true." + required: false + type: string + default: "" + integration_binary_args: + description: "Arguments passed to the FSW binary." + required: false + type: string + default: "-a 127.0.0.1 -p 50000" + integration_gds_args: + description: "Extra arguments passed to fprime-gds (e.g. --dictionary path)." + required: false + type: string + default: "" + integration_pytest_args: + description: "Extra arguments passed to pytest (e.g. test paths, --dictionary path)." + required: false + type: string + default: "" fprime_location: description: "Relative path from the external project root to its F´ submodule" required: false @@ -139,3 +174,77 @@ jobs: fprime-util check -j8 ${VERBOSE_FLAG} ${TARGET_PLATFORM} --pass-through --output-on-failure shell: bash + runIntegration: + if: ${{ inputs.run_integration_tests }} + runs-on: ${{ inputs.runs_on }} + name: "Integration Tests" + env: + FPRIME_LOCATION: ${{ inputs.fprime_location }} + TARGET_PLATFORM: ${{ inputs.target_platform }} + steps: + - name: "Checkout target repository" + uses: actions/checkout@v4 + with: + submodules: recursive + repository: ${{ inputs.target_repository }} + ref: ${{ inputs.target_ref }} + - name: "Overlay current F´ revision" + uses: actions/checkout@v4 + with: + submodules: true + path: ${{ inputs.fprime_location }} + # Install the target project's requirements so its GDS plugins (e.g. custom framing) + # are available to fprime-gds; fall back to the F´ submodule requirements otherwise. + - name: "Install requirements.txt" + run: | + # Modern build tooling is required so local source packages (e.g. the + # project's GDS plugins) build with correct metadata; the runner's + # system pip/setuptools can otherwise produce a broken "UNKNOWN" wheel + # with no entry points, which silently drops custom framing plugins. + pip3 install --upgrade pip setuptools wheel + if [ -f "${{ inputs.build_location }}/requirements.txt" ]; then + (cd "${{ inputs.build_location }}" && pip3 install -r requirements.txt) + else + pip3 install -r ${FPRIME_LOCATION}/requirements.txt + fi + shell: bash + # Match the F´ Ref integration tests: run against the in-development GDS + # (this PR's branch or devel) so GDS regressions are caught here too. + - name: "Upgrade fprime-gds to devel or pr-xxxx" + uses: nasa/fprime-actions/upgrade-package@devel + with: + repository: nasa/fprime-gds + - name: "Generate build cache" + working-directory: ${{ inputs.build_location }} + run: | + if [ "${RUNNER_DEBUG:-0}" = "1" ]; then + VERBOSE_FLAG=--verbose + else + VERBOSE_FLAG= + fi + fprime-util generate ${VERBOSE_FLAG} ${TARGET_PLATFORM} + shell: bash + - name: "Build" + working-directory: ${{ inputs.build_location }} + run: | + if [ "${RUNNER_DEBUG:-0}" = "1" ]; then + VERBOSE_FLAG=--verbose + else + VERBOSE_FLAG= + fi + fprime-util build -j8 ${VERBOSE_FLAG} ${TARGET_PLATFORM} + shell: bash + - name: "Make FSW binary executable" + working-directory: ${{ inputs.integration_gds_working_directory }} + run: chmod +x ${{ inputs.integration_binary }} + shell: bash + - name: "Integration Tests" + uses: nasa/fprime-actions/run-integration-tests@devel + with: + gds-working-directory: ${{ inputs.integration_gds_working_directory }} + test-working-directory: ${{ inputs.integration_test_working_directory }} + binary: ${{ inputs.integration_binary }} + binary-args: ${{ inputs.integration_binary_args }} + gds-args: ${{ inputs.integration_gds_args }} + pytest-args: ${{ inputs.integration_pytest_args }} +