Skip to content

Commit

Permalink
CI and deploy steps for docs (OpenLineage#2961)
Browse files Browse the repository at this point in the history
Signed-off-by: Pawel Leszczynski <[email protected]>
  • Loading branch information
pawel-big-lebowski authored Aug 29, 2024
1 parent 1a64c0e commit 0bcdf5f
Show file tree
Hide file tree
Showing 320 changed files with 178 additions and 68,901 deletions.
40 changes: 0 additions & 40 deletions .circleci/continue_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -251,18 +251,6 @@ jobs:
- ./dist/*.tar.gz
- ./dist/*.whl

publish-client-python-reference:
working_directory: ~/openlineage/client/python
docker:
- image: cimg/python:3.8
steps:
- *checkout_project_root
- add_ssh_keys:
fingerprints:
- "7d:bc:78:35:09:c9:25:04:63:f9:eb:4b:f1:f4:d1:91"
- run: pip install -U -e .[docs]
- run: cd docs && make html && python convert.py && ./release-api-reference.sh

unit-test-integration-common:
working_directory: ~/openlineage/integration/common
docker:
Expand Down Expand Up @@ -1032,34 +1020,6 @@ jobs:
paths:
- ~/.gradle

# REST
publish-javadoc:
working_directory: ~/openlineage/client/java
docker:
- image: cimg/openjdk:17.0
steps:
- *checkout_project_root
- when:
condition:
equal: [ inactive, << pipeline.parameters.nightly-run >> ]
steps:
- add_ssh_keys:
fingerprints:
- "7d:bc:78:35:09:c9:25:04:63:f9:eb:4b:f1:f4:d1:91"
- run: ./gradlew --console=plain javadoc
- run: ./release-javadoc.sh

publish-spec:
working_directory: ~/openlineage
docker:
- image: cimg/base:2024.08
steps:
- *checkout_project_root
- add_ssh_keys:
fingerprints:
- "7d:bc:78:35:09:c9:25:04:63:f9:eb:4b:f1:f4:d1:91"
- run: spec/release.sh

build-proxy-fluentd:
working_directory: ~/openlineage/proxy/fluentd
docker:
Expand Down
14 changes: 0 additions & 14 deletions .circleci/workflows/openlineage-integration-publish.yml

This file was deleted.

6 changes: 0 additions & 6 deletions .circleci/workflows/openlineage-java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@ workflows:
- compile-integration-sql-java-linux-arm
- compile-integration-sql-java-linux-x86
- compile-integration-sql-java-macos
- publish-javadoc:
filters:
branches:
only: main
context: release
- release-client-java:
filters:
tags:
Expand All @@ -72,6 +67,5 @@ workflows:
tags:
only: /^[0-9]+(\.[0-9]+){2}(-rc\.[0-9]+)?$/
requires:
- publish-javadoc
- release-client-java
- release-integration-sql-java
11 changes: 0 additions & 11 deletions .circleci/workflows/openlineage-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,6 @@ workflows:
only: /^[0-9]+(\.[0-9]+){2}(-rc\.[0-9]+)?$/
requires:
- unit-tests-client-python
- publish-client-python-reference:
filters:
branches:
only: main
tags:
only: /^[0-9]+(\.[0-9]+){2}(-rc\.[0-9]+)?$/
context: release
requires:
- build-client-python
- unit-tests-client-python
- build-integration-dbt:
filters:
branches:
Expand All @@ -196,7 +186,6 @@ workflows:
- build-integration-common
- integration-test-integration-airflow-failure
- integration-test-integration-airflow
- publish-client-python-reference
- build-integration-dbt
- build-integration-dagster
- release-python:
Expand Down
98 changes: 98 additions & 0 deletions .github/workflows/website-snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Build & Deploy spec to Github Pages

on:
push:
branches:
- main
- docs-deploy # testing phase only

permissions:
id-token: write

jobs:
site-deploy:
name: Build and Publish To openlineage-site repo
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
path: 'source'
- uses: actions/checkout@v4
with:
repository: 'pawel-big-lebowski/openlineage-site'
path: 'target'
token: ${{ secrets.ACTIONS_GITHUB_TOKEN }}
- uses: actions/setup-node@v4
with:
node-version: 22
cache: "npm"
cache-dependency-path: source/website/package-lock.json
- uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: '17'
- uses: shogo82148/actions-setup-perl@v1
with:
perl-version: "5.38"
- uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Regenerate Javadoc to website
run: |
cd source/client/java
./gradlew javadoc
mkdir -p ../../website/static/apidocs/javadoc
cp -r build/docs/javadoc ../../website/static/apidocs
- name: Regenerate python documentation
run: |
cd source/client/python
pip install -U -e .[docs]
cd docs && make html && python convert.py
cp -r converted/* ../../../website/docs/development/developing/python/api-reference
- name: Install dependencies
run: |
cd source/website
yarn install --frozen-lockfile
- name: Generate openapi
run: |
SPEC_DIR="$(pwd)/source/website/static/spec"
APIDOC_DIR="$(pwd)/source/website/static/apidocs"
pushd $SPEC_DIR
LATEST_VERSION=$(find . -maxdepth 1 | grep -v 'facets' | grep '[0-9]*-[0-9]-[0-9]' | sort -Vr | head -1)
echo latest version is $LATEST_VERSION
rm -f ./OpenLineage.json 2>/dev/null
perl -i -pe"s/version: [[:alnum:]\.-]*/version: ${LATEST_VERSION:2}/g" ./OpenLineage.yml
echo Versions updated
mkdir "${LATEST_VERSION}/facets"
for i in $(ls -d ./facets/* | sort); do cp $i/*.json ${LATEST_VERSION}/facets; done;
echo "LATEST_VERSION=${LATEST_VERSION}" >> "$GITHUB_ENV"
pushd $LATEST_VERSION
ln -sf ../OpenLineage.yml .
popd
- name: Generate redoc
run: |
npm install @redocly/cli
npx redocly build-docs -o source/website/static/apidocs/openapi/index.html source/website/static/spec/$LATEST_VERSION/OpenLineage.yml --title "OpenLineage API Docs"
- name: Clean temp files
run: |
pushd source/website/static/spec/$LATEST_VERSION
rm -rf facets
rm OpenLineage.yml
popd
- name: Push target repo
run: |
rm -r target/*
cp -r source/website/* target
cd target
git config user.name "GitHub Action Website Snapshot"
git config user.email "<>"
git add .
if ! git diff-index --quiet HEAD; then
git commit -m "Refreshing website content from main repo.
Source commit:
https://github.com/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA}"
git push
fi
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,8 @@ repos:
files: ^client/java/src/.*\.java$
exclude: ".*test.*"
require_serial: true
- id: spec-changes
name: Verify spec changes committed to website
language: script
files: ^spec/
entry: .pre_commit/run-spec-snapshot.sh
45 changes: 45 additions & 0 deletions .pre_commit/run-spec-snapshot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

# Copy changed spec JSON files to website static folder
# This is necessary to keep within repo history of all the spec versions
# Initialize CHANGE_DONE to 0 (no changes detected by default)
CHANGE_DONE=0

# Use process substitution to avoid subshell problem
while read -r LINE; do
# Ignore registry files
if [[ $LINE =~ "registry.json" ]]; then
continue
fi

# Extract target file name from $id field in spec files using jq
URL=$(cat "$LINE" | jq -r '.["$id"]')

# Extract target location in website repo
LOC="website/static/${URL#*//*/}"
LOC_DIR="${LOC%/*}"

# Create dir if necessary, and copy files
mkdir -p "$LOC_DIR"
cp "$LINE" "$LOC"
echo $LOC
# Check if the file is tracked by Git
if git ls-files --error-unmatch "$LOC" &>/dev/null; then
# The file is tracked by Git
# Check if the copied file differs from the committed version and is not staged
if ! git diff --quiet HEAD -- "$LOC"; then
# Check if the differences are not already staged
if git diff --quiet --cached -- "$LOC"; then
echo "Change detected in $LINE: $LOC differs from committed version but is not staged"
CHANGE_DONE=1 # Mark as change detected
fi
fi
else
# The file is untracked by Git
echo "Change detected in $LINE: $LOC is untracked"
CHANGE_DONE=1 # Mark as change detected
fi
done < <(git diff --name-only HEAD -- 'spec/*.json' 'spec/OpenLineage.yml')

# Exit with the value of CHANGE_DONE (0 if no changes, 1 if there were changes)
exit $CHANGE_DONE
46 changes: 0 additions & 46 deletions client/java/release-javadoc.sh

This file was deleted.

48 changes: 0 additions & 48 deletions client/python/docs/release-api-reference.sh

This file was deleted.

Loading

0 comments on commit 0bcdf5f

Please sign in to comment.