Skip to content

Commit

Permalink
Fix #447, Simplify document build and deploy workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
skliper committed Apr 11, 2022
1 parent 2e02021 commit 8b4b106
Showing 1 changed file with 54 additions and 117 deletions.
171 changes: 54 additions & 117 deletions .github/workflows/build-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,174 +25,111 @@ jobs:
skip_after_successful_duplicate: 'true'
do_not_skip: '["push", "workflow_dispatch", "schedule"]'

build:
setup-doc-build:
needs: checks-for-duplicates
if: ${{ needs.checks-for-duplicates.outputs.should_skip != 'true' }}
name: Build OSAL, cFE Users Guide, Mission Doc
name: Setup for documentation build
runs-on: ubuntu-18.04

steps:
# Checks out a copy of your repository on the ubuntu-latest machine
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: true
persist-credentials: false

# Setup the build system
- name: Copy Files
run: |
cp ./cfe/cmake/Makefile.sample Makefile
cp -r ./cfe/cmake/sample_defs sample_defs
# Setup the build system
- name: Make Prep
run: make prep

- name: Install Dependencies
- name: Install Doxygen Dependencies
run: sudo apt-get install doxygen graphviz -y

- name: Build OSAL Guide
run: |
make osalguide > make_osalguide_stdout.txt 2> make_osalguide_stderr.txt
mv build/docs/osalguide/osal-apiguide-warnings.log osal-apiguide-warnings.log
- name: Archive Osal Guide Build Logs
uses: actions/upload-artifact@v2
with:
name: OSAL Guide Artifacts
path: |
make_osalguide_stdout.txt
make_osalguide_stderr.txt
osal-apiguide-warnings.log
- name: Check for OSAL Guide Errors
run: |
if [[ -s make_osalguide_stderr.txt ]]; then
cat make_osalguide_stderr.txt
exit -1
fi
- name: Check for OSAL Guide Warnings
run: |
if [[ -s osal-apiguide-warnings.log ]]; then
cat osal-apiguide-warnings.log
exit -1
fi
- name: Install Dependencies
- name: Install PDF Generation Dependencies
if: ${{ github.event_name == 'push' && contains(github.ref, 'main')}}
run: |
sudo apt-get install texlive-latex-base texlive-fonts-recommended texlive-fonts-extra texlive-latex-extra
- name: Generate OSAL Guide PDF
if: ${{ github.event_name == 'push' && contains(github.ref, 'main')}}
- name: Cache setup
id: cache-doc-setup
uses: actions/cache@v2
with:
path: /home/runner/work/${{ env.REPO_NAME }}/${{ env.REPO_NAME }}/*
key: doc-setup-buildnum-${{ github.run_number }}

build-usersguide:
- needs: setup-doc-build
matrix:
targetname: [mission-doc, cfe-usersguide, osal-apiguide]

- name: Get Setup Cache
id: cache-doc-setup
uses: actions/cache@v2
with:
path: /home/runner/work/${{ env.REPO_NAME }}/${{ env.REPO_NAME }}/*
key: doc-setup-buildnum-${{ github.run_number }}

- name: Build Document
run: |
mkdir deploy
cd ./build/docs/osalguide/latex
make > build.txt
mv refman.pdf $GITHUB_WORKSPACE/deploy/OSAL_Users_Guide.pdf
# Could add pandoc and convert to github markdown
# pandoc CFE_Users_Guide.pdf -t gfm
make -C build ${{ matrix.targetname }} > make_${{ matrix.targetname }}_stdout.txt \
2> make_${{ matrix.targetname }}_stderr.txt
mv build/docs/${{ matrix.targetname }}/${{ matrix.targetname }}-warnings.log ${{ matrix.targetname }}-warnings.log
- name: Build Usersguide
run: |
make usersguide > make_usersguide_stdout.txt 2> make_usersguide_stderr.txt
mv build/docs/users_guide/cfe-usersguide-warnings.log cfe-usersguide-warnings.log
- name: Archive Usersguide Build Logs
- name: Archive Document Build Logs
uses: actions/upload-artifact@v2
with:
name: Users Guide Artifacts
name: ${{ matrix.targetname }}_doc_build_logs
path: |
make_usersguide_stdout.txt
make_usersguide_stderr.txt
cfe-usersguide-warnings.log
make_${{ matrix.targetname }}_stdout.txt
make_${{ matrix.targetname }}_stderr.txt
${{ matrix.targetname }}-warnings.log
- name: Check for Usersguide Errors
- name: Check For Document Build Errors
run: |
if [[ -s make_usersguide_stderr.txt ]]; then
cat make_usersguide_stderr.txt
if [[ -s make_${{ matrix.targetname }}_stderr.txt ]]; then
cat make_${{ matrix.targetname }}_stderr.txt
exit -1
fi
- name: Check for Usersguide Warnings
- name: Check For Document Warnings
run: |
if [[ -s cfe-usersguide-warnings.log ]]; then
cat cfe-usersguide-warnings.log
if [[ -s ${{ matrix.targetname }}-warnings.log ]]; then
cat ${{ matrix.targetname }}-warnings.log
exit -1
fi
- name: Generate Usersguide PDF
- name: Generate PDF
if: ${{ github.event_name == 'push' && contains(github.ref, 'main')}}
run: |
set -x
cd ./build/docs/users_guide/latex
mkdir deploy
cd ./build/docs/${{ matrix.targetname }}/latex
make > build.txt
mv refman.pdf $GITHUB_WORKSPACE/deploy/cFE_Users_Guide.pdf
mv refman.pdf $GITHUB_WORKSPACE/${{ matrix.targetname }}.pdf
# Could add pandoc and convert to github markdown
# pandoc CFE_Users_Guide.pdf -t gfm
# pandoc ${{ matrix.targetname }}.pdf -t gfm
- name: Build Mission Doc
run: |
make doc > make_doc_stdout.txt 2> make_doc_stderr.txt
mv build/docs/detaildesign-warnings.log detaildesign-warnings.log
# Upload documentation logs as artifacts
- name: Archive Mission Doc Build Logs
- name: Archive PDF
uses: actions/upload-artifact@v2
with:
name: cFS Docs Artifacts
path: |
make_doc_stdout.txt
make_doc_stderr.txt
detaildesign-warnings.log
- name: Check for Mission Doc Errors
run: |
if [[ -s make_doc_stderr.txt ]]; then
cat make_doc_stderr.txt
exit -1
fi
- name: Check for Mission Doc Warnings
run: |
if [[ -s detaildesign-warnings.log ]]; then
cat detaildesign-warnings.log
exit -1
fi
name: ${{ matrix.targetname }}_pdf
path: ${{ matrix.targetname }}.pdf

- name: Generate Mission Doc PDF
if: ${{ github.event_name == 'push' && contains(github.ref, 'main')}}
run: |
set -x
cd ./build/docs/detaildesign/latex
make > build.txt
mv refman.pdf $GITHUB_WORKSPACE/deploy/Mission_Doc.pdf
# Could add pandoc and convert to github markdown
# pandoc CFE_Users_Guide.pdf -t gfm
- name: Cache deployment directory
id: cache-guide
uses: actions/cache@v2
with:
path: /home/runner/work/${{ env.REPO_NAME }}/${{ env.REPO_NAME }}/deploy/*
key: guide-buildnum-${{ github.run_number }}

deploy:
needs: build
needs: build-usersguide
name: Deploy documents
runs-on: ubuntu-18.04
if: ${{ github.event_name == 'push' && contains(github.ref, 'main')}}

steps:
- name: Get cached deployment directory
id: cache-guide
uses: actions/cache@v2
with:
path: /home/runner/work/${{ env.REPO_NAME }}/${{ env.REPO_NAME }}/deploy/*
key: guide-buildnum-${{ github.run_number }}

- name: Get All Artifacts
uses: actions/download-artifacts@v2

- name: Move Artifacts To Deploy
run: mkdir deploy; mv */*.pdf deploy

- name: Deploy to GitHub
uses: JamesIves/[email protected]
with:
Expand Down

0 comments on commit 8b4b106

Please sign in to comment.