CI overhaul based on GitHub Actions
This replaces Travis (for Linux & Mac) and Appveyor (for Windows) with
GitHub Actions. In addition to using GitHub Actions to test PRs, this
also expands the automation of releases so that the only manual steps
are:
1. Create a new CHANGELOG.md entry
2. Create a release tag
Workflows have been create for building and testing PRs and releases,
for publishing releases to GitHub, NPM, and Docker Hub, and for
updating documentation on GitHub Pages.
When a new PR is created, GitHub Actions will:
- Build and test on all combinations of OS, release type, and library
type
Appveyor's workflow took ~2 hours, whereas the new GitHub Actions
workflow takes ~30 minutes.
When a new release tag is created, GitHub Actions will:
- Create a draft release on GitHub
- Extract release notes from CHANGELOG.md & attach them to the
draft release
- Build and test on all combinations of OS, release type, and library
type, aborting if any build or test fails
- Attach release artifacts to the draft release, aborting if any
one artifact can't be prepared
- Fully publish the draft release on GitHub
- Publish the same release to NPM (triggered by GitHub release)
- Publish the same release to Docker Hub (triggered by GitHub release)
- Update the docs on GitHub pages
Closes #336 (GitHub Actions workflow to replace Travis and Appveyor)
b/190743862 (internal; tracking replacement of Travis)
Change-Id: Ic53eef60a8587c5d1487769a0cefaa16eb9b46e7
2021-06-10 21:40:14 +00:00
|
|
|
name: Update Docs
|
|
|
|
|
|
|
|
# Runs when a new release is published on GitHub, or when a pull request is
|
|
|
|
# opened.
|
|
|
|
#
|
|
|
|
# Pushes updated docs to GitHub Pages if triggered from a release workflow.
|
|
|
|
#
|
|
|
|
# Can also be run manually for debugging purposes.
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
types: [opened, synchronize, reopened]
|
|
|
|
release:
|
|
|
|
types: [published]
|
|
|
|
# For manual debugging:
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
ref:
|
|
|
|
description: "The ref to build docs from."
|
|
|
|
required: True
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
publish_docs:
|
2021-06-16 19:18:01 +00:00
|
|
|
name: Build updated docs
|
CI overhaul based on GitHub Actions
This replaces Travis (for Linux & Mac) and Appveyor (for Windows) with
GitHub Actions. In addition to using GitHub Actions to test PRs, this
also expands the automation of releases so that the only manual steps
are:
1. Create a new CHANGELOG.md entry
2. Create a release tag
Workflows have been create for building and testing PRs and releases,
for publishing releases to GitHub, NPM, and Docker Hub, and for
updating documentation on GitHub Pages.
When a new PR is created, GitHub Actions will:
- Build and test on all combinations of OS, release type, and library
type
Appveyor's workflow took ~2 hours, whereas the new GitHub Actions
workflow takes ~30 minutes.
When a new release tag is created, GitHub Actions will:
- Create a draft release on GitHub
- Extract release notes from CHANGELOG.md & attach them to the
draft release
- Build and test on all combinations of OS, release type, and library
type, aborting if any build or test fails
- Attach release artifacts to the draft release, aborting if any
one artifact can't be prepared
- Fully publish the draft release on GitHub
- Publish the same release to NPM (triggered by GitHub release)
- Publish the same release to Docker Hub (triggered by GitHub release)
- Update the docs on GitHub pages
Closes #336 (GitHub Actions workflow to replace Travis and Appveyor)
b/190743862 (internal; tracking replacement of Travis)
Change-Id: Ic53eef60a8587c5d1487769a0cefaa16eb9b46e7
2021-06-10 21:40:14 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Compute ref
|
|
|
|
id: ref
|
|
|
|
# We could be building from a workflow dispatch (manual run), release
|
|
|
|
# event, or pull request. Subsequent steps can refer to $TARGET_REF to
|
|
|
|
# determine the correct ref in all cases.
|
|
|
|
run: |
|
|
|
|
echo "TARGET_REF=${{ github.event.inputs.ref || github.event.release.tag_name || github.ref }}" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
path: src
|
|
|
|
ref: ${{ env.TARGET_REF }}
|
|
|
|
|
|
|
|
- name: Set up Python
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: 3.8
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
pip install wheel
|
|
|
|
pip install sphinxcontrib.plantuml
|
|
|
|
pip install recommonmark
|
|
|
|
pip install cloud_sptheme
|
|
|
|
pip install breathe
|
|
|
|
sudo apt-get install -y doxygen
|
|
|
|
|
|
|
|
- name: Generate docs
|
|
|
|
run: |
|
|
|
|
mkdir gh-pages
|
|
|
|
cd src
|
|
|
|
mkdir out
|
|
|
|
# Doxygen must run before Sphinx. Sphinx will refer to
|
|
|
|
# Doxygen-generated output when it builds its own docs.
|
|
|
|
doxygen docs/Doxyfile
|
|
|
|
# Now build the Sphinx-based docs.
|
|
|
|
make -C docs/ html
|
|
|
|
# Now move the generated outputs.
|
|
|
|
mv out/sphinx/html ../gh-pages/html
|
|
|
|
mv out/doxygen/html ../gh-pages/docs
|
|
|
|
cp docs/index.html ../gh-pages/index.html
|
|
|
|
|
|
|
|
- name: Deploy to gh-pages branch (releases only)
|
|
|
|
# This is skipped when testing a PR
|
|
|
|
if: github.event_name != 'pull_request'
|
|
|
|
uses: peaceiris/actions-gh-pages@v3
|
|
|
|
with:
|
|
|
|
github_token: ${{ secrets.SHAKA_BOT_TOKEN }}
|
|
|
|
publish_dir: gh-pages
|
|
|
|
full_commit_message: Generate docs for ${{ env.TARGET_REF }}
|