Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/docs-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ on:

jobs:
build-docs:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ site/site/
site/docs/docs/
site/docs/.asf.yaml
site/docs/javadoc/
site/.venv/

# benchmark output
spark/v3.4/spark/benchmark/*
Expand Down
8 changes: 8 additions & 0 deletions site/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ build: # Clean and build the docs site locally.
deploy: # Clean, build, and deploy the Iceberg docs site.
dev/deploy.sh $(remote_name)

.PHONY: lint
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update README for these commands.

lint: # Check linting on the docs.
dev/lint.sh

.PHONY: lint-fix
lint-fix: # Run linting with auto-fix on the docs.
dev/lint.sh --fix

.PHONY: clean
clean: # Clean the local docs site.
dev/clean.sh
14 changes: 12 additions & 2 deletions site/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ The docs are built, run, and released using [make](https://www.gnu.org/software/
> help: Show help for each of the Makefile recipes.
> [serve](dev/serve.sh): Clean, build, and run the site locally.
> [lint](dev/lint.sh): Scan markdown files for style issues.
> [lint-fix](dev/lint.sh): Run linting with auto-fix on the markdown files.

To scaffold the versioned docs and build the project, run the `build` recipe.

Expand Down Expand Up @@ -103,9 +104,18 @@ This step will generate the staged source code which blends into the original so
└─.asf.yaml
```

It will also scan all markdown files and fail the build on any style issues. To fix style issues, run the `lint` script with fix mode.
#### Linting

To check for markdown style issues without building the entire site, use the `lint` make command:

```sh
make lint
```

To automatically fix markdown style issues, use the `lint-fix` make command:

```sh
./dev/lint.sh --fix
make lint-fix
```

<!-- markdown-link-check-disable-next-line -->
Expand Down
3 changes: 2 additions & 1 deletion site/dev/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
# limitations under the License.
#

source dev/common.sh
set -e

./dev/setup_env.sh

./dev/lint.sh

mkdocs build
"${VENV_DIR}/bin/python3" -m mkdocs build
19 changes: 14 additions & 5 deletions site/dev/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
set -e

export REMOTE="iceberg_docs"
export VENV_DIR=".venv"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we ever clean up this dir?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dont think so. i could add it to the clean command, but i think its also fine to leave it alone


# Ensures the presence of a specified remote repository for documentation.
# If the remote doesn't exist, it adds it using the provided URL.
Expand All @@ -34,12 +35,20 @@ create_or_update_docs_remote () {
git fetch "${REMOTE}"
}

# Creates the virtual environment if it doesn't exist.
create_venv () {
if [ ! -d "${VENV_DIR}" ]; then
echo " --> creating virtual environment at ${VENV_DIR}"
python3 -m venv "${VENV_DIR}"
fi
}

# Installs or upgrades dependencies specified in the 'requirements.txt' file using pip.
install_deps () {
echo " --> install deps"

# Use pip to install or upgrade dependencies from the 'requirements.txt' file quietly
pip3 -q install -r requirements.txt --upgrade
# Use pip from venv to install or upgrade dependencies from the 'requirements.txt' file quietly
"${VENV_DIR}/bin/pip3" -q install -r requirements.txt --upgrade
}

# Checks if a provided argument is not empty. If empty, displays an error message and exits with a status code 1.
Expand Down Expand Up @@ -186,16 +195,16 @@ pull_versioned_docs () {

check_markdown_files () {
echo " --> check markdown file styles"
if ! python3 -m pymarkdown --config markdownlint.yml scan docs/docs/nightly/docs/*.md docs/*.md README.md
if ! "${VENV_DIR}/bin/python3" -m pymarkdown --config markdownlint.yml scan docs/docs/nightly/docs/*.md docs/*.md README.md
then
echo "Markdown style issues found. Please run './dev/lint.sh --fix' to fix them."
echo "Markdown style issues found. Please run 'make lint-fix' to fix them."
exit 1
fi
}

fix_markdown_files () {
echo " --> fix markdown file styles"
python3 -m pymarkdown --config markdownlint.yml fix docs/docs/nightly/docs/*.md docs/*.md README.md
"${VENV_DIR}/bin/python3" -m pymarkdown --config markdownlint.yml fix docs/docs/nightly/docs/*.md docs/*.md README.md
}

# Cleans up artifacts and temporary files generated during documentation management.
Expand Down
3 changes: 2 additions & 1 deletion site/dev/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# limitations under the License.
#

source dev/common.sh
set -e

remote_name="${1:-origin}"
Expand All @@ -24,4 +25,4 @@ remote_name="${1:-origin}"

echo " --> Deploy to asf-site branch of remote repository: ${remote_name}"

mkdocs gh-deploy --no-history --remote-branch=asf-site --remote-name ${remote_name}
"${VENV_DIR}/bin/python3" -m mkdocs gh-deploy --no-history --remote-branch=asf-site --remote-name ${remote_name}
2 changes: 2 additions & 0 deletions site/dev/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ source dev/common.sh

set -e

./dev/setup_env.sh

if [[ "$1" == "--fix" ]]; then
fix_markdown_files
else
Expand Down
3 changes: 2 additions & 1 deletion site/dev/serve.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
# limitations under the License.
#

source dev/common.sh
set -e

./dev/setup_env.sh

./dev/lint.sh

mkdocs serve --dirty --watch .
"${VENV_DIR}/bin/python3" -m mkdocs serve --dirty --watch .
2 changes: 2 additions & 0 deletions site/dev/setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ set -e

clean

create_venv

install_deps

pull_versioned_docs
Expand Down