Skip to content

Commit

Permalink
Merge branch 'HDDS-9225-website-v2' into favicon
Browse files Browse the repository at this point in the history
* HDDS-9225-website-v2:
  Bump docusaurus to 3.3.2 (apache#93)
  HDDS-10667. Improvements to spelling checks. (apache#89)
  HDDS-10698. Bump skywalking-eyes to v0.6.0 (apache#90)
  HDDS-10449. Add quick start to the top of contributing guide. (apache#83)
  HDDS-10351. Add GitHub Actions check for yaml formatting (apache#87)
  HDDS-9567. Add GitHub Actions license header check for relevant files. (apache#86)
  HDDS-10506. Reduce directory iterations in sidebar check (apache#85)
  HDDS-9866. Add GitHub Actions checks for consistent Docusaurus formatting. (apache#84)
  HDDS-10254. Add GitHub Actions check for Markdown style. (apache#81)
  HDDS-10349. Add GitHub Actions check for consistent file name formatting. (apache#79)
  HDDS-10426. Crop ozone-logo.svg to a proper size (apache#80)
  HDDS-10353. Add GitHub Actions check of all generated URLs in the sitemap. (apache#77)
  HDDS-9868. Add GitHub Actions check for spelling. (apache#76)
  HDDS-10400. Fix event condition in website publish workflow (apache#78)
  HDDS-10352. Add GitHub Actions workflow to build and run the website. (apache#74)
  HDDS-10222. Add pnpm guide to contributing guide. (apache#64)
  HDDS-10313. Update "Redundant" to "Reliable" in new website. (apache#73)
  • Loading branch information
errose28 committed May 30, 2024
2 parents 109457f + 42912a6 commit ff183a0
Show file tree
Hide file tree
Showing 181 changed files with 4,280 additions and 2,942 deletions.
17 changes: 17 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

node_modules
build
.docusaurus
Expand Down
2 changes: 1 addition & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
# Configuration for .github/workflows/label-pr.yml
# This workflow and its configuration can be deleted once the website's feature branch is merged.
website-v2:
- base-branch: HDDS-9225-website-v2
- base-branch: HDDS-9225-website-v2
17 changes: 17 additions & 0 deletions .github/resource/category.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://ozone.apache.org/category.schema.json",
"title": "Category",
"description": "Validates an allowed subset of keys in Docusaurus _category_.yml files.",
"type": "object",
"properties": {
"label": {
"description": "The name of this section shown in the docs sidebar.",
"type": "string"
}
},
"required": [
"label"
],
"additionalProperties": false
}
23 changes: 23 additions & 0 deletions .github/resource/frontmatter.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://ozone.apache.org/frontmatter.schema.json",
"title": "Frontmatter",
"description": "Validates an allowed subset of Docusaurus docs frontmatter.",
"type": [ "object", "null" ],
"properties": {
"sidebar_label": {
"type": "string"
},
"slug": {
"description": "Only use slug to specify the base URL for documentation.",
"type": "string",
"enum": [ "/" ]
},
"draft": {
"description": "Makes pages for incomplete features only visible in development mode.",
"type": "boolean"
}
},
"additionalProperties": false
}

8 changes: 8 additions & 0 deletions .github/resource/spelling_tips.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Spelling Check Failed

Spelling can be checked locally by running the script *.github/scripts/spelling.sh*. This requires you to have pnpm's dev dependencies installed on your machine for cspell to work (run `pnpm install --dev`).

**If spell check fails for words that are correct but not recognized:**

- Option 1: If the word is relevant for the whole Ozone project, add it to the `words` list in *cspell.yaml* so that it is considered valid.
- Option 2: If the word is only relevant for one specific page, add an [inline directive](https://cspell.org/configuration/document-settings/) as a comment in the markdown front matter of that page only.
25 changes: 25 additions & 0 deletions .github/scripts/curl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env sh
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.


echo 'Running website and checking homepage...'
docker compose run --detach --service-ports site pnpm serve
while [ "$(curl -so /dev/null -w '%{http_code}' http://localhost:3000)" != 200 ]; do
sleep 1;
done
echo 'Website homepage is responsive.'
74 changes: 74 additions & 0 deletions .github/scripts/file_names.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/usr/bin/env sh
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# Checks all page files and their parent directories to ensure that they use docusaurus number prefixes and are named
# all lower case with kebab-case.

root="$(git rev-parse --show-toplevel)"
rc=0

dir_regex='[a-z0-9][a-z0-9./-]*[a-z0-9]'
file_regex="$dir_regex\.mdx?"
# Pages used for docs should have a two digit number prefix to indicate their position in the sidebar.
# Docusaurus automatically strips this prefix from the links generated from file names.
doc_dir_regex="[0-9][0-9]-$dir_regex"
doc_file_regex="[0-9][0-9]-$file_regex"

check_regex() {
file="$1"
regex="$2"
if ! basename "$file" | grep -Exq "$regex"; then
echo "$file does not match regex '$regex'" 1>&2
rc=1
fi
}

is_markdown() {
file="$1"
# .md is a plain markdown file. .mdx is markdown with embedded Javascript.
echo "$(basename "$file")" | grep -Exq '.+\.mdx?'
}

# Check docs pages. These must use number prefixes.
for file in $(find "$root"/docs/*); do
if [ -d "$file" ]; then
# Check docs directories.
check_regex "$file" "$doc_dir_regex"
elif is_markdown "$file"; then
# Check docs files.
check_regex "$file" "$doc_file_regex"
fi
done

# Check regular pages. These do not have number prefixes.
for file in $(find "$root"/src/pages/*); do
# Check directories.
if [ -d "$file" ]; then
check_regex "$file" "$dir_regex"
# Check files.
elif is_markdown "$file"; then
check_regex "$file" "$file_regex"
fi
done

if [ "$rc" != 0 ]; then
echo '\nFile and directory names of website pages must be all lower case and kebab-case. A two digit number prefix' \
'must be used to order docs pages in the sidebar.' 1>&2
fi

exit "$rc"
23 changes: 23 additions & 0 deletions .github/scripts/markdownlint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env sh
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.


root="$(git rev-parse --show-toplevel)"

pnpm markdownlint "$root"

46 changes: 46 additions & 0 deletions .github/scripts/sidebar.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env sh
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# Validates docusaurus _category_.yml files used to configure the docs sidebar.
# Each docs subdirectory should have a _category_.yml file, and it must follow the defined schema.
# The schema is more restrictive than what Docusaurus allows, and can be used to disallow keys or require all category
# files to define the same keys.

rc=0

root="$(git rev-parse --show-toplevel)"
schema="$root"/.github/resource/category.schema.json

# Make sure all docs directories have a category sidebar file.
for child in $(find "$root"/docs/* -type d); do
category_file="$child/_category_.yml"
if [ ! -f "$category_file" ]; then
echo "_category_.yml is required for docs subdirectory $child" 1>&2
rc=1
fi
done

[ "$rc" = 0 ] || exit $rc

# If all category files are present, make sure they follow the schema.
if ! pnpm ajv validate -s "$schema" -d "$root/docs/**/_category_.yml" 1>/dev/null; then
rc=1
echo "Sidebar configuration validation failed against JSON schema $schema" 1>&2
fi

exit "$rc"
35 changes: 35 additions & 0 deletions .github/scripts/spelling.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env sh
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

root="$(git rev-parse --show-toplevel)"

rc=0

printf '%s\n' 'Checking document content...'
pnpm cspell lint --root="$root" --no-progress --show-context '**/*.md' '**/_category_.yml' || rc="$?"

printf '\n%s\n' 'Checking file names...'
find "$root"/docs "$root"/src/pages | pnpm cspell --no-progress --show-context stdin://'File Name' || rc="$?"

if [ "$rc" != 0 ]; then
# TODO Update this link to master when the new website's branch is merged.
printf '\n%s\n%s\n' 'Spell check failed. See CONTRIBUTING.md for help fixing false positive spelling errors:' \
'https://github.com/apache/ozone-site/blob/HDDS-9225-website-v2/CONTRIBUTING.md#spelling' 1>&2
fi

exit $rc
47 changes: 47 additions & 0 deletions .github/scripts/url.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env sh
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# Checks that all URLs contained in the sitemap.xml file from the build contain only allowed characters.
# All URLs on the Ozone site should use kebab-case with lowercase letters.

sitemap="$1"

if [ -z "$sitemap" ]; then
echo "Requires path to sitemap.xml file as the first argument." 1>&2
exit 1
fi

# Update this to 'https://ozone\.apache\.org/' when the website is published.
base_url_regex='https://ozone-site-v2\.staged\.apache\.org/'
valid_url_regex="$base_url_regex[a-z0-9][a-z0-9\./-]*[a-z0-9/]"

rc=0

for url in $(yq --output-format=props '.urlset.url[].loc' "$sitemap"); do
if echo "$url" | grep -vx "$base_url_regex" | grep -Exvq "$valid_url_regex"; then
echo "Disallowed URL format: $url" 1>&2
rc=1
fi
done

if [ "$rc" != 0 ]; then
echo "Found URLs in the build that do not match the allowed URL regex: $valid_url_regex" 1>&2
echo "All URLs should use kebab case and lowercase letters." 1>&2
fi

exit "$rc"
21 changes: 21 additions & 0 deletions .github/scripts/yamllint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env sh
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.


root="$(git rev-parse --show-toplevel)"
yamllint --format=colored "$root"
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# The main CI workflow for the Apache Ozone website.

name: ci

on:
pull_request:
types:
- opened
- synchronize
push:

concurrency:
group: ci-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
static:
uses: ./.github/workflows/static.yml
docusaurus:
needs: static
uses: ./.github/workflows/docusaurus.yml
publish:
needs: docusaurus
# Update this to master when the website is ready to be published.
if: ${{ github.event_name == 'push' && github.ref_name == 'HDDS-9225-website-v2' }}
uses: ./.github/workflows/publish.yml
Loading

0 comments on commit ff183a0

Please sign in to comment.