Merge CLI docs genertion and lint (#1130)
## Description If any of the dependents were skipped, the CI would skip a job. This resulted in `Docs-Linting` getting skipped because of `Generate-CLI-Docs` job being skipped for doc only change. Now they are both merged into a single job. The internal steps for cli docs generation will still be skipped, but that should not affect the steps below. *I have not been able to fully test it out as the "file change checker" logic can only be checked after merging it, but it should be working* Ref: https://github.com/orgs/community/discussions/25224 ## Type of change <!--- Please check the type of change your PR introduces: ---> - [ ] 🌻 Feature - [ ] 🐛 Bugfix - [ ] 🗺️ Documentation - [ ] 🤖 Test - [x] 💻 CI/Deployment - [ ] 🐹 Trivial/Minor ## Issue(s) <!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. --> * #<issue> ## Test Plan <!-- How will this be tested prior to merging.--> - [x] 💪 Manual - [ ] ⚡ Unit test - [ ] 💚 E2E
This commit is contained in:
parent
64219c3ae7
commit
523386a720
33
.github/workflows/ci.yml
vendored
33
.github/workflows/ci.yml
vendored
@ -46,54 +46,45 @@ jobs:
|
||||
go-version-file: src/go.mod
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------
|
||||
# --- Generate CLI docs ------------------------------------------------------------------------------
|
||||
# --- Docs Linting -----------------------------------------------------------------------------------
|
||||
# ----------------------------------------------------------------------------------------------------
|
||||
|
||||
Generate-CLI-Docs:
|
||||
Docs-Linting:
|
||||
needs: [Precheck, Checkout]
|
||||
environment: Testing
|
||||
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || needs.precheck.outputs.srcfileschanged == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || needs.precheck.outputs.docfileschanged == 'true' # docsfileschanged also includes srcfileschanged
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Golang with cache
|
||||
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || needs.precheck.outputs.srcfileschanged == 'true'
|
||||
uses: magnetikonline/action-golang-cache@v3
|
||||
with:
|
||||
go-version-file: src/go.mod
|
||||
|
||||
# run the markdown generator
|
||||
- name: Generate Markdown
|
||||
- name: Generate CLI Docs
|
||||
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || needs.precheck.outputs.srcfileschanged == 'true'
|
||||
working-directory: ./src
|
||||
run: |
|
||||
go run ./cmd/mdgen/mdgen.go generate
|
||||
|
||||
# migrate generated md files into /docs/docs/cli
|
||||
- name: Move CLI .md to Docs
|
||||
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || needs.precheck.outputs.srcfileschanged == 'true'
|
||||
run: |
|
||||
mkdir -p ./docs/docs/cli
|
||||
mv ./src/cmd/mdgen/cli_markdown/* ./docs/docs/cli/
|
||||
rm -R ./src/cmd/mdgen/cli_markdown/
|
||||
|
||||
- uses: actions/upload-artifact@master
|
||||
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || needs.precheck.outputs.srcfileschanged == 'true'
|
||||
name: Upload cli docs as artifacts
|
||||
with:
|
||||
name: cli-docs
|
||||
path: docs/docs/cli
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------
|
||||
# --- Docs Linting -----------------------------------------------------------------------------------
|
||||
# ----------------------------------------------------------------------------------------------------
|
||||
|
||||
Docs-Linting:
|
||||
needs: [Generate-CLI-Docs]
|
||||
environment: Testing
|
||||
runs-on: ubuntu-latest
|
||||
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || needs.precheck.outputs.docfileschanged == 'true'
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Install dependencies for docs lint
|
||||
run: |
|
||||
wget https://github.com/errata-ai/vale/releases/download/v2.20.2/vale_2.20.2_Linux_64-bit.tar.gz # NOTE: update in Dockerfile when updating
|
||||
@ -101,12 +92,6 @@ jobs:
|
||||
echo "$PWD/bin" >> $GITHUB_PATH
|
||||
npm i -g markdownlint-cli@0.32.2 # NOTE: update in Dockerfile when updating
|
||||
|
||||
- uses: actions/download-artifact@master
|
||||
name: Download cli docs from build step
|
||||
with:
|
||||
name: cli-docs
|
||||
path: docs/docs/cli
|
||||
|
||||
- name: Run docs lint
|
||||
run: |
|
||||
cd docs && make -o genclidocs check
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user