diff --git a/.ci/build-kit/scripts/build_docs.sh b/.ci/build-kit/scripts/build_docs.sh new file mode 100755 index 000000000..d48249a57 --- /dev/null +++ b/.ci/build-kit/scripts/build_docs.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +cmake \ + -B "$EXT_MOUNT/build" \ + -S "$EXT_MOUNT/source" \ + -G Ninja \ + -DBUILD_TESTING=ON \ + -DLIBOCPP16_BUILD_EXAMPLES=ON \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_INSTALL_PREFIX="$EXT_MOUNT/dist" \ + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + +retVal=$? +if [ $retVal -ne 0 ]; then + echo "Configuring failed with return code $retVal" + exit $retVal +fi + +ninja -C "$EXT_MOUNT/build" doxygen-ocpp +retVal=$? +if [ $retVal -ne 0 ]; then + echo "Building docs failed with return code $retVal" + exit $retVal +fi + +cp -r "$EXT_MOUNT/build/dist/docs/html" "$EXT_MOUNT/doxygen-docs" +retVal=$? +if [ $retVal -ne 0 ]; then + echo "Copying docs failed with return code $retVal" + exit $retVal +fi diff --git a/.github/workflows/build_and_test.yaml b/.github/workflows/build_and_test.yaml index 4700578b9..1cfd33b0f 100644 --- a/.github/workflows/build_and_test.yaml +++ b/.github/workflows/build_and_test.yaml @@ -17,7 +17,8 @@ on: jobs: ci: name: Build, Lint and Test - uses: everest/everest-ci/.github/workflows/continuous_integration.yml@v1.4.4 + #LTODO tmp + uses: everest/everest-ci/.github/workflows/continuous_integration.yml@feature/add-doxygen permissions: contents: read secrets: @@ -32,3 +33,90 @@ jobs: ctest_report_path: ctest-report coverage_report_path: gcovr-coverage coverage_xml_path: gcovr-coverage-xml.xml + #LTODO: tmp + build_kit_base_image_tag: feature-add-doxygen + build_docs: + name: Build Doxygen Documentation + needs: + - ci + runs-on: ${{ inputs.runner || 'ubuntu-22.04' }} + steps: + - name: Checkout + uses: actions/checkout@v4.2.2 + with: + path: source + - name: Setup run scripts + run: | + mkdir scripts + rsync -a source/.ci/build-kit/scripts/ scripts + - name: Docker Meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.BUILD_KIT_IMAGE_NAME }} + - name: Set output tag + id: buildkit_tag + shell: python3 {0} + run: | + import os + tags = "${{ steps.meta.outputs.tags }}".split(",") + if len(tags) == 0: + print("No tags found!❌") + exit(1) + tag = f"local/build-kit-libocpp:{tags[0]}" + with open(os.environ["GITHUB_OUTPUT"], "a") as f: + f.write(f"tag={tag}\n") + print(f"Set tag={tag}") + - name: Download build-kit image + uses: actions/download-artifact@v4 + with: + name: build-kit + - name: Load build-kit image + run: | + docker load -i build-kit.tar + docker image tag ${{ steps.buildkit_tag.outputs.tag }} build-kit + - name: Build Doxygen Documentation + run: | + docker run \ + --volume "${{ github.workspace }}:/ext" \ + --name build-doc-container \ + build-kit run-script build_docs + - name: Upload Doxygen Documentation + uses: actions/upload-artifact@v4.4.3 + with: + if-no-files-found: error + name: doxygen-docs + path: doxygen-docs + deploy_docs: + name: Deploy Doxygen Documentation + needs: + - ci + - build_docs + runs-on: ${{ inputs.runner || 'ubuntu-22.04' }} + steps: + - name: Checkout local github actions + uses: actions/checkout@v4 + with: + repository: everest/everest-ci + ref: ${{ needs.ci.outputs.sha_everest_ci }} + path: everest-ci + - name: Checkout + uses: actions/checkout@v4.2.2 + with: + path: source + - name: Download doxygen-docs artifact + uses: actions/download-artifact@v4 + with: + name: doxygen-docs + path: doxygen-docs + - name: Deploy doxygen docs + id: deploy_doxygen_docs + uses: ./everest-ci/github-actions/deploy-doxygen-docs + with: + target_repo: EVerest/everest.github.io + github_token : ${{ secrets.SA_GITHUB_PAT }} + docs_directory: doxygen-docs + - name: Write summary + run: | + echo "Doxygen documentation deployed successfully!🚀" >> $GITHUB_STEP_SUMMARY + echo "You can access the documentation at: https://everest.github.io/${{ steps.deploy_doxygen_docs.outputs.deployed_path}}" >> $GITHUB_STEP_SUMMARY