Skip to content

Standard library incompatibility fix by packaging libc++ #2417

Standard library incompatibility fix by packaging libc++

Standard library incompatibility fix by packaging libc++ #2417

Workflow file for this run

name: Continuous Integration
on:
push:
branches:
- develop
- master
- '*'
tags:
- "v*.*.*"
pull_request:
branches:
- develop
concurrency:
group: ${{format('{0}:{1}', github.repository, github.ref)}}
cancel-in-progress: true
jobs:
cpp-matrix:
runs-on: ubuntu-latest
name: Generate Test Matrix
outputs:
matrix: ${{ steps.cpp-matrix.outputs.matrix }}
steps:
- name: Generate Test Matrix
uses: alandefreitas/cpp-actions/[email protected]
id: cpp-matrix
with:
compilers: |
gcc 13.1
clang 17
msvc 14.40
standards: '20'
latest-factors: ''
factors: ''
build:
needs: cpp-matrix
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.cpp-matrix.outputs.matrix) }}
defaults:
run:
shell: bash
name: ${{ matrix.name }}
runs-on: ${{ matrix.runs-on }}
container: ${{ matrix.container }}
env: ${{ matrix.env }}
permissions:
contents: write
steps:
- name: Clone MrDocs
uses: actions/checkout@v4
- name: Setup CMake
uses: alandefreitas/cpp-actions/[email protected]
id: setup-cmake
with:
version: ${{ matrix.compiler == 'clang' && '3.26' || '>=3.26' }}
check-latest: 'true'
update-environment: 'true'
- name: Setup Ninja
uses: seanmiddleditch/gha-setup-ninja@v4
if: ${{ runner.os == 'Windows' }}
- name: Setup C++
uses: alandefreitas/cpp-actions/[email protected]
id: setup-cpp
with:
compiler: ${{ matrix.compiler }}
version: ${{ matrix.version }}
check-latest: ${{ matrix.compiler == 'clang' }}
- name: Install System Packages
uses: alandefreitas/cpp-actions/[email protected]
id: package-install
env:
DEBIAN_FRONTEND: 'noninteractive'
TZ: 'Etc/UTC'
with:
apt-get: ${{ matrix.install }} git build-essential python3 curl openjdk-11-jdk ninja-build pkg-config libncurses-dev libxml2-utils libxml2-dev
cc: ${{ steps.setup-cpp.outputs.cc || matrix.cc }}
ccflags: ${{ matrix.ccflags }}
cxx: ${{ steps.setup-cpp.outputs.cxx || matrix.cxx }}
cxxflags: ${{ matrix.cxxflags }}
- name: Install Fmt
id: fmt-install
shell: bash
run: |
set -x
cd ..
mkdir -p third-party
cd third-party
git clone https://github.com/fmtlib/fmt --branch 10.2.1 --depth 1
cd fmt
cmake -S . -B ./build -D FMT_DOC=OFF -D FMT_TEST=OFF -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DCMAKE_CXX_COMPILER=${{ steps.setup-cpp.outputs.cxx }} -DCMAKE_C_COMPILER=${{ steps.setup-cpp.outputs.cc }}
N_CORES=$(nproc 2>/dev/null || echo 1)
cmake --build ./build --config ${{ matrix.build-type }} --parallel $N_CORES
cmake --install ./build --prefix ./install
fmt_root=$(pwd)/install
if [[ ${{ runner.os }} == 'Windows' ]]; then
fmt_root=$(echo "$fmt_root" | sed 's/\\/\//g')
fmt_root=$(echo $fmt_root | sed 's|^/d/|D:/|')
echo "$fmt_root"
fi
echo -E "fmt-root=$fmt_root" >> $GITHUB_OUTPUT
- name: Install Duktape
id: duktape-install
shell: bash
run: |
set -x
cd ..
mkdir -p third-party
cd third-party
curl -LJO https://github.com/svaarala/duktape/releases/download/v2.7.0/duktape-2.7.0.tar.xz
tar -xf duktape-2.7.0.tar.xz
cp ../mrdocs/third-party/duktape/CMakeLists.txt ./duktape-2.7.0/CMakeLists.txt
cp ../mrdocs/third-party/duktape/duktapeConfig.cmake.in ./duktape-2.7.0/duktapeConfig.cmake.in
cd duktape-2.7.0
if [[ "${{ matrix.shared && 'true' || 'false' }}" == 'true' ]]; then
sed -i 's/#undef DUK_F_DLL_BUILD/#define DUK_F_DLL_BUILD/g' "src/duk_config.h"
else
sed -i 's/#define DUK_F_DLL_BUILD/#undef DUK_F_DLL_BUILD/g' "src/duk_config.h"
fi
cmake -S . -B ./build -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DCMAKE_CXX_COMPILER=${{ steps.setup-cpp.outputs.cxx }} -DCMAKE_C_COMPILER=${{ steps.setup-cpp.outputs.cc }}
N_CORES=$(nproc 2>/dev/null || echo 1)
cmake --build ./build --config ${{ matrix.build-type }} --parallel $N_CORES
cmake --install ./build --prefix ./install
duktape_root=$(pwd)/install
if [[ ${{ runner.os }} == 'Windows' ]]; then
duktape_root=$(echo "$duktape_root" | sed 's/\\/\//g')
duktape_root=$(echo $duktape_root | sed 's|^/d/|D:/|')
echo "$duktape_root"
fi
echo -E "duktape-root=$duktape_root" >> $GITHUB_OUTPUT
- name: Install Libxml2
id: libxml2-install
if: matrix.compiler == 'msvc'
shell: bash
run: |
set -x
cd ..
mkdir -p third-party
cd third-party
git config --global init.defaultBranch master
git config --global advice.detachedHead false
git clone https://github.com/GNOME/libxml2 --branch v2.12.6 --depth 1
cd libxml2
cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Release -DLIBXML2_WITH_PROGRAMS=ON -DLIBXML2_WITH_FTP=OFF -DLIBXML2_WITH_HTTP=OFF -DLIBXML2_WITH_ICONV=OFF -DLIBXML2_WITH_LEGACY=OFF -DLIBXML2_WITH_LZMA=OFF -DLIBXML2_WITH_ZLIB=OFF -DLIBXML2_WITH_ICU=OFF -DLIBXML2_WITH_TESTS=OFF -DLIBXML2_WITH_HTML=ON -DLIBXML2_WITH_C14N=ON -DLIBXML2_WITH_CATALOG=ON -DLIBXML2_WITH_DEBUG=ON -DLIBXML2_WITH_ISO8859X=ON -DLIBXML2_WITH_MEM_DEBUG=OFF -DLIBXML2_WITH_MODULES=ON -DLIBXML2_WITH_OUTPUT=ON -DLIBXML2_WITH_PATTERN=ON -DLIBXML2_WITH_PUSH=ON -DLIBXML2_WITH_PYTHON=OFF -DLIBXML2_WITH_READER=ON -DLIBXML2_WITH_REGEXPS=ON -DLIBXML2_WITH_SAX1=ON -DLIBXML2_WITH_SCHEMAS=ON -DLIBXML2_WITH_SCHEMATRON=ON -DLIBXML2_WITH_THREADS=ON -DLIBXML2_WITH_THREAD_ALLOC=OFF -DLIBXML2_WITH_TREE=ON -DLIBXML2_WITH_VALID=ON -DLIBXML2_WITH_WRITER=ON -DLIBXML2_WITH_XINCLUDE=ON -DLIBXML2_WITH_XPATH=ON -DLIBXML2_WITH_XPTR=ON -DCMAKE_CXX_COMPILER=${{ steps.setup-cpp.outputs.cxx || steps.parameters.outputs.clang-bin }} -DCMAKE_C_COMPILER=${{ steps.setup-cpp.outputs.cc || steps.parameters.outputs.clang-bin }}
N_CORES=$(nproc 2>/dev/null || echo 1)
cmake --build ./build --config ${{ matrix.build-type }} --parallel $N_CORES
cmake --install ./build --prefix ./install
libxml2_root=$(pwd)/install
if [[ ${{ runner.os }} == 'Windows' ]]; then
libxml2_root=$(echo "$libxml2_root" | sed 's/\\/\//g')
libxml2_root=$(echo $libxml2_root | sed 's|^/d/|D:/|')
echo "$libxml2_root"
fi
echo -E "libxml2-root=$libxml2_root" >> $GITHUB_OUTPUT
- name: LLVM Parameters
id: llvm-parameters
run: |
echo -E "llvm-hash=e1065370aaacb1b1cb48e77d37d376bf024f4a39" >> $GITHUB_OUTPUT
echo -E "llvm-id=e1065370" >> $GITHUB_OUTPUT
echo -E "llvm-build-preset=${{ runner.os == 'Windows' && 'release-win' || 'release-unix' }}" >> $GITHUB_OUTPUT
cd ..
llvm_root=$(pwd)/third-party/llvm-project/install
if [[ ${{ runner.os }} == 'Windows' ]]; then
llvm_root=$(echo "$llvm_root" | sed 's/\\/\//g')
llvm_root=$(echo $llvm_root | sed 's|^/d/|D:/|')
echo "$llvm_root"
fi
echo -E "llvm-root=$llvm_root" >> $GITHUB_OUTPUT
libcxx_root=$(pwd)/third-party/llvm-project/install
if [[ ${{ runner.os }} == 'Windows' ]]; then
libcxx_root=$(echo "$libcxx_root" | sed 's/\\/\//g')
libcxx_root=$(echo $libcxx_root | sed 's|^/d/|D:/|')
echo "$libcxx_root"
fi
echo -E "libcxx-root=$libcxx_root" >> $GITHUB_OUTPUT
- name: LLVM Binaries
id: llvm-cache
uses: actions/cache@v4
with:
path: ${{ steps.llvm-parameters.outputs.llvm-root }}
key: llvm-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.version }}-${{ steps.llvm-parameters.outputs.llvm-build-preset }}-${{ steps.llvm-parameters.outputs.llvm-hash }}
- name: Install LLVM
id: llvm-install
if: steps.llvm-cache.outputs.cache-hit != 'true'
shell: bash
run: |
# LLVM is be installed with the default compiler
set -x
# Shallow clone LLVM_HASH in ../third-party/llvm
cd ..
mkdir -p third-party/llvm-project
cd third-party/llvm-project
llvm_project_root=$(pwd)
git config --global init.defaultBranch master
git config --global advice.detachedHead false
git init
git remote add origin https://github.com/llvm/llvm-project.git
git fetch --depth 1 origin ${{ steps.llvm-parameters.outputs.llvm-hash }}
git checkout FETCH_HEAD
# Copy presets
cp ../../mrdocs/third-party/llvm/CMakePresets.json ./llvm
cp ../../mrdocs/third-party/llvm/CMakeUserPresets.json.example ./llvm/CMakeUserPresets.json
# Build
cd llvm
llvm_root=$(pwd)
cmake --version
cmake -S . -B ./build --preset=${{ steps.llvm-parameters.outputs.llvm-build-preset }} -DCMAKE_CXX_COMPILER=${{ steps.setup-cpp.outputs.cxx }} -DCMAKE_C_COMPILER=${{ steps.setup-cpp.outputs.cc }}
if [[ ${{ runner.os }} == 'Linux' ]]; then
cmake --build ./build --target help
fi
N_CORES=$(nproc 2>/dev/null || echo 1)
if [ ${{ runner.os }} != 'Windows' ]; then
cmake --build ./build --config Release --parallel $N_CORES
else
# Allow build step to fail
set +e
cmake --build ./build --config Release --parallel $N_CORES
exit_code=$?
set -e
if [ $exit_code -ne 0 ]; then
echo "Could not build LLVM in CI. Fetching pre-built binaries from mrdocs.com."
cd ..
llvm_archive_filename="Windows-Release-${{ steps.llvm-parameters.outputs.llvm-id }}.7z"
llvm_url="https://mrdocs.com/llvm+clang/$llvm_archive_filename"
curl -L -o "$llvm_archive_filename" "$llvm_url"
7z x "$llvm_archive_filename"
cd "Release"
mkdir -p "$llvm_project_root"/install
mv * "$llvm_project_root"/install
cd ..
rm -rf "Release"
exit 0
fi
fi
cmake --install ./build --prefix "$llvm_project_root"/install
- name: LibC++ Binaries
id: libcxx-cache
uses: actions/cache@v4
with:
path: ${{ steps.llvm-parameters.outputs.libcxx-root }}
key: libcxx-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.version }}-${{ steps.llvm-parameters.outputs.llvm-hash }}
- name: Install LibC++
id: libcxx-install
if: ${{ steps.libcxx-cache.outputs.cache-hit != 'true'}}
shell: bash
run: |
set -x
cd ..
llvm_project_root="$(pwd)/third-party/llvm-project"
if [ ! -d "$llvm_project_root/runtimes" ]; then
mkdir -p $llvm_project_root
cd $llvm_project_root
git config --global init.defaultBranch master
git config --global advice.detachedHead false
git init
git remote add origin https://github.com/llvm/llvm-project.git
git fetch --depth 1 origin ${{ steps.llvm-parameters.outputs.llvm-hash }}
git checkout FETCH_HEAD
fi
export CXX="$llvm_project_root/install/bin/clang++"
export CC="$llvm_project_root/install/bin/clang"
cd $llvm_project_root
if [ ${{ runner.os }} != 'Windows' ]; then
cmake -G Ninja \
-S runtimes \
-B build-libcxx \
-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
-DCMAKE_INSTALL_PREFIX="$llvm_project_root/install"
ninja -C build-libcxx cxx cxxabi unwind
ninja -C build-libcxx install-cxx install-cxxabi install-unwind
else
cmake -G Ninja \
-S runtimes \
-B build-libcxx \
-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" \
-DCMAKE_INSTALL_PREFIX="$llvm_project_root/install" \
-DLIBCXXABI_USE_LLVM_UNWINDER=OFF \
-DLIBCXXABI_ENABLE_SHARED=OFF \
-DLIBCXXABI_ENABLE_STATIC=ON \
-DLIBCXX_ENABLE_SHARED=OFF \
-DLIBCXX_NO_VCRUNTIME=ON \
-DCMAKE_CXX_FLAGS="-D__ORDER_LITTLE_ENDIAN__=1234 -D__ORDER_BIG_ENDIAN__=4321 -D__BYTE_ORDER__=__ORDER_LITTLE_ENDIAN__"
ninja -C build-libcxx cxx
ninja -C build-libcxx install-cxx
fi
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: CMake Workflow
uses: alandefreitas/cpp-actions/[email protected]
with:
cmake-version: ${{ matrix.compiler == 'clang' && '3.26' || '>=3.26' }}
cxxstd: ${{ matrix.cxxstd }}
cc: ${{ steps.setup-cpp.outputs.cc || matrix.cc }}
ccflags: ${{ matrix.ccflags }}${{ ( matrix.compiler == 'gcc' && ' -static') || '' }}${{ ( matrix.asan && ' -static-libasan') || '' }}${{ ( matrix.tsan && ' -static-libtsan') || '' }}
cxx: ${{ steps.setup-cpp.outputs.cxx || matrix.cxx }}
cxxflags: ${{ matrix.cxxflags }}${{ ( matrix.compiler == 'gcc' && ' -static') || '' }}${{ ( matrix.asan && ' -static-libasan') || '' }}${{ ( matrix.tsan && ' -static-libtsan') || '' }}
generator: Ninja
toolchain: ${{ steps.package-install.outputs.vcpkg_toolchain || steps.package-install.outputs.vcpkg-toolchain }}
build-type: RelWithDebInfo
install-prefix: .local
extra-args: |
-D MRDOCS_BUILD_DOCS=OFF
-D LLVM_ROOT=${{ steps.llvm-parameters.outputs.llvm-root }}
-D Clang_ROOT=${{ steps.llvm-parameters.outputs.llvm-root }}
-D duktape_ROOT=${{ steps.duktape-install.outputs.duktape-root }}
-D Duktape_ROOT=${{ steps.duktape-install.outputs.duktape-root }}
-D fmt_ROOT=${{ steps.fmt-install.outputs.fmt-root }}
${{ (steps.libxml2-install.outputs.libxml2-root && format('-D libxml2_ROOT={0}', steps.libxml2-install.outputs.libxml2-root)) || '' }}
${{ (steps.libxml2-install.outputs.libxml2-root && format('-D LibXml2_ROOT={0}', steps.libxml2-install.outputs.libxml2-root)) || '' }}
export-compile-commands: true
run-tests: true
install: true
package: ${{ matrix.is-main }}
package-dir: packages
package-generators: ${{ (runner.os == 'Windows' && '7Z ZIP WIX') || 'TGZ TXZ' }}
package-artifact: false
- name: Upload GitHub Release Artifacts
if: ${{ matrix.is-main && matrix.compiler != 'clang' }}
uses: actions/upload-artifact@v4
with:
name: release-packages-${{ runner.os }}
path: build/packages
retention-days: 1
- name: FlameGraph
uses: alandefreitas/cpp-actions/[email protected]
if: matrix.time-trace
with:
build-dir: build
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Codecov
if: ${{ matrix.coverage}}
uses: codecov/[email protected]
with:
directory: './build'
fail_ci_if_error: true
gcov: true
verbose: true
website:
needs: build
defaults:
run:
shell: bash
name: Website
timeout-minutes: 30
runs-on: ubuntu-20.04
container: ubuntu:23.04
permissions:
contents: write
steps:
- name: Setup C++
uses: alandefreitas/cpp-actions/[email protected]
id: setup-cpp
with:
compiler: clang
version: 16
check-latest: true
- name: Install packages
uses: alandefreitas/cpp-actions/[email protected]
id: package-install
with:
apt-get: libstdc++-12-dev asciidoctor cmake bzip2 git
cc: ${{ steps.setup-cpp.outputs.cc }}
cxx: ${{ steps.setup-cpp.outputs.cxx }}
- name: Clone mrdocs
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Download MrDocs package
uses: actions/download-artifact@v4
with:
name: release-packages-Linux
path: packages
- name: Install MrDocs
run: |
set -x
find packages -name 'MrDocs-*-Linux.tar.gz' -exec tar -vxzf {} -C /usr/local --strip-components=1 \;
mrdocs --version
MRDOCS_ROOT=/usr/local
echo -e "MRDOCS_ROOT=$MRDOCS_ROOT" >> $GITHUB_ENV
CXX=/usr/bin/clang-16
echo -e "CXX=$CXX" >> $GITHUB_ENV
- name: Clone Boost.URL
uses: alandefreitas/cpp-actions/[email protected]
id: boost-url-clone
with:
branch: develop
modules: url
boost-dir: boost
modules-scan-paths: '"test example"'
modules-exclude-paths: ''
trace-commands: true
- name: Generate Landing Page
working-directory: docs/website
run: |
npm ci
node render.js
mkdir -p ../../build/website
cp index.html ../../build/website/index.html
cp styles.css ../../build/website/styles.css
- name: Generate Website Documentation
working-directory: docs
run: |
# This playbook renders the documentation
# content for the website. It includes
# master, develop, and tags.
npm install
npx antora antora-playbook.yml
mkdir -p ../build/website/docs
cp -r build/site/* ../build/website/docs
- name: Upload Website as Artifact
uses: actions/upload-artifact@v4
with:
name: website
path: build/website
retention-days: 30
- name: Generate Local Documentation
working-directory: docs
run: |
# This playbook allows us to render the
# documentation content and visualize it
# before a workflow that pushes to the
# website is triggered.
npx antora local-antora-playbook.yml
mkdir -p ../build/docs-local
cp -r build/site/* ../build/docs-local
- name: Generate Demos
run: |
CXX="${{ steps.setup-cpp.outputs.cxx }}"
export CXX
CC="${{ steps.setup-cpp.outputs.cc }}"
export CC
declare -a generators=(
"adoc"
"html"
"xml"
)
# Generate the demos for each variant and generator
for variant in single multi; do
for generator in "${generators[@]}"; do
[[ $variant = multi ]] && multipage="true" || multipage="false"
mrdocs --config="$(pwd)/boost/libs/url/doc/mrdocs.yml" "../CMakeLists.txt" --output="$(pwd)/demos/boost-url/$variant/$generator" --multipage=$multipage --generate="$generator"
echo "Number of files in demos/boost-url/$variant/$format: $(find demos/boost-url/$variant/$format -type f | wc -l)"
done
asciidoctor -d book -R "$(pwd)/demos/boost-url/$variant/adoc" -D "$(pwd)/demos/boost-url/$variant/adoc-asciidoc" "$(pwd)/demos/boost-url/$variant/adoc/**/*.adoc"
done
# Compress demos for the artifact
tar -cjf $(pwd)/demos.tar.gz -C $(pwd)/demos --strip-components 1 .
echo "demos_path=$(pwd)/demos.tar.gz" >> $GITHUB_ENV
- name: Upload Demos as Artifacts
uses: actions/upload-artifact@v4
with:
name: demos${{ (contains(fromJSON('["master", "develop"]'), github.ref_name ) && format('-{0}', github.ref_name)) || '' }}
path: ${{ env.demos_path }}
# develop and master are retained for longer so that they can be compared
retention-days: ${{ contains(fromJSON('["master", "develop"]'), github.ref_name) && '30' || '1' }}
- name: Download Previous Demos
if: startsWith(github.ref, 'refs/tags/')
id: download-prev-demos
uses: actions/download-artifact@v4
with:
name: demos-develop
path: demos-previous
- name: Compare demos
if: startsWith(github.ref, 'refs/tags/') && steps.download-prev-demos.outputs.cache-hit == 'true'
id: compare-demos
run: |
set -x
# Define URLs and directories
LOCAL_DEMOS_DIR="./demos/"
PREV_DEMOS_DIR="./demos-previous/"
DIFF_DIR="./demos-diff/"
# Create directories if they don't exist
mkdir -p $PREV_DEMOS_DIR $DIFF_DIR
# Iterate over the previous files and compare them with the corresponding local files
find $PREV_DEMOS_DIR -type f | while read previous_file; do
# Derive the corresponding local file path
local_file="${LOCAL_DEMOS_DIR}${previous_file#$PREV_DEMOS_DIR}"
diff_output="$DIFF_DIR${previous_file#$PREV_DEMOS_DIR}"
if [[ -f $local_file ]]; then
mkdir -p "$(dirname "$diff_output")"
diff "$previous_file" "$local_file" > "$diff_output"
if [[ ! -s $diff_output ]]; then
rm "$diff_output"
fi
else
echo "LOCAL FILE $local_file DOES NOT EXITS." > "$diff_output"
echo "PREVIOUS CONTENT OF THE FILE WAS:" >> "$diff_output"
cat "$previous_file" >> "$diff_output"
fi
done
# Iterate over the local files to find new files
find $LOCAL_DEMOS_DIR -type f | while read local_file; do
previous_file="${PREV_DEMOS_DIR}${local_file#$LOCAL_DEMOS_DIR}"
diff_output="$DIFF_DIR${local_file#$LOCAL_DEMOS_DIR}"
if [[ ! -f $previous_file ]]; then
echo "PREVIOUS $previous_file DOES NOT EXIST." > "$diff_output"
echo "IT HAS BEEN INCLUDED IN THIS VERSION." >> "$diff_output"
echo "NEW CONTENT OF THE FILE IS:" >> "$diff_output"
fi
done
# Check if the diff directory is empty
if [[ -z $(ls -A $DIFF_DIR) ]]; then
echo "No differences found."
# Store this as an output for the next step
echo "diff=false" >> $GITHUB_OUTPUT
else
# Calculate number of files in the diff directory
N_FILES=$(find $DIFF_DIR -type f | wc -l)
echo "Differences found in $N_FILES output files."
echo "diff=true" >> $GITHUB_OUTPUT
fi
- name: Upload Demo Diff as Artifacts
if: startsWith(github.ref, 'refs/tags/') && steps.download-prev-demos.outputs.cache-hit == 'true' && steps.compare-demos.outputs.diff == 'true'
uses: actions/upload-artifact@v4
with:
name: demos-diff
path: demos-diff
retention-days: 30
- name: Publish Website to GitHub Pages
if: ${{ github.event_name == 'push' && (contains(fromJSON('["master", "develop"]'), github.ref_name) || startsWith(github.ref, 'refs/tags/')) }}
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: build/website
force_orphan: true
- name: Publish website
if: ${{ github.event_name == 'push' && (contains(fromJSON('["master", "develop"]'), github.ref_name) || startsWith(github.ref, 'refs/tags/')) }}
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: |
# Add SSH key
mkdir -p /home/runner/.ssh
ssh-keyscan dev-websites.cpp.al >> /home/runner/.ssh/known_hosts
chmod 600 /home/runner/.ssh/known_hosts
echo "${{ secrets.DEV_WEBSITES_SSH_KEY }}" > /home/runner/.ssh/github_actions
chmod 600 /home/runner/.ssh/github_actions
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
ssh-add /home/runner/.ssh/github_actions
# Copy files: This step will copy the landing page and the documentation to www.mrdocs.com
chmod 755 -R $(pwd)/build/website
scp -o StrictHostKeyChecking=no -r $(pwd)/build/website/* [email protected]:/var/www/mrdox.com/
# Remove previous demos associated with this tag
demo_dir="/var/www/mrdox.com/demos/${{ github.ref_name }}"
ssh -o StrictHostKeyChecking=no [email protected] "rm -rf $demo_dir/boost-url; mkdir -p $demo_dir/boost-url"
# Copy demos: This step will copy the demos to www.mrdocs.com/demos
chmod 755 -R $(pwd)/demos
scp -o StrictHostKeyChecking=no -r $(pwd)/demos/* [email protected]:$demo_dir/
releases:
needs: build
defaults:
run:
shell: bash
name: Releases
timeout-minutes: 120
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- name: Clone mrdocs
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: release-packages-Linux
path: build
- uses: actions/download-artifact@v4
with:
name: release-packages-Windows
path: build
- name: List artifacts
run: ls -R
working-directory: build
- name: Create changelog
uses: alandefreitas/cpp-actions/[email protected]
with:
output-path: CHANGELOG.md
thank-non-regular: ${{ startsWith(github.ref, 'refs/tags/') }}
github-token: ${{ secrets.GITHUB_TOKEN }}
limit: 150
- name: Compare Markup Templates
run: |
set -x
chmod +x .github/compare_templates.sh
.github/compare_templates.sh
- name: Check info nodes
run: |
set -x
chmod +x .github/check_info_nodes_support.sh
.github/check_info_nodes_support.sh
- name: Create GitHub Package Release
if: ${{ github.event_name == 'push' && (contains(fromJSON('["master", "develop"]'), github.ref_name) || startsWith(github.ref, 'refs/tags/')) }}
uses: softprops/action-gh-release@v1
with:
files: build/MrDocs-?.?.?-*.*
name: ${{ github.ref_name || github.ref }}
tag_name: ${{ github.ref_name || github.ref }}${{ ((!startsWith(github.ref, 'refs/tags/')) && '-release') || '' }}
body_path: CHANGELOG.md
prerelease: false
draft: false
token: ${{ github.token }}
- uses: dev-drprasad/[email protected]
if: ${{ github.event_name == 'push' && contains(fromJSON('["master", "develop"]'), github.ref_name) }}
with:
keep_latest: 1
delete_tag_pattern: ${{ github.ref_name || github.ref }}${{ ((!startsWith(github.ref, 'refs/tags/')) && '-release') || '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}