Skip to content

[18503] Use eProsima-CI external actions for mirror workflow [WIP] #889

[18503] Use eProsima-CI external actions for mirror workflow [WIP]

[18503] Use eProsima-CI external actions for mirror workflow [WIP] #889

name: Documentation build and test
on:
workflow_dispatch:
inputs:
optional_documentation_branch:
description: 'Optional Documentation branch name'
required: false
type: string
push:
branches:
- 'master'
paths-ignore:
- '**.md'
- '**.txt'
- '!**/CMakeLists.txt'
pull_request:
branches:
- 'master'
paths-ignore:
- '**.md'
- '**.txt'
- '!**/CMakeLists.txt'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
ACTION_BRANCH_NAME: ${{ github.head_ref }}
jobs:
ubuntu-build-and-test-documentation:
name: Documentation build and test
if: ${{ !(contains(github.event.pull_request.labels.*.name, 'no-test') ||
contains(github.event.pull_request.labels.*.name, 'skip-ci')) }}
runs-on: ubuntu-22.04
steps:
- name: Sync eProsima/Fast-DDS repository
uses: actions/checkout@v3
with:
path: src/fastrtps
submodules: true
- name: Install Fast DDS packages
uses: ./src/fastrtps/.github/actions/install-apt-packages
- name: Install documentation packages
uses: ./src/fastrtps/.github/actions/install-apt-packages-documentation
- name: Download FastDDS dependencies
run: |
pip3 install vcstool
vcs import --skip-existing src < ./src/fastrtps/fastrtps.repos
- name: Determine the Fast DDS Documentation branch to be used
run: |
TEMP_BRANCH=${{ inputs.optional_documentation_branch }}
DOC_REPO=https://github.com/eProsima/fast-dds-docs.git
RESPONSE_CODE=$(git ls-remote --heads $DOC_REPO $TEMP_BRANCH | wc -l)
if [[ -z "$TEMP_BRANCH" || ${RESPONSE_CODE} == "0" ]]
then
TEMP_BRANCH=${{ github.head_ref }}
echo "$given '${{ inputs.optional_documentation_branch }}' branch DOES NOT exist, using head '${{ github.head_ref }}'"
RESPONSE_CODE=$(git ls-remote --heads $DOC_REPO $TEMP_BRANCH | wc -l)
if [[ ${RESPONSE_CODE} == "0" ]]
then
TEMP_BRANCH=${{ github.base_ref }}
echo "head '${{ github.head_ref }}' branch DOES NOT exist, using base '${{ github.base_ref }}'"
RESPONSE_CODE=$(git ls-remote --heads $DOC_REPO $TEMP_BRANCH | wc -l)
if [[ ${RESPONSE_CODE} == "0" ]]
then
echo "ACTION_BRANCH_NAME=master" >> $GITHUB_ENV
echo "base '${{ github.base_ref }}' branch DOES NOT exist, using 'MASTER'"
else
echo "ACTION_BRANCH_NAME=${{ github.base_ref }}" >> $GITHUB_ENV
fi
else
echo "ACTION_BRANCH_NAME=${{ github.head_ref }}" >> $GITHUB_ENV
fi
else
echo "ACTION_BRANCH_NAME=${{ inputs.optional_documentation_branch }}" >> $GITHUB_ENV
echo "using given '${{ inputs.optional_documentation_branch }}' branch"
fi
- name: Download FastDDS documentation repo
uses: actions/checkout@v3
with:
repository: eProsima/Fast-DDS-docs
path: src/fastdds-docs
ref: ${{ env.ACTION_BRANCH_NAME }}
- name: Install required python packages
run: |
pip3 install -r src/fastdds-docs/docs/requirements.txt
- name: Build documentation
run: |
colcon build --event-handlers=console_direct+ --metas
- name: Run documentation tests
run: |
colcon test --event-handlers=console_direct+ --packages-select fastdds-docs --return-code-on-test-failure