Repository navigation
webrtc and trystero: webcpp::webrtc built, trystero on it and refactored #106
Workflow file for this run
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
| # Copyright (c) 2026 WebCpp.org | |
| # | |
| # Distributed under the Boost Software License, Version 1.0. (See | |
| # accompanying file LICENSE_1_0.txt or copy at | |
| # https://www.boost.org/LICENSE_1_0.txt) | |
| # The superproject's CI: the lanes, the own lanes, the docs, the lint, the tests of the tools and | |
| # the report of library.yml, over every library of libs/ at the commit its submodule points to, and | |
| # the index page with every library's page. Then: | |
| # | |
| # site b2 site builds the whole site into bin/site/ from those pages and the report, with | |
| # the site's own pages (site/, webcpporg/webcpporg.github.io), and checks every link | |
| # and every page's HTML, on every run; the build bin/site links to is the artifact | |
| # site. | |
| # publish on a push to main, commits the artifact site, b2 site's output as it is, with a | |
| # .nojekyll, as the one commit of an orphan branch gh-pages and force-pushes that branch | |
| # alone to webcpporg/webcpporg.github.io, whose Pages serve it at | |
| # https://webcpporg.github.io/. gh-pages is build output, replaced whole. The push uses | |
| # the deploy key of that repository, the secret SITE_DEPLOY_KEY. | |
| # pages once publish has succeeded, deploys this repository's own Pages, the old address | |
| # https://webcpporg.github.io/webcpp/, as tools/site/redirect.py's two pages, which | |
| # send every path under /webcpp/ to the same path at the root, and carry noindex as | |
| # every page of the preview does. | |
| # | |
| # The site is published whenever the pages were built, a red matrix included: the matrix is | |
| # there to show what fails. | |
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| workflow_dispatch: | |
| inputs: | |
| prepare-environment: | |
| description: Prepare and publish CI environments instead of running the test matrix. | |
| type: boolean | |
| default: false | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| # A run on main publishes the site, and is never cut short by the next. | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
| jobs: | |
| prepare-environment: | |
| name: Prepare environments | |
| if: >- | |
| github.event_name == 'workflow_dispatch' && inputs.prepare-environment | |
| && github.repository == 'webcpporg/webcpp' | |
| permissions: | |
| contents: read | |
| packages: write | |
| uses: ./.github/workflows/prepare-environments.yml | |
| ci: | |
| name: CI | |
| if: inputs.prepare-environment != true | |
| uses: ./.github/workflows/library.yml | |
| site: | |
| name: Site | |
| needs: ci | |
| if: always() && needs.ci.outputs.docs == 'true' | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 30 | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| # The superproject with its submodules, the site's among them. | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| submodules: true | |
| - uses: ./tools/ci/actions/boost | |
| - uses: ./tools/ci/actions/node | |
| - name: Download the pages | |
| uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 | |
| with: | |
| name: docs | |
| path: bin/pages | |
| - name: Download the report | |
| uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 | |
| with: | |
| name: report | |
| path: bin/report | |
| # The pages and the report built already, so b2 site builds no doc of its own. b2 needs a | |
| # toolset registered to load the project, though it compiles nothing here. | |
| - name: b2 site | |
| id: site | |
| run: | | |
| python3 tools/ci/matrix.py register clang-18 | |
| env -u CPATH -u CPLUS_INCLUDE_PATH -u C_INCLUDE_PATH \ | |
| b2 --user-config=.local/user-config.jam -a toolset=clang-18 site \ | |
| -sWEBCPP_SITE_DOCS=bin/pages -sWEBCPP_SITE_REPORT=bin/report | |
| # bin/site is a link onto the build b2 site swapped in (tools/site/site.jam): the upload is | |
| # given the build itself, never left to treat a link as its root. | |
| echo "build=$(readlink -f bin/site)" >> "$GITHUB_OUTPUT" | |
| # Every file b2 site wrote, a hidden one included, which upload-artifact leaves out by default. | |
| - name: Upload the site | |
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | |
| with: | |
| name: site | |
| path: ${{ steps.site.outputs.build }} | |
| include-hidden-files: true | |
| if-no-files-found: error | |
| retention-days: 7 | |
| # Only webcpporg/webcpp holds the deploy key: a fork's main publishes nothing. The commit needs | |
| # no history of gh-pages, which it replaces whole, so the published repository is never | |
| # fetched. The runs on main queue rather than cancel (concurrency, above), so an older site | |
| # never replaces a newer one. | |
| publish: | |
| name: Publish | |
| needs: site | |
| if: >- | |
| always() && needs.site.result == 'success' && github.event_name == 'push' | |
| && github.ref == 'refs/heads/main' && github.repository == 'webcpporg/webcpp' | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 15 | |
| concurrency: | |
| group: publish | |
| cancel-in-progress: false | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - name: Download the site | |
| uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 | |
| with: | |
| name: site | |
| path: ${{ runner.temp }}/site | |
| # The key goes to a file of mode 600, made so by the umask before it holds anything, and no | |
| # step prints it. GitHub's host key is the one it publishes (api.github.com/meta), so ssh | |
| # trusts no host it has not been told of. | |
| - name: Write the deploy key | |
| env: | |
| SITE_DEPLOY_KEY: ${{ secrets.SITE_DEPLOY_KEY }} | |
| run: | | |
| if [ -z "$SITE_DEPLOY_KEY" ]; then | |
| echo "the secret SITE_DEPLOY_KEY, the deploy key of webcpporg/webcpporg.github.io, is not set" | |
| exit 1 | |
| fi | |
| umask 077 | |
| mkdir -p "$RUNNER_TEMP/ssh" | |
| printf '%s\n' "$SITE_DEPLOY_KEY" > "$RUNNER_TEMP/ssh/deploy-key" | |
| chmod 600 "$RUNNER_TEMP/ssh/deploy-key" | |
| printf '%s\n' \ | |
| 'github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl' \ | |
| > "$RUNNER_TEMP/ssh/known_hosts" | |
| - name: Publish to webcpporg.github.io's gh-pages | |
| env: | |
| SHA: ${{ github.sha }} | |
| run: | | |
| site="$RUNNER_TEMP/site" | |
| touch "$site/.nojekyll" | |
| git -C "$site" init -q -b gh-pages | |
| git -C "$site" add --all | |
| git -C "$site" -c user.name="github-actions[bot]" \ | |
| -c user.email="41898282+github-actions[bot]@users.noreply.github.com" \ | |
| -c commit.gpgsign=false commit -q -m "The preview of main at $SHA" | |
| export GIT_SSH_COMMAND="ssh -i '$RUNNER_TEMP/ssh/deploy-key' -o IdentitiesOnly=yes \ | |
| -o UserKnownHostsFile='$RUNNER_TEMP/ssh/known_hosts' -o StrictHostKeyChecking=yes" | |
| git -C "$site" push --force git@github.com:webcpporg/webcpporg.github.io.git \ | |
| refs/heads/gh-pages:refs/heads/gh-pages | |
| - name: Remove the deploy key | |
| if: always() | |
| run: rm -rf "$RUNNER_TEMP/ssh" | |
| # The old address redirects only once the site it sends readers to is published. | |
| pages: | |
| name: Pages | |
| needs: publish | |
| if: always() && needs.publish.result == 'success' | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 15 | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deploy.outputs.page_url }} | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: false | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: The redirect to https://webcpporg.github.io/ | |
| run: >- | |
| python3 tools/site/redirect.py --to https://webcpporg.github.io/ --prefix /webcpp/ | |
| --out bin/redirect | |
| - uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 | |
| with: | |
| path: bin/redirect | |
| - uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0 | |
| - name: Deploy | |
| id: deploy | |
| uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1 |