Skip to content

Commit

Permalink
Add lightweight in-tree documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
liuliu committed Jun 4, 2022
1 parent 7fd9b6b commit 216388b
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 6 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: documentation
on:
push:
branches:
- unstable
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2

- name: Install bazelisk
run: |
curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.11.0/bazelisk-linux-amd64"
mkdir -p "${GITHUB_WORKSPACE}/bin/"
mv bazelisk-linux-amd64 "${GITHUB_WORKSPACE}/bin/bazel"
chmod +x "${GITHUB_WORKSPACE}/bin/bazel"
- name: Install Swift dependencies
run: |
sudo apt-get install clang libicu-dev
wget https://download.swift.org/swift-5.6.1-release/ubuntu2004/swift-5.6.1-RELEASE/swift-5.6.1-RELEASE-ubuntu20.04.tar.gz
tar xzf swift-5.6.1-RELEASE-ubuntu20.04.tar.gz
echo "$(pwd)/swift-5.6.1-RELEASE-ubuntu20.04/usr/bin" >> $GITHUB_PATH
- name: Clean up documentation branch
run: |
git branch -D documentation || true
git checkout -b documentation
- name: Run docc
run: |
cd "${GITHUB_WORKSPACE}" && ./scripts/docc.sh
- name: Add and commit documentation
run: |
git config --global user.email "[email protected]"
git config --global user.name "docbot"
cd "${GITHUB_WORKSPACE}" && git add "docs/*" && git commit -m "Update docs."
- name: Push the new branch
run: |
cd "${GITHUB_WORKSPACE}" && git push --force origin documentation:documentation
2 changes: 1 addition & 1 deletion .github/workflows/macos-bazel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:

- name: Install bazelisk
run: |
curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.7.5/bazelisk-darwin-amd64"
curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.11.0/bazelisk-darwin-amd64"
mkdir -p "${GITHUB_WORKSPACE}/bin/"
mv bazelisk-darwin-amd64 "${GITHUB_WORKSPACE}/bin/bazel"
chmod +x "${GITHUB_WORKSPACE}/bin/bazel"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ubuntu-bazel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ jobs:
- name: Install Swift dependencies
run: |
sudo apt-get install clang libicu-dev
wget https://download.swift.org/swift-5.5.1-release/ubuntu2004/swift-5.5.1-RELEASE/swift-5.5.1-RELEASE-ubuntu20.04.tar.gz
tar xzf swift-5.5.1-RELEASE-ubuntu20.04.tar.gz
echo "$(pwd)/swift-5.5.1-RELEASE-ubuntu20.04/usr/bin" >> $GITHUB_PATH
wget https://download.swift.org/swift-5.6.1-release/ubuntu2004/swift-5.6.1-RELEASE/swift-5.6.1-RELEASE-ubuntu20.04.tar.gz
tar xzf swift-5.6.1-RELEASE-ubuntu20.04.tar.gz
echo "$(pwd)/swift-5.6.1-RELEASE-ubuntu20.04/usr/bin" >> $GITHUB_PATH
- name: Install bazelisk
run: |
curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.7.5/bazelisk-linux-amd64"
curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.11.0/bazelisk-linux-amd64"
mkdir -p "${GITHUB_WORKSPACE}/bin/"
mv bazelisk-linux-amd64 "${GITHUB_WORKSPACE}/bin/bazel"
chmod +x "${GITHUB_WORKSPACE}/bin/bazel"
Expand Down
9 changes: 8 additions & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ workspace(name = "dflat")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository", "new_git_repository")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

git_repository(
name = "build_bazel_rules_swift",
commit = "3bc7bc164020a842ae08e0cf071ed35f0939dd39",
remote = "https://github.com/bazelbuild/rules_swift.git",
shallow_since = "1654173801 -0500",
)

git_repository(
name = "build_bazel_rules_apple",
commit = "39bf97fb9b2db76bca8fe015b8c72fc92d5c6b81",
Expand Down Expand Up @@ -31,7 +38,7 @@ load(
"apple_rules_dependencies",
)

apple_rules_dependencies()
apple_rules_dependencies(ignore_version_differences = True)

load(
"@build_bazel_rules_swift//swift:repositories.bzl",
Expand Down
21 changes: 21 additions & 0 deletions scripts/docc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

set -euo pipefail

GIT_ROOT=$(git rev-parse --show-toplevel)

cd $GIT_ROOT

# Generate symbol graph
bazel build :Dflat :SQLiteDflat --features=swift.emit_symbol_graph
# Copy it into a valid bundle
mkdir -p Dflat.docc
cp bazel-bin/Dflat.symbolgraph/*.json Dflat.docc/
cp bazel-bin/SQLiteDflat.symbolgraph/*.json Dflat.docc/
# Remove all docs
rm -rf docs
# Convert into static hosting document
docc convert Dflat.docc --fallback-display-name="Dflat" --fallback-bundle-identifier org.liuliu.dflat --fallback-bundle-version 0.0.1 --output-path docs --hosting-base-path /dflat --index --transform-for-static-hosting
# Adding auto-redirect index.html
echo '<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="refresh" content="0;url=https://liuliu.github.io/dflat/documentation/dflat">' > docs/index.html
rm -rf Dflat.docc

0 comments on commit 216388b

Please sign in to comment.