From 6d2e9090247f86cc84dc7ca1087073710140fb67 Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Thu, 28 Mar 2024 17:51:09 +0200 Subject: [PATCH] Split off documentation building into its own pipeline (#7692) It has occurred to me that the documentation build happens inside the main workflow, which is configured to ignore changes to the docs when determining whether to run. So if a PR only changes the docs... we don't build the docs. That makes no sense. Fix this by extracting the documentation job into its own workflow, that always runs. The downside of this is that we have to duplicate the work of generating the SDK, but IMO, it's an acceptable sacrifice. A side effect of this is that a failure to build the docs no longer prevents the publishing of Docker images, but I don't think that was needed in the first place. --- .github/workflows/docs.yml | 66 ++++++++++++++++++++++++++++++++++++++ .github/workflows/main.yml | 55 +------------------------------ 2 files changed, 67 insertions(+), 54 deletions(-) create mode 100644 .github/workflows/docs.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 000000000000..5267c922c87c --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,66 @@ +name: Docs +on: + push: + branches: + - 'master' + - 'develop' + pull_request: + types: [ready_for_review, opened, synchronize, reopened] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + generate_github_pages: + permissions: + contents: write + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 + + - name: Generate CVAT SDK + run: | + pip3 install --user -r cvat-sdk/gen/requirements.txt + ./cvat-sdk/gen/generate.sh + + - name: Setup Hugo + run: | + wget https://github.com/gohugoio/hugo/releases/download/v0.110.0/hugo_extended_0.110.0_Linux-64bit.tar.gz + (mkdir hugo_extended_0.110.0_Linux-64bit && tar -xf hugo_extended_0.110.0_Linux-64bit.tar.gz -C hugo_extended_0.110.0_Linux-64bit) + + wget https://github.com/gohugoio/hugo/releases/download/v0.83.0/hugo_extended_0.83.0_Linux-64bit.tar.gz + (mkdir hugo_extended_0.83.0_Linux-64bit && tar -xf hugo_extended_0.83.0_Linux-64bit.tar.gz -C hugo_extended_0.83.0_Linux-64bit) + + mkdir hugo + cp hugo_extended_0.110.0_Linux-64bit/hugo hugo/hugo-0.110 + cp hugo_extended_0.83.0_Linux-64bit/hugo hugo/hugo-0.83 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: '18.x' + + - name: Install npm packages + working-directory: ./site + run: | + npm ci + + - name: Build docs + run: | + pip install -r site/requirements.txt + python site/process_sdk_docs.py + PATH="$PWD/hugo:$PATH" python site/build_docs.py + env: + HUGO_ENV: production + + - name: Deploy + if: github.ref == 'refs/heads/develop' + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./public + force_orphan: true diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 477968fd6dc4..583657e02731 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -385,62 +385,9 @@ jobs: name: cypress_screenshots_${{ matrix.specs }} path: ${{ github.workspace }}/tests/cypress/screenshots - generate_github_pages: - needs: [rest_api_testing, unit_testing, e2e_testing] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - fetch-depth: 0 - - - name: Download CVAT SDK - uses: actions/download-artifact@v3 - with: - name: cvat_sdk - path: /tmp/cvat_sdk/ - - - name: Setup Hugo - run: | - wget https://github.com/gohugoio/hugo/releases/download/v0.110.0/hugo_extended_0.110.0_Linux-64bit.tar.gz - (mkdir hugo_extended_0.110.0_Linux-64bit && tar -xf hugo_extended_0.110.0_Linux-64bit.tar.gz -C hugo_extended_0.110.0_Linux-64bit) - - wget https://github.com/gohugoio/hugo/releases/download/v0.83.0/hugo_extended_0.83.0_Linux-64bit.tar.gz - (mkdir hugo_extended_0.83.0_Linux-64bit && tar -xf hugo_extended_0.83.0_Linux-64bit.tar.gz -C hugo_extended_0.83.0_Linux-64bit) - - mkdir hugo - cp hugo_extended_0.110.0_Linux-64bit/hugo hugo/hugo-0.110 - cp hugo_extended_0.83.0_Linux-64bit/hugo hugo/hugo-0.83 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: '18.x' - - - name: Install npm packages - working-directory: ./site - run: | - npm ci - - - name: Build docs - run: | - pip install -r site/requirements.txt - python site/process_sdk_docs.py --input-dir /tmp/cvat_sdk/docs/ --site-root site/ - PATH="$PWD/hugo:$PATH" python site/build_docs.py - env: - HUGO_ENV: production - - - name: Deploy - if: github.ref == 'refs/heads/develop' - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./public - force_orphan: true - publish_dev_images: if: github.ref == 'refs/heads/develop' - needs: [rest_api_testing, unit_testing, e2e_testing, generate_github_pages] + needs: [rest_api_testing, unit_testing, e2e_testing] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4