build: release.sh has smart checkouts #1279
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| pull_request: | |
| branches: | |
| - master | |
| - develop | |
| push: | |
| branches: | |
| - '*' | |
| tags: | |
| - "v*.*.*" | |
| concurrency: | |
| group: ${{format('{0}:{1}', github.repository, github.ref)}} | |
| cancel-in-progress: true | |
| env: | |
| GIT_FETCH_JOBS: 8 | |
| NET_RETRY_COUNT: 5 | |
| DEFAULT_BUILD_VARIANT: debug,release | |
| jobs: | |
| cpp-matrix: | |
| runs-on: ubuntu-latest | |
| name: Generate Test Matrix | |
| outputs: | |
| matrix: ${{ steps.cpp-matrix.outputs.matrix }} | |
| steps: | |
| - name: Clone cpp-actions | |
| uses: actions/checkout@v4 | |
| - name: Generate Test Matrix | |
| uses: ./cpp-matrix | |
| id: cpp-matrix | |
| with: | |
| standards: '>=14' | |
| compilers: | | |
| gcc >=4.8 <6 || >=9 | |
| clang >=3.8 <6 || >11 | |
| msvc >=14 | |
| apple-clang * | |
| mingw * | |
| clang-cl * | |
| subrange-policy: | | |
| msvc: one-per-minor | |
| latest-factors: | | |
| gcc Coverage TSan UBSan Fetch-Content | |
| clang Fetch-Content | |
| factors: | | |
| gcc ASan Shared No-Deps | |
| msvc Shared x86 | |
| clang Time-Trace ASan+UBSan | |
| mingw Shared | |
| force-factors: | | |
| mingw: No-Deps | |
| trace-commands: true | |
| extra-values: | | |
| vcpkg-packages: {{#if (not fetch-content)}}fmt{{/if}} | |
| address-model: {{#if x86}}32{{else}}64{{/if}} | |
| 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 }} | |
| timeout-minutes: 30 | |
| permissions: | |
| contents: write | |
| steps: | |
| # GitHub Actions no longer support older containers. | |
| # The workaround is to install our own Node.js for the actions. | |
| - name: Patch Node | |
| # The containers that need Node.js 20 will have volumes set up so that | |
| # the Node.js 20 installation can go there. | |
| if: ${{ matrix.container.volumes }} | |
| run: | | |
| set -x | |
| apt-get update | |
| apt-get install -y curl xz-utils | |
| curl -LO https://unofficial-builds.nodejs.org/download/release/v20.9.0/node-v20.9.0-linux-x64-glibc-217.tar.xz | |
| tar -xf node-v20.9.0-linux-x64-glibc-217.tar.xz --strip-components 1 -C /node20217 | |
| ldd /__e/node20/bin/node | |
| - name: Clone cpp-actions | |
| uses: actions/checkout@v4 | |
| # Set up the compiler before package-install in case one of the packages needs a compiler | |
| - name: Setup C++ | |
| uses: ./setup-cpp | |
| id: setup-cpp | |
| with: | |
| compiler: ${{ matrix.compiler }} | |
| # For GCC/Clang, we are iterating majors, so we get whatever major is available from the system | |
| # so that we get the version most likely to be installed by default. | |
| # For other libraries, any logic might be acceptable here. | |
| version: ${{ matrix.version }} | |
| trace-commands: true | |
| # We're not really going to use doxygen. This is only here to test the action. | |
| - name: Setup Doxygen | |
| uses: ./setup-program | |
| id: setup-doxygen | |
| with: | |
| name: doxygen | |
| version: '>=1.9' | |
| url: | | |
| https://github.com/doxygen/doxygen/releases/download/Release_1_9_7/doxygen-1.9.7.{{ os }}${{ ( runner.os == 'Windows' && '.x64' ) || '' }}.bin.${{ ( runner.os == 'Windows' && 'zip' ) || 'tar.gz' }} | |
| install-prefix: ${{ ( runner.os == 'Linux' && '/usr/local' ) || '' }} | |
| check-latest: true | |
| update-environment: true | |
| fail-on-error: ${{ runner.os != 'macOS' }} | |
| trace-commands: true | |
| - name: Install packages | |
| uses: ./package-install | |
| id: package-install | |
| with: | |
| vcpkg: ${{ matrix.vcpkg-packages }} | |
| vcpkg-triplet: ${{ matrix.triplet }} | |
| apt-get: ${{ matrix.install }} | |
| apt-get-ignore-missing: ${{ matrix.is-container }} | |
| cc: ${{ steps.setup-cpp.outputs.cc }} | |
| ccflags: ${{ matrix.ccflags }} | |
| cxx: ${{ steps.setup-cpp.outputs.cxx }} | |
| cxxflags: ${{ matrix.cxxflags }} | |
| trace-commands: true | |
| - name: Clone Boost.Variant2 | |
| uses: ./boost-clone | |
| id: boost-clone | |
| with: | |
| branch: master | |
| modules: variant2 | |
| modules-scan-paths: 'test' | |
| modules-exclude-paths: '' | |
| trace-commands: true | |
| - name: B2 Workflow | |
| if: ${{ ! matrix.has-factors && ! runner.os == 'Windows' }} | |
| uses: ./b2-workflow | |
| with: | |
| source-dir: ${{ steps.boost-clone.outputs.boost-dir }} | |
| modules: variant2 | |
| toolset: ${{ matrix.b2-toolset }} | |
| build-variant: ${{ matrix.build-type }} | |
| cxx: ${{ steps.setup-cpp.outputs.cxx || '' }} | |
| cxxstd: ${{ matrix.cxxstd }} | |
| address-model: ${{ matrix.address-model }} | |
| asan: ${{ matrix.asan }} | |
| ubsan: ${{ matrix.ubsan }} | |
| tsan: ${{ matrix.tsan }} | |
| shared: ${{ matrix.shared }} | |
| trace-commands: true | |
| - name: CMake Workflow | |
| uses: ./cmake-workflow | |
| with: | |
| cmake-version: '>=3.20' | |
| source-dir: tests | |
| generator: ${{ matrix.generator }} | |
| generator-toolset: ${{ matrix.generator-toolset }} | |
| toolchain: ${{ steps.package-install.outputs.vcpkg-toolchain }} | |
| build-type: ${{ matrix.build-type }} | |
| run-tests: true | |
| install-prefix: .local | |
| cxxstd: ${{ matrix.cxxstd }} | |
| cc: ${{ steps.setup-cpp.outputs.cc }} | |
| ccflags: ${{ matrix.ccflags }} | |
| cxx: ${{ steps.setup-cpp.outputs.cxx }} | |
| cxxflags: ${{ matrix.cxxflags }} | |
| shared: ${{ matrix.shared }} | |
| extra-args: | | |
| ${{ ( !matrix.no-deps && format('-D BOOST_SRC_DIR="{0}"', steps.boost-clone.outputs.boost-dir) ) || '' }} | |
| ${{ ( matrix.no-deps && '-D CPP_ACTIONS_NO_DEPS=ON' ) || '' }} | |
| export-compile-commands: ${{ matrix.time-trace }} | |
| package: true | |
| package-artifact: ${{ matrix.is-main }} | |
| ref-source-dir: . | |
| trace-commands: true | |
| - name: FlameGraph | |
| uses: ./flamegraph | |
| if: matrix.time-trace | |
| with: | |
| source-dir: tests | |
| build-dir: tests/build | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| trace-commands: true | |
| - name: Codecov | |
| if: ${{ matrix.coverage }} | |
| run: | | |
| set -x | |
| gcov_tool="gcov" | |
| if command -v "gcov-${{ steps.setup-cpp.outputs.version-major }}.${{ steps.setup-cpp.outputs.version-minor }}" &> /dev/null; then | |
| gcov_tool="gcov" | |
| elif command -v "gcov-${{ steps.setup-cpp.outputs.version-major }}" &> /dev/null; then | |
| gcov_tool="gcov-${{ steps.setup-cpp.outputs.version-major }}" | |
| fi | |
| lcov -c -q -o "./tests/build/coverage.info" -d "./tests/build" --include "$(pwd)/*" --gcov-tool "$gcov_tool" | |
| # genhtml --legend -f -q "./tests/build/coverage.info" -p "./tests" -o "./tests/build/coverage_html" | |
| cat "./tests/build/coverage.info" | |
| bash <(curl -s https://codecov.io/bash) -f "./tests/build/coverage.info" | |
| echo "# Coverage" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "[](https://codecov.io/github/$GITHUB_REPOSITORY/commit/$GITHUB_SHA)" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "Commit: [](https://codecov.io/github/$GITHUB_REPOSITORY/commit/$GITHUB_SHA)" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "Branch: [](https://codecov.io/github/$GITHUB_REPOSITORY/branch/$GITHUB_REF_NAME)" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| docs: | |
| needs: build | |
| if: ${{ github.event_name == 'push' && (contains(fromJSON('["master", "develop"]'), github.ref_name) || startsWith(github.ref, 'refs/tags/')) }} | |
| defaults: | |
| run: | |
| shell: bash | |
| name: Docs and Release | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 120 | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Clone cpp-actions | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4.0.2 | |
| with: | |
| node-version: '20' | |
| - name: Generate site | |
| working-directory: docs | |
| run: | | |
| npm install | |
| npx antora antora-playbook.yml | |
| - name: Publish to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: docs/build/site | |
| - name: Changelog | |
| uses: ./create-changelog | |
| with: | |
| output-path: CHANGELOG.md | |
| thank-non-regular: ${{ startsWith(github.ref, 'refs/tags/') }} | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| # if ref_name is develop, it only goes to the summary, so we explicitly link commits | |
| link-commits: ${{ github.ref_name == 'develop' }} | |
| trace-commands: true | |
| - name: Create Release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: LICENSE | |
| name: ${{ github.ref_name || github.ref }} | |
| tag_name: ${{ github.ref_name || github.ref }} | |
| body_path: CHANGELOG.md | |
| prerelease: false | |
| draft: false | |
| token: ${{ github.token }} |