From f8a7def5154acbff3d258b306c86a737ebf98f8c Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Sat, 14 Oct 2023 23:03:57 -0700 Subject: [PATCH] docs: move to gh pages (#30242) * mv to pages * cleanup * push static * mv that * new name for the orphan * only master * build op --- .github/workflows/docs.yaml | 62 ++++++++++++++++++++++++++++++ .github/workflows/tools_tests.yaml | 18 --------- docs/docker/Dockerfile | 42 -------------------- docs/docker/nginx.conf | 15 -------- selfdrive/test/docker_common.sh | 3 -- 5 files changed, 62 insertions(+), 78 deletions(-) create mode 100644 .github/workflows/docs.yaml delete mode 100644 docs/docker/Dockerfile delete mode 100644 docs/docker/nginx.conf diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml new file mode 100644 index 00000000000000..0a55843cfd1a31 --- /dev/null +++ b/.github/workflows/docs.yaml @@ -0,0 +1,62 @@ +name: docs + +on: + push: + branches: + - master + pull_request: + +concurrency: + group: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && github.run_id || github.head_ref || github.ref }}-${{ github.workflow }}-${{ github.event_name }} + cancel-in-progress: true + +env: + BASE_IMAGE: openpilot-base + + BUILD: selfdrive/test/docker_build.sh base + + RUN: docker run --shm-size 1G -v $GITHUB_WORKSPACE:/tmp/openpilot -w /tmp/openpilot -e FILEREADER_CACHE=1 -e PYTHONPATH=/tmp/openpilot -e NUM_JOBS -e JOB_ID -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -v $GITHUB_WORKSPACE/.ci_cache/scons_cache:/tmp/scons_cache -v $GITHUB_WORKSPACE/.ci_cache/comma_download_cache:/tmp/comma_download_cache -v $GITHUB_WORKSPACE/.ci_cache/openpilot_cache:/tmp/openpilot_cache $BASE_IMAGE /bin/sh -c + +jobs: + docs: + name: build docs + runs-on: ubuntu-20.04 + timeout-minutes: 45 + steps: + - uses: actions/checkout@v4 + with: + submodules: true + - uses: ./.github/workflows/setup-with-retry + - name: Build openpilot + run: | + ${{ env.RUN }} "scons -j$(nproc)" + - name: Build docs + run: | + ${{ env.RUN }} "apt update && apt install -y doxygen && cd docs && make html" + + - uses: actions/checkout@v4 + if: github.ref == 'refs/heads/master' && github.repository == 'commaai/openpilot' + with: + path: openpilot-docs + ssh-key: ${{ secrets.OPENPILOT_DOCS_KEY }} + repository: commaai/openpilot-docs + - name: Push + if: github.ref == 'refs/heads/master' && github.repository == 'commaai/openpilot' + run: | + set -x + + source release/identity.sh + + cd openpilot-docs + + git checkout --orphan tmp + git rm -rf --cached . + + cp -r ../build/docs/html/ docs/ + touch docs/.nojekyll + git add -f . + + git commit -m "build docs" + + # docs live in different repo to not bloat openpilot's full clone size + git push -f origin gh-pages diff --git a/.github/workflows/tools_tests.yaml b/.github/workflows/tools_tests.yaml index b7dc19f6bedf4b..ad0ce598b4dee4 100644 --- a/.github/workflows/tools_tests.yaml +++ b/.github/workflows/tools_tests.yaml @@ -63,24 +63,6 @@ jobs: run: | selfdrive/test/docker_build.sh sim - docs: - name: build docs - runs-on: ubuntu-20.04 - timeout-minutes: 45 - steps: - - uses: actions/checkout@v3 - with: - submodules: true - - uses: ./.github/workflows/setup-with-retry - - name: Setup to push to repo - if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && github.repository == 'commaai/openpilot' - run: | - echo "PUSH_IMAGE=true" >> "$GITHUB_ENV" - $DOCKER_LOGIN - - name: Build and push docs image - run: | - selfdrive/test/docker_build.sh docs - devcontainer: name: devcontainer runs-on: ubuntu-latest diff --git a/docs/docker/Dockerfile b/docs/docker/Dockerfile deleted file mode 100644 index 1bae2be24a128e..00000000000000 --- a/docs/docker/Dockerfile +++ /dev/null @@ -1,42 +0,0 @@ -FROM ghcr.io/commaai/openpilot-base:latest - -ENV PYTHONUNBUFFERED 1 - -ENV OPENPILOT_PATH /tmp/openpilot -ENV PYTHONPATH ${OPENPILOT_PATH}:${PYTHONPATH} -ENV POETRY_VIRUALENVS_CREATE false - -RUN mkdir -p ${OPENPILOT_PATH} -WORKDIR ${OPENPILOT_PATH} - -COPY SConstruct ${OPENPILOT_PATH} - -COPY ./openpilot ${OPENPILOT_PATH}/openpilot -COPY ./body ${OPENPILOT_PATH}/body -COPY ./third_party ${OPENPILOT_PATH}/third_party -COPY ./site_scons ${OPENPILOT_PATH}/site_scons -COPY ./laika_repo ${OPENPILOT_PATH}/laika_repo -RUN ln -s ${OPENPILOT_PATH}/laika_repo/laika/ ${OPENPILOT_PATH}/laika -COPY ./rednose ${OPENPILOT_PATH}/rednose -COPY ./rednose_repo ${OPENPILOT_PATH}/rednose_repo -COPY ./tools ${OPENPILOT_PATH}/tools -COPY ./release ${OPENPILOT_PATH}/release -COPY ./common ${OPENPILOT_PATH}/common -COPY ./opendbc ${OPENPILOT_PATH}/opendbc -COPY ./cereal ${OPENPILOT_PATH}/cereal -COPY ./panda ${OPENPILOT_PATH}/panda -COPY ./selfdrive ${OPENPILOT_PATH}/selfdrive -COPY ./system ${OPENPILOT_PATH}/system -COPY ./*.md ${OPENPILOT_PATH}/ - -RUN --mount=type=bind,source=.ci_cache/scons_cache,target=/tmp/scons_cache,rw scons -j$(nproc) --cache-readonly - -RUN apt update && apt install doxygen -y -COPY ./docs ${OPENPILOT_PATH}/docs -RUN git init . -WORKDIR ${OPENPILOT_PATH}/docs -RUN make html - -FROM nginx:1.21 -COPY --from=0 /tmp/openpilot/build/docs/html /usr/share/nginx/html -COPY ./docs/docker/nginx.conf /etc/nginx/conf.d/default.conf diff --git a/docs/docker/nginx.conf b/docs/docker/nginx.conf deleted file mode 100644 index 21fb2263687679..00000000000000 --- a/docs/docker/nginx.conf +++ /dev/null @@ -1,15 +0,0 @@ -server { - listen 80; - listen [::]:80; - server_name localhost; - - gzip on; - gzip_types text/html text/plain text/css text/xml text/javascript application/javascript application/x-javascript; - gzip_min_length 1024; - gzip_vary on; - - root /usr/share/nginx/html; - location / { - try_files $uri $uri/ /index.html; - } -} diff --git a/selfdrive/test/docker_common.sh b/selfdrive/test/docker_common.sh index 68ea472d2638cc..1b3c7054940326 100644 --- a/selfdrive/test/docker_common.sh +++ b/selfdrive/test/docker_common.sh @@ -1,9 +1,6 @@ if [ $1 = "base" ]; then export DOCKER_IMAGE=openpilot-base export DOCKER_FILE=Dockerfile.openpilot_base -elif [ $1 = "docs" ]; then - export DOCKER_IMAGE=openpilot-docs - export DOCKER_FILE=docs/docker/Dockerfile elif [ $1 = "sim" ]; then export DOCKER_IMAGE=openpilot-sim export DOCKER_FILE=tools/sim/Dockerfile.sim