Merge pull request #68 from ethz-asl/fix/update_livox_callback_code #47
This file contains 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: Continuous Deployment | |
on: | |
push: | |
tags: | |
- "v*.*.*" | |
branches: [ main ] | |
# NOTE: We do not store the work files under $HOME ("/github/home/") since that | |
# dir persists between jobs when using self-hosted GitHub Actions runners | |
# (/github/home is a docker volume mapped to the container's host). | |
env: | |
REPOSITORY_NAME: wavemap | |
DOCKER_CI_REGISTRY: hub.wavemap.vwire.ch | |
DOCKER_RELEASE_REGISTRY: ghcr.io | |
DOCKER_RELEASE_TARGET: workspace | |
USER_HOME: /home/ci | |
CATKIN_WS_PATH: /home/ci/catkin_ws | |
CCACHE_DIR: /home/ci/ccache | |
jobs: | |
common-variables: | |
name: Define common variables | |
runs-on: [ self-hosted, vwire ] | |
container: | |
image: docker:20.10.9-dind | |
outputs: | |
docker_cache_image_name: type=registry,ref=${{ env.DOCKER_CI_REGISTRY }}/${{ env.REPOSITORY_NAME }}:buildcache | |
local_ci_image_name: ${{ env.DOCKER_CI_REGISTRY }}/${{ env.REPOSITORY_NAME }}:${{ env.DOCKER_RELEASE_TARGET }}-${{ github.sha }} | |
steps: | |
- name: Empty | |
run: echo | |
draft-release: | |
name: Draft Release | |
if: startsWith(github.event.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Create Release | |
id: create_release | |
uses: softprops/action-gh-release@v1 | |
build-image: | |
name: Build Docker image | |
needs: [ common-variables ] | |
runs-on: [ self-hosted, vwire ] | |
container: | |
image: docker:20.10.9-dind | |
permissions: | |
contents: read | |
packages: write | |
outputs: | |
image: ${{ needs.common-variables.outputs.local_ci_image_name }} | |
env: | |
CACHE_IMAGE_NAME: ${{ needs.common-variables.outputs.docker_cache_image_name }} | |
LOCAL_IMAGE_NAME: ${{ needs.common-variables.outputs.local_ci_image_name }} | |
steps: | |
- name: Fetch the package's repository | |
uses: actions/checkout@v4 | |
with: | |
path: ${{ env.REPOSITORY_NAME }} | |
- name: Log in to the Container registry | |
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | |
with: | |
registry: ${{ env.DOCKER_RELEASE_REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build the ${{ env.DOCKER_RELEASE_TARGET }} image | |
uses: docker/build-push-action@v6 | |
with: | |
context: ${{ env.REPOSITORY_NAME }} | |
file: ${{ env.REPOSITORY_NAME }}/tooling/docker/ros1/full.Dockerfile | |
target: ${{ env.DOCKER_RELEASE_TARGET }} | |
build-args: | | |
REPOSITORY_NAME=${{ env.REPOSITORY_NAME }} | |
USER_HOME=${{ env.USER_HOME }} | |
CATKIN_WS_PATH=${{ env.CATKIN_WS_PATH }} | |
CCACHE_DIR=${{ env.CCACHE_DIR }} | |
load: true | |
cache-from: ${{ env.CACHE_IMAGE_NAME }} | |
cache-to: ${{ env.CACHE_IMAGE_NAME }},mode=max | |
tags: ${{ env.LOCAL_IMAGE_NAME }} | |
- name: Test the ${{ env.DOCKER_RELEASE_TARGET }} image | |
run: docker run --rm ${{ env.LOCAL_IMAGE_NAME }} | |
- name: Push the ${{ env.DOCKER_RELEASE_TARGET }} image locally | |
uses: docker/build-push-action@v6 | |
with: | |
context: ${{ env.REPOSITORY_NAME }} | |
file: ${{ env.REPOSITORY_NAME }}/tooling/docker/ros1/full.Dockerfile | |
target: ${{ env.DOCKER_RELEASE_TARGET }} | |
build-args: | | |
REPOSITORY_NAME=${{ env.REPOSITORY_NAME }} | |
USER_HOME=${{ env.USER_HOME }} | |
CATKIN_WS_PATH=${{ env.CATKIN_WS_PATH }} | |
CCACHE_DIR=${{ env.CCACHE_DIR }} | |
push: true | |
cache-from: ${{ env.CACHE_IMAGE_NAME }} | |
tags: ${{ env.LOCAL_IMAGE_NAME }} | |
- name: Extract metadata to annotate the image | |
id: meta | |
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | |
with: | |
images: ${{ env.DOCKER_RELEASE_REGISTRY }}/${{ github.repository }}_ros1 | |
- name: Publish the ${{ env.DOCKER_RELEASE_TARGET }} image | |
if: startsWith(github.event.ref, 'refs/tags/v') | |
uses: docker/build-push-action@v6 | |
with: | |
context: ${{ env.REPOSITORY_NAME }} | |
file: ${{ env.REPOSITORY_NAME }}/tooling/docker/ros1/full.Dockerfile | |
target: ${{ env.DOCKER_RELEASE_TARGET }} | |
build-args: | | |
REPOSITORY_NAME=${{ env.REPOSITORY_NAME }} | |
USER_HOME=${{ env.USER_HOME }} | |
CATKIN_WS_PATH=${{ env.CATKIN_WS_PATH }} | |
CCACHE_DIR=${{ env.CCACHE_DIR }} | |
push: true | |
cache-from: ${{ env.CACHE_IMAGE_NAME }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-docs: | |
name: Build docs | |
needs: [ build-image ] | |
runs-on: [ self-hosted, vwire ] | |
container: | |
image: ${{ needs.build-image.outputs.image }} | |
steps: | |
- name: Fetch the package's repository | |
uses: actions/checkout@v4 | |
- name: Install dependencies (doxygen+sphinx+breathe+exhale toolchain) | |
run: | | |
apt-get update | |
apt-get install -q -y --no-install-recommends python3-pip doxygen | |
apt-get install -q -y --no-install-recommends latexmk texlive-latex-extra tex-gyre texlive-fonts-recommended texlive-latex-recommended | |
pip3 install exhale sphinx-sitemap sphinx-design sphinx-notfound-page | |
pip3 install sphinxawesome-theme --pre | |
pip3 install "sphinx<7,>6" | |
- name: Parse C++ library with Doxygen | |
working-directory: ${{ env.CATKIN_WS_PATH }}/src/${{ env.REPOSITORY_NAME }}/docs | |
shell: bash | |
run: doxygen Doxyfile_cpp | |
- name: Parse ROS1 interface with Doxygen | |
working-directory: ${{ env.CATKIN_WS_PATH }}/src/${{ env.REPOSITORY_NAME }}/docs | |
shell: bash | |
run: doxygen Doxyfile_ros1 | |
- name: Build documentation site | |
working-directory: ${{ env.CATKIN_WS_PATH }}/src/${{ env.REPOSITORY_NAME }}/docs | |
shell: bash | |
run: sphinx-build -b html . _build/html | |
- name: Bundle site sources into tarball | |
shell: bash | |
run: | | |
tar \ | |
--dereference --hard-dereference \ | |
--directory ${{ env.CATKIN_WS_PATH }}/src/${{ env.REPOSITORY_NAME }}/docs/_build/html/ \ | |
-cvf ${{ env.CATKIN_WS_PATH }}/src/${{ env.REPOSITORY_NAME }}/docs/artifact.tar \ | |
--exclude=.git \ | |
--exclude=.github \ | |
. | |
- name: Upload tarball as GH Pages artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: github-pages | |
path: ${{ env.CATKIN_WS_PATH }}/src/${{ env.REPOSITORY_NAME }}/docs/artifact.tar | |
retention-days: 1 | |
- name: Build documentation PDF | |
working-directory: ${{ env.CATKIN_WS_PATH }}/src/${{ env.REPOSITORY_NAME }}/docs | |
shell: bash | |
run: sphinx-build -M latexpdf . _build/latex | |
- name: Attach PDF to GitHub release | |
if: startsWith(github.event.ref, 'refs/tags/v') | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const fs = require('fs'); | |
const tag = context.ref.replace("refs/tags/", ""); | |
// Get release for this tag | |
const release = await github.rest.repos.getReleaseByTag({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
tag | |
}); | |
// Upload the release asset | |
await github.rest.repos.uploadReleaseAsset({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
release_id: release.data.id, | |
name: "docs.pdf", | |
data: await fs.readFileSync("${{ env.CATKIN_WS_PATH }}/src/${{ env.REPOSITORY_NAME }}/docs/_build/latex/latex/wavemap.pdf") | |
}); | |
publish-docs: | |
name: Publish docs | |
needs: [ build-docs ] | |
runs-on: [ self-hosted, vwire ] | |
container: | |
image: docker:20.10.9-dind | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Setup Pages | |
uses: actions/configure-pages@v4 | |
- name: Deploy uploaded docs to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v3 |