refactor(interactive): Unify devcontainer.json
of graphscope-dev and flex
#14137
Workflow file for this run
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: Docs | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
- docs | |
- dev/docs | |
tags: | |
- "v*" | |
pull_request: | |
branches: | |
- main | |
- docs | |
- dev/docs | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
permissions: | |
issues: write | |
pull-requests: write | |
contents: write | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
with: | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.pull_request.head.ref }} | |
submodules: true | |
fetch-depth: 0 | |
- uses: dorny/paths-filter@v2 | |
id: changes | |
with: | |
filters: | | |
src: | |
- 'docs/**' | |
- name: Setup Java11 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '11' | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Leave a marker | |
if: ${{ steps.changes.outputs.src == 'true' && github.event_name == 'pull_request' }} | |
run: | | |
touch ${GITHUB_WORKSPACE}/preview-the-docs.mark | |
- name: Leave the comment on pull request when started | |
if: ${{ steps.changes.outputs.src == 'true' && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'alibaba/GraphScope' }} | |
uses: actions-cool/maintain-one-comment@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
body: | | |
⚡️ Deploying PR Preview ${{ github.event.pull_request.head.sha }} to [surge.sh](https://alibaba-graphscope-build-pr-${{ github.event.number }}.surge.sh) ... [Build logs](https://github.com/alibaba/GraphScope/runs/${{ github.run_id }}) | |
<a href="https://github.com/alibaba/GraphScope/actions/runs/${{ github.run_id }}"> | |
<img width="300" src="https://user-images.githubusercontent.com/507615/90240294-8d2abd00-de5b-11ea-8140-4840a0b2d571.gif"> | |
</a> | |
<sub>🤖 By [surge-preview](https://surge.sh/)</sub> | |
body-include: '<!-- Sticky Pull Request Comment: Surge Preview build -->' | |
- name: Cpp Format and Lint Check | |
run: | | |
# install clang-format | |
sudo curl -L https://github.com/muttleyxd/clang-tools-static-binaries/releases/download/master-22538c65/clang-format-8_linux-amd64 --output /usr/bin/clang-format | |
sudo chmod +x /usr/bin/clang-format | |
# run format | |
cd analytical_engine/ | |
find ./apps ./benchmarks ./core ./frame ./misc ./test -name "*.h" | xargs clang-format -i --style=file | |
find ./apps ./benchmarks ./core ./frame ./misc ./test -name "*.cc" | xargs clang-format -i --style=file | |
# validate format | |
function prepend() { while read line; do echo "${1}${line}"; done; } | |
GIT_DIFF=$(git diff --ignore-submodules) | |
if [[ -n $GIT_DIFF ]]; then | |
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" | |
echo "| clang-format failures found!" | |
echo "|" | |
echo "$GIT_DIFF" | prepend "| " | |
echo "|" | |
echo "| Run: " | |
echo "|" | |
echo "| make gsa_clformat" | |
echo "|" | |
echo "| to fix this error." | |
echo "|" | |
echo "| Ensure you are working with clang-format-8, which can be obtained from" | |
echo "|" | |
echo "| https://github.com/muttleyxd/clang-tools-static-binaries/releases" | |
echo "|" | |
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" | |
exit -1 | |
fi | |
- name: Java Format and Lint Check | |
run: | | |
wget https://github.com/google/google-java-format/releases/download/v1.13.0/google-java-format-1.13.0-all-deps.jar | |
files_to_format=$(git ls-files *.java) | |
# run formatter in-place | |
java -jar ${GITHUB_WORKSPACE}/google-java-format-1.13.0-all-deps.jar --aosp --skip-javadoc-formatting -i $files_to_format | |
# validate format | |
function prepend() { while read line; do echo "${1}${line}"; done; } | |
GIT_DIFF=$(git diff --ignore-submodules) | |
if [[ -n $GIT_DIFF ]]; then | |
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" | |
echo "| google-java-format failures found!" | |
echo "|" | |
echo "$GIT_DIFF" | prepend "| " | |
echo "|" | |
echo "| Run: " | |
echo "|" | |
echo '| java -jar google-java-format-1.13.0-all-deps.jar --aosp --skip-javadoc-formatting -i $(git ls-files **/*.java)' | |
echo "|" | |
echo "| to fix this error." | |
echo "|" | |
echo "| Ensure you are working with google-java-format-1.13.0, which can be obtained from" | |
echo "|" | |
echo "| https://github.com/google/google-java-format/releases/download/v1.13.0/google-java-format-1.13.0-all-deps.jar" | |
echo "|" | |
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" | |
exit -1 | |
fi | |
- name: Python Format and Lint Check | |
run: | | |
echo "Checking formatting for $GITHUB_REPOSITORY" | |
pip3 install -r coordinator/requirements-dev.txt | |
pip3 install -r python/requirements-dev.txt | |
pushd python | |
python3 -m isort --check --diff . | |
python3 -m black --check --diff . | |
python3 -m flake8 . | |
popd | |
pushd coordinator | |
python3 -m isort --check --diff . | |
python3 -m black --check --diff . | |
python3 -m flake8 . | |
- name: Generate Docs | |
shell: bash | |
run: | | |
# Install pip dependencies, build builtin gar, and generate proto stuffs. | |
sudo apt update | |
sudo apt install -y doxygen graphviz | |
# generate a tagged version | |
cd ${GITHUB_WORKSPACE} | |
make graphscope-docs | |
# generate a stable version | |
tag=$(git describe --exact-match --tags HEAD 2>/dev/null || true) | |
if [ ! -z "$tag" ]; | |
then | |
export TAG_VER=stable | |
make graphscope-docs | |
fi | |
- name: Preview using surge | |
if: ${{ steps.changes.outputs.src == 'true' && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'alibaba/GraphScope' }} | |
run: | | |
npm install -g surge | |
surge ./docs/_build/latest/html \ | |
alibaba-graphscope-build-pr-${{ github.event.number }}.surge.sh \ | |
--token ${{ secrets.SURGE_TOKEN }} | |
- name: Leave the comment on pull request when succeed | |
if: ${{ steps.changes.outputs.src == 'true' && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'alibaba/GraphScope' }} | |
uses: actions-cool/maintain-one-comment@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
body: | | |
🎊 PR Preview ${{ github.event.pull_request.head.sha }} has been successfully built and deployed to https://alibaba-graphscope-build-pr-${{ github.event.number }}.surge.sh | |
<a href="https://github.com/alibaba/GraphScope/actions/runs/${{ github.run_id }}"> | |
<img width="300" src="https://user-images.githubusercontent.com/507615/90250366-88233900-de6e-11ea-95a5-84f0762ffd39.png"> | |
</a> | |
<sub>🤖 By [surge-preview](https://surge.sh/)</sub> | |
body-include: '<!-- Sticky Pull Request Comment: Surge Preview build -->' | |
- name: Check file existence | |
id: check_files | |
if: ${{ failure() }} | |
uses: andstor/file-existence-action@v2 | |
with: | |
files: "preview-the-docs.mark" | |
- name: Leave the comment on pull request when failed | |
if: ${{ failure() && steps.check_files.outputs.files_exists == 'true' && github.event.pull_request.head.repo.full_name == 'alibaba/GraphScope' }} | |
uses: actions-cool/maintain-one-comment@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
body: | | |
😭 Deploy PR Preview ${{ github.event.pull_request.head.sha }} failed. [Build logs](https://github.com/alibaba/GraphScope/runs/${{ github.run_id }}) | |
<a href="https://github.com/alibaba/GraphScope/actions/runs/${{ github.run_id }}"> | |
<img width="300" src="https://user-images.githubusercontent.com/507615/90250824-4e066700-de6f-11ea-8230-600ecc3d6a6b.png"> | |
</a> | |
<sub>🤖 By [surge-preview](https://surge.sh/)</sub> | |
body-include: '<!-- Sticky Pull Request Comment: Surge Preview build -->' | |
- name: Setup tmate session | |
uses: mxschmitt/action-tmate@v3 | |
if: false | |
- name: Upload Docs | |
if: ${{ github.event_name == 'push' && github.repository == 'alibaba/GraphScope' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) }} | |
shell: bash | |
run: | | |
shopt -s extglob | |
rm google-java-format-1.13.0-all-deps.jar* || true | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
tag=$(git describe --exact-match --tags HEAD 2>/dev/null || true) | |
git fetch origin gh-pages --no-recurse-submodules | |
git checkout gh-pages | |
cd docs/ | |
if [ -d "_build/latest" ]; | |
then | |
rm -rf latest | |
cp -R _build/latest/html ./latest | |
else | |
rm -rf latest | |
cp -R _build/${tag}/html ./latest | |
rm -rf ${tag} | |
cp -R _build/${tag}/html ./${tag} | |
fi | |
if [ -d "_build/stable" ]; | |
then | |
rm -rf !(_build|latest|stable|v*) | |
cp -R _build/stable/html/* ./ | |
fi | |
rm -rf _build/ | |
rm -rf ../flex/ || true | |
rm -rf ../learning_engine/ || true | |
rm -rf ../python || true | |
rm -rf ../analytical_engine/java || true | |
git add -A | |
git commit --amend --no-edit -m "Generate latest docs on CI, from commit ${{ github.sha }}." --author "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" -s --date="$(date -R)" | |
git push -f origin gh-pages | |