Add Instructions on Running Tests to the Contributions Guide (#6926) #2
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: Generate reference docs | |
on: | |
workflow_dispatch: | |
inputs: | |
open_pull_request: | |
description: 'Open a pull request against the docs repository. Defaults to false for a "dry run" of the workflow that generates the docs and uploads them as artifacts.' | |
required: false | |
default: 'false' | |
options: | |
- "true" | |
- "false" | |
push: | |
branches: | |
- main | |
- release/* | |
pull_request: | |
branches: | |
- main | |
jobs: | |
reference-docs: | |
name: Generate and PR reference documentation | |
runs-on: ubuntu-latest | |
if: github.repository == 'radius-project/radius' | |
env: | |
GOVER: '^1.21' | |
GOPRIVATE: github.com/radius-project | |
steps: | |
- name: Checkout radius repository | |
uses: actions/checkout@v3 | |
with: | |
repository: radius-project/radius | |
path: radius | |
- name: Parse release version and set environment variables | |
run: python radius/.github/scripts/get_release_version.py | |
- name: Generate docs release branch name | |
run: | | |
if [[ ${{ env.REL_CHANNEL }} != "edge" ]]; then | |
echo DOCS_BRANCH="v${{ env.REL_CHANNEL }}" >> $GITHUB_ENV | |
else | |
echo DOCS_BRANCH="edge" >> $GITHUB_ENV | |
fi | |
- name: Checkout docs repository | |
uses: actions/checkout@v3 | |
with: | |
repository: radius-project/docs | |
path: docs | |
ref: ${{ env.DOCS_BRANCH }} | |
# Setup dependencies | |
- name: Set up Go ${{ env.GOVER }} | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GOVER }} | |
cache-dependency-path: radius/go.sum | |
- name: Setup NodeJS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- name: Install TypeSpec compiler | |
run: | | |
pushd radius/typespec | |
npm ci | |
popd | |
- name: Install autorest | |
run: npm install -g autorest@3.6.1 | |
- name: Install oav | |
run: npm install -g oav@3.2.0 | |
- name: Install mockgen | |
run: | | |
cd radius | |
go install github.com/golang/mock/mockgen@v1.5.0 | |
- name: Install controller-gen | |
run: | | |
cd radius | |
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.9.1 | |
# Generate Bicep docs | |
- name: Generate Bicep docs | |
run: | | |
cd radius | |
make generate | |
# Generate resource reference docs | |
- name: Generate resource reference docs | |
run: python docs/.github/scripts/generate_resource_references.py ./radius/hack/bicep-types-radius/generated/ ./docs/docs/content/reference/resources | |
- name: Upload resource reference docs | |
uses: actions/upload-artifact@v3 | |
with: | |
name: resource-docs | |
path: docs/docs/content/reference/resources | |
# Generate and upload CLI docs | |
- name: Generate CLI docs | |
run: | | |
find docs/docs/content/reference/cli -type f ! -name '_index.md' -delete | |
cd radius | |
go run cmd/docgen/main.go ../docs/docs/content/reference/cli | |
- name: Upload CLI docs | |
uses: actions/upload-artifact@v3 | |
with: | |
name: cli-docs | |
path: docs/docs/content/reference/cli | |
# Open PR against docs repository | |
- name: Show git diff | |
run: | | |
cd docs | |
git status --porcelain -unormal -- *.md | |
- name: Create pull request | |
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.open_pull_request == 'true') | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
token: ${{ secrets.GH_RAD_CI_BOT_PAT }} | |
path: docs | |
add-paths: | | |
*.md | |
committer: rad-ci-bot <rad-ci-bot@users.noreply.github.com> | |
author: rad-ci-bot <rad-ci-bot@users.noreply.github.com> | |
signoff: true | |
branch: reference-cli/patch-${{ github.sha }} | |
delete-branch: true | |
title: | | |
Update auto-generated documentation | |
body: | | |
## Autogenerated PR | |
This PR updates the auto-generated reference documentation. | |
GitHub SHA: ${{ github.sha }} | |
commit-message: | | |
Autogenerate reference docs |