diff --git a/.github/workflows/build-and-validate-on-pr.yaml b/.github/workflows/build-and-validate-on-pr.yaml new file mode 100644 index 00000000000..3d7ef13c79f --- /dev/null +++ b/.github/workflows/build-and-validate-on-pr.yaml @@ -0,0 +1,102 @@ +# +# Copyright (c) 2020 Red Hat, Inc. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# + +name: Build and validate +on: + - pull_request +jobs: + build: + name: link checker # This job name is set as mandatory in the GitHub configuration. + runs-on: ubuntu-20.04 + container: "quay.io/eclipse/che-docs:latest" + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: 0 # Necessary for git diff in vale step + + - name: Build using antora + id: antora-build + run: CI=true antora generate antora-playbook.yml --stacktrace + + - name: Upload artifact doc-content + uses: actions/upload-artifact@v2 + with: + name: doc-content + path: build/site + + - name: Store PR info for publish-netlify + run: | + echo "${{ github.event.number }}" > PR_NUMBER + echo "${{ github.event.pull_request.head.sha }}" > PR_SHA + + - name: Upload artifact pull-request-number for publish-netlify + uses: actions/upload-artifact@v2 + with: + name: pull-request-number + path: PR_NUMBER + + - name: Upload artifact pull-request-sha for publish-netlify + uses: actions/upload-artifact@v2 + with: + name: pull-request-sha + path: PR_SHA + + # htmltest: + # name: link checker # This name is set as mandatory in the GitHub configuration. + # runs-on: ubuntu-20.04 + # container: "quay.io/eclipse/che-docs:latest" + # needs: build + # steps: + # - name: Checkout code + # uses: actions/checkout@v2 + + # - name: Download artifacts + # uses: actions/download-artifact@v2 + # with: + # name: doc-content + + - name: Cache htmltest status code of checked external URLs # See: https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows + uses: actions/cache@v2 + env: + cache-name: cache-htmltest + with: + key: refcache.json + path: .cache/htmltest + + - name: Validate links using htmltest + id: validate-links + run: htmltest + + # unusedimages: + # name: Report unused images + # runs-on: ubuntu-20.04 + # steps: + # - name: Checkout code + # uses: actions/checkout@v2 + + - name: Report Unused Images + run: tools/detect-unused-images.sh + + # vale-diff: + # name: Validate language on new and modified files in PR + # runs-on: ubuntu-20.04 + # container: "quay.io/eclipse/che-docs:latest" + # steps: + # - name: Checkout code + # uses: actions/checkout@v2 + # with: + # fetch-depth: 0 + + - name: Validate language on files added or modified + run: | + vale -v + echo "Changed files, in comparison to branch $GITHUB_BASE_REF" + git diff --name-only --diff-filter=AM origin/$GITHUB_BASE_REF + vale $(git diff --name-only --diff-filter=AM origin/$GITHUB_BASE_REF) diff --git a/.github/workflows/build-and-validate-on-push.yaml b/.github/workflows/build-and-validate-on-push.yaml new file mode 100644 index 00000000000..17e6017be99 --- /dev/null +++ b/.github/workflows/build-and-validate-on-push.yaml @@ -0,0 +1,83 @@ +# +# Copyright (c) 2020 Red Hat, Inc. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# + +# GitHub Actions configuration file for htmltest +# See: https://github.com/wjdp/htmltest + +name: Build and validate documentation on push +on: + - push +jobs: + build: + name: Build the documentation + runs-on: ubuntu-20.04 + container: "quay.io/eclipse/che-docs:latest" + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Build using antora + id: antora-build + run: CI=true antora generate antora-playbook.yml --stacktrace + + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: doc-content + path: build/site + + htmltest: + name: link checker # This name is set as mandatory in the GitHub configuration. + runs-on: ubuntu-20.04 + container: "quay.io/eclipse/che-docs:latest" + needs: build + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Cache htmltest status code of checked external URLs # See: https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows + uses: actions/cache@v2 + env: + cache-name: cache-htmltest + with: + key: refcache.json + path: .cache/htmltest + + - name: Download artifacts + uses: actions/download-artifact@v2 + with: + name: doc-content + + - name: Check internal and external links using htmltest + id: validate-links + run: htmltest + + vale-all-content: + name: Validate style on all content on push + runs-on: ubuntu-20.04 + container: "quay.io/eclipse/che-docs:latest" + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Vale + run: | + vale -v + vale . + + unusedimages: + name: Report unused images + runs-on: ubuntu-20.04 + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Detect Unused Images + run: tools/detect-unused-images.sh diff --git a/.github/workflows/build-pr-docs.yaml b/.github/workflows/build-pr-docs.yaml deleted file mode 100644 index eac73b6747e..00000000000 --- a/.github/workflows/build-pr-docs.yaml +++ /dev/null @@ -1,39 +0,0 @@ -# -# Copyright (c) 2020 Red Hat, Inc. -# This program and the accompanying materials are made -# available under the terms of the Eclipse Public License 2.0 -# which is available at https://www.eclipse.org/legal/epl-2.0/ -# -# SPDX-License-Identifier: EPL-2.0 -# - -name: build-documentation-pr -on: pull_request -jobs: - build: - name: Build the documentation - runs-on: ubuntu-20.04 - container: "quay.io/eclipse/che-docs:latest" - steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: build - id: antora-build - run: | - antora generate antora-playbook.yml - - uses: actions/upload-artifact@v2 - with: - name: doc-content - path: build/site - - name: Store PR info - run: | - echo "${{ github.event.number }}" > PR_NUMBER - echo "${{ github.event.pull_request.head.sha }}" > PR_SHA - - uses: actions/upload-artifact@v2 - with: - name: pull-request-number - path: PR_NUMBER - - uses: actions/upload-artifact@v2 - with: - name: pull-request-sha - path: PR_SHA diff --git a/.github/workflows/che.yaml b/.github/workflows/che.yaml deleted file mode 100644 index 548bfda120d..00000000000 --- a/.github/workflows/che.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# Add Che link on PRs -name: che - -on: - pull_request: - types: [opened, synchronize] - -jobs: - add-link: - runs-on: ubuntu-latest - steps: - - name: Eclipse Che Pull Request Check - id: che-pr-check-gh-action - uses: benoitf/che-pr-check-gh-action@master - with: - github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/link-checker.yaml b/.github/workflows/link-checker.yaml deleted file mode 100644 index e282df73d6a..00000000000 --- a/.github/workflows/link-checker.yaml +++ /dev/null @@ -1,38 +0,0 @@ -# -# Copyright (c) 2020 Red Hat, Inc. -# This program and the accompanying materials are made -# available under the terms of the Eclipse Public License 2.0 -# which is available at https://www.eclipse.org/legal/epl-2.0/ -# -# SPDX-License-Identifier: EPL-2.0 -# - -# GitHub Actions configuration file for htmltest -# See: https://github.com/wjdp/htmltest - -name: linkchecker-pr-check -on: [push, pull_request] -jobs: - linkchecker: - name: link checker - runs-on: ubuntu-20.04 - container: "quay.io/eclipse/che-docs:latest" - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Cache htmltest status code of checked external URLs # See: https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows - uses: actions/cache@v2 - env: - cache-name: cache-htmltest - with: - key: refcache.json - path: .cache/htmltest - - - name: Build using Antora - id: antora-build - run: antora generate antora-playbook.yml - - - name: Check internal and external links using htmltest - id: validate-links - run: htmltest diff --git a/.github/workflows/publish-netlify.yaml b/.github/workflows/publish-netlify.yml similarity index 63% rename from .github/workflows/publish-netlify.yaml rename to .github/workflows/publish-netlify.yml index 36bd2dfe632..b12bf33cd3a 100644 --- a/.github/workflows/publish-netlify.yaml +++ b/.github/workflows/publish-netlify.yml @@ -1,3 +1,4 @@ +--- # # Copyright (c) 2020 Red Hat, Inc. # This program and the accompanying materials are made @@ -7,7 +8,9 @@ # SPDX-License-Identifier: EPL-2.0 # -name: Publish Doc Content +# NOTE: Because this worklow is using secrets, it cannot run directly on a pull-request workflow, which is running in the context of the forked repository. + +name: Publish doc-content using netlify on: workflow_run: @@ -17,21 +20,23 @@ on: jobs: publish: - name: publish + name: Publish doc-content using netlify runs-on: ubuntu-20.04 steps: - - name: download doc artifact + - name: Download doc-content artifact uses: dawidd6/action-download-artifact@v2 with: workflow: ${{ github.event.workflow_run.workflow_id }} name: doc-content path: content - - name: PR number + + - name: Download pull-request-number artifact uses: dawidd6/action-download-artifact@v2 with: workflow: ${{ github.event.workflow_run.workflow_id }} name: pull-request-number - - name: Grab pull request number + + - name: Set PR_NUMBER variable run: | pr_number=$(cat "PR_NUMBER") if ! [[ "$pr_number" =~ ^[0-9]+$ ]]; then @@ -39,16 +44,19 @@ jobs: exit 1 fi echo "PR_NUMBER=$pr_number" >> $GITHUB_ENV - - name: PR sha + + - name: Download pull-request-sha artifact uses: dawidd6/action-download-artifact@v2 with: workflow: ${{ github.event.workflow_run.workflow_id }} name: pull-request-sha - - name: Grab pull request sha1 + + - name: Set PR_SHA variable run: | pr_sha=$(cat "PR_SHA") echo "PR_SHA=$pr_sha" >> $GITHUB_ENV - - name: Publish + + - name: Publish doc-content using netlify uses: netlify/actions/cli@master id: netlify-publish with: @@ -56,10 +64,11 @@ jobs: env: NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} - - name: 'Comment PR' + + - name: Comment the pull-request uses: actions/github-script@v3.0.0 with: - script: | - const { repo: { owner, repo } } = context; - const netlifyUrl = '${{ steps.netlify-publish.outputs.NETLIFY_URL }}'; - await github.repos.createCommitStatus({ owner, repo, sha: process.env.PR_SHA, state: "success", target_url: netlifyUrl, description: "Browse PR documentation online", context: "browse built doc"}) + script: | + const { repo: { owner, repo } } = context; + const netlifyUrl = '${{ steps.netlify-publish.outputs.NETLIFY_URL }}'; + await github.repos.createCommitStatus({ owner, repo, sha: process.env.PR_SHA, state: "success", target_url: netlifyUrl, description: "Browse PR documentation online", context: "browse built doc"}) diff --git a/.github/workflows/unused-images.yaml b/.github/workflows/unused-images.yaml deleted file mode 100644 index 4cba3d0d079..00000000000 --- a/.github/workflows/unused-images.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# -# Copyright (c) 2020 Red Hat, Inc. -# This program and the accompanying materials are made -# available under the terms of the Eclipse Public License 2.0 -# which is available at https://www.eclipse.org/legal/epl-2.0/ -# -# SPDX-License-Identifier: EPL-2.0 -# - -name: unused-images-pr-check -on: [push, pull_request] -jobs: - linkchecker: - name: unused-images - runs-on: ubuntu-20.04 - steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: Detect Unused Images - run: tools/detect-unused-images.sh diff --git a/.github/workflows/vale-on-pr.yaml b/.github/workflows/vale-on-pr.yaml deleted file mode 100644 index e2eb2b6630e..00000000000 --- a/.github/workflows/vale-on-pr.yaml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Copyright (c) 2021 Red Hat, Inc. -# This program and the accompanying materials are made -# available under the terms of the Eclipse Public License 2.0 -# which is available at https://www.eclipse.org/legal/epl-2.0/ -# -# SPDX-License-Identifier: EPL-2.0 -# - -name: vale-pr-check -on: - - pull_request -jobs: - vale-diff: - name: Validate style on new and modified files in PR - runs-on: ubuntu-20.04 - container: "quay.io/eclipse/che-docs:latest" - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Vale - run: | - vale -v - echo "Changed files, in comparison to branch $GITHUB_BASE_REF" - git diff --name-only --diff-filter=AM origin/$GITHUB_BASE_REF - vale $(git diff --name-only --diff-filter=AM origin/$GITHUB_BASE_REF) diff --git a/.github/workflows/vale-on-push.yaml b/.github/workflows/vale-on-push.yaml deleted file mode 100644 index 886f990ccf3..00000000000 --- a/.github/workflows/vale-on-push.yaml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Copyright (c) 2021 Red Hat, Inc. -# This program and the accompanying materials are made -# available under the terms of the Eclipse Public License 2.0 -# which is available at https://www.eclipse.org/legal/epl-2.0/ -# -# SPDX-License-Identifier: EPL-2.0 -# - -name: vale-push-check -on: - - push -jobs: - vale-all-content: - name: Validate style on all content on push - runs-on: ubuntu-20.04 - container: "quay.io/eclipse/che-docs:latest" - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Vale - run: | - vale -v - vale . diff --git a/.htmltest.yml b/.htmltest.yml index f0c4e4c7dd6..48c12c84239 100644 --- a/.htmltest.yml +++ b/.htmltest.yml @@ -18,3 +18,5 @@ CacheExpires: "12h" # Default is 2 weeks. IgnoreURLs: - https://cse.google.com/cse.js - https://marketplace.visualstudio.com + - https://github.com/eclipse/che-docs/edit/master/ + - https://www.eclipse.org/che/docs/che-7/