Skip to content

Commit

Permalink
[CI] merge documentation.yml with wheel-short-test.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
tttapa committed Sep 26, 2023
1 parent 36942b1 commit d90d0c5
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 75 deletions.
71 changes: 0 additions & 71 deletions .github/workflows/documentation.yml

This file was deleted.

75 changes: 75 additions & 0 deletions .github/workflows/wheel-short-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,78 @@ jobs:
name: whl-macos
retention-days: 1
path: dist/*.whl

docs:
runs-on: ubuntu-latest
container: ubuntu:jammy
env:
HOST: 'x86_64-centos7-linux-gnu'
CMAKE_C_COMPILER_LAUNCHER: ccache
CMAKE_CXX_COMPILER_LAUNCHER: ccache
CCACHE_DIR: /root/.ccache
steps:
# Git clone
- name: Install git
run: apt -y update && apt -y install --no-install-recommends git ca-certificates
- uses: actions/checkout@v3
with:
submodules: recursive
- run: git config --global --add safe.directory $GITHUB_WORKSPACE
# Tools
- name: Install tools
uses: ./.github/workflows/toolchain
with:
host: ${{ env.HOST }}
python-version: ${{ env.PYTHON_VERSION }}
pypy: ''
# Ccache
- name: Prepare ccache directory
run: mkdir -p "${{ env.CCACHE_DIR }}"
- name: Cache ccache
uses: actions/cache@v3
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ env.HOST }}-docs-ccache-${{ github.run_id }}
restore-keys: ${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ env.HOST }}-docs-ccache
# Create a copy of the repo in /tmp/staging.
# Create the `gh-pages` branch if it doesn't exist already, check it out.
- name: Create staging area
run: |
rm -rf /tmp/staging
cp -ar $GITHUB_WORKSPACE/ /tmp/staging
git config --global --add safe.directory /tmp/staging
cd /tmp/staging
git fetch origin gh-pages:gh-pages ||:
git checkout gh-pages || \
{ git checkout --orphan gh-pages && git rm -rf . && git clean -fxd ; }
echo -e 'bib*.aux\ncitelist.doc*' > .gitignore
# Download and install package, Install dependencies for generating docs
- uses: actions/download-artifact@v3
with:
name: whl-${{ env.PYTHON_VERSION }}-${{ matrix.config }}-linux-test
path: dist
- name: Install dependencies
run: |
python3 -m pip install -U pip
python3 -m pip install --find-links=dist "${PACKAGE_NAME}[docs]==${PACKAGE_VERSION}"
python3 -m pip install -r doxygen/requirements.txt
# Generate the documentation and save it in /tmp/staging
- name: Generate documentation
run: |
./doxygen/scripts/gen-docs.sh /tmp/staging
./doxygen/scripts/gen-docs-index.sh /tmp/staging md
env:
CMAKE_TOOLCHAIN_FILE: /opt/${{ env.HOST }}/${{ env.HOST }}.toolchain.cmake
GCOV_BIN: /opt/${{ env.HOST }}/x-tools/${{ env.HOST }}/bin/${{ env.HOST }}-gcov
LD_LIBRARY_PATH: "/opt/${{ env.HOST }}/x-tools/${{ env.HOST }}/${{ env.HOST }}/lib64"
# Commit the new documentation, squash the commits, and push it to GitHub
- name: Commit and push documention
run: |
git config --global user.name "github-actions"
git config --global user.email "[email protected]"
commithash=$(git rev-parse HEAD)
cd /tmp/staging
git add .
git commit -m "Documentation for ${commithash}" && \
git reset $(git commit-tree HEAD^{tree} -m "Documentation for ${commithash}") && \
git push -f origin gh-pages ||:
3 changes: 2 additions & 1 deletion doxygen/Doxyfile.breathe
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ INLINE_INHERITED_MEMB = NO
PREDEFINED += x̂=x_hat \
G̃=G_tilde \
QPALM_ADAPTER_EXPORT= \
IPOPT_ADAPTER_EXPORT=
IPOPT_ADAPTER_EXPORT=
EXTRACT_ANON_NSPACES = NO
10 changes: 9 additions & 1 deletion doxygen/scripts/gen-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,24 @@ function run_doxygen_coverage {
GENERATE_LATEX = NO
EOF

# See if we're cross-compiling and add dependencies to CMake's search path
if [ -n "$CMAKE_TOOLCHAIN_FILE" ]; then
pfx="$(dirname "$CMAKE_TOOLCHAIN_FILE")"
extra_cmake_opts=("-D" "CMAKE_FIND_ROOT_PATH=$pfx/pybind11;$pfx/eigen-master;$pfx/casadi;$pfx/googletest")
fi

# Configure the project
cmake -S. -B"$tmpdir/build" \
-G "Ninja" \
-DALPAQA_WITH_COVERAGE=On \
-DALPAQA_WITH_TESTS=On \
-DALPAQA_FORCE_TEST_DISCOVERY=On \
-DALPAQA_WITH_QUAD_PRECISION=On \
-DALPAQA_WITH_PYTHON=Off \
-DALPAQA_WITH_EXAMPLES=Off \
-DALPAQA_WITH_CASADI=On \
-DALPAQA_DOXYFILE="$tmpdir/tmp-Doxyfile"
-DALPAQA_DOXYFILE="$tmpdir/tmp-Doxyfile" \
${extra_cmake_opts[@]}

# Generate the Doxygen C++ documentation
cmake --build "$tmpdir/build" -t docs
Expand Down
6 changes: 4 additions & 2 deletions scripts/coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ rm -rf "$html_dest/*"
compiler="${1,,}"
version="${2%%.*}"

if [ ! -z "$version" ]; then version="-${version}"; fi
if [ -n "$version" ]; then version="-${version}"; fi

echo "Compiler: ${compiler}${version}"

# If the compiler is Clang, use a wrapper around llvm-cov that emulates gcov
# and use the right c++filt
if [ "${compiler}" == "clang" ]; then
if [ -n "$GCOV_BIN" ]; then
gcov_bin="$GCOV_BIN";
elif [ "${compiler}" == "clang" ]; then
mkdir -p "${TMPDIR:-/tmp}/clang-cxxfilt-gcov"
echo -e "#!/usr/bin/env sh\nexec llvm-cov${version} gcov \"\$@\"" \
> "${TMPDIR:-/tmp}/clang-cxxfilt-gcov/llvm-cov"
Expand Down

0 comments on commit d90d0c5

Please sign in to comment.