Skip to content

Commit

Permalink
test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
jjenscodee committed Nov 12, 2023
1 parent 0d794cc commit ddd5d0d
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 90 deletions.
177 changes: 88 additions & 89 deletions .github/workflows/host-schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ jobs:
name: Check if the version has been updated
outputs:
has_changed: ${{ steps.check.outputs.has_changed }}
version: ${{ steps.versions.outputs.new_version }}
id: ${{ steps.versions.outputs.new_version }}
version: ${{ steps.versions.outputs.version_only }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -23,6 +24,8 @@ jobs:
run: |
NEW_VERSION=$(jq -r '.["$id"]' schemas/applications/schema/application.schema.json)
echo "new_version=${NEW_VERSION}" >> $GITHUB_OUTPUT
IFS='/' read -a id_array <<< "$NEW_VERSION"
echo "version_only=${id_array[1]}" >> $GITHUB_OUTPUT
git checkout HEAD^
PREV_VERSION=$( jq -r '.["$id"]' schemas/applications/schema/application.schema.json)
echo "prev_version=${PREV_VERSION}" >> $GITHUB_OUTPUT
Expand All @@ -36,92 +39,88 @@ jobs:
needs: check-version
name: Bundle & Host JSON schema
runs-on: ubuntu-latest
if: ${{ needs.check-version.outputs.has_changed == 'true' }}
steps:
- name: test
if: ${{ needs.check-version.outputs.has_changed == 'true' }}
run:
ls
# - uses: actions/checkout@v3
# # Build Docusaurus
# - name: Setup node in docs
# uses: actions/setup-node@v3
# with:
# node-version: "16"
# cache: "npm"
# cache-dependency-path: "docs/package-lock.json"
#
# - name: Cache docusaurus
# uses: actions/cache@v3
# with:
# path: |
# ${{ github.workspace }}/docs/.docusaurus
# key: |
# ${{ runner.os }}-docusaurus
# restore-keys: |
# ${{ runner.os }}-docusaurus
#
# - name: Install dependencies
# run: |
# npm ci --prefix docs
#
# - name: Lint / Formatting
# run: |
# npm run typecheck --prefix docs
# # TODO: should add more in the future if needed
#
# - name: Build
# run: |
# npm run build --prefix docs
#
# # Fetch API documentation
# - uses: aica-technology/.github/.github/actions/[email protected]
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
#
# - uses: aica-technology/.github/.github/actions/[email protected]
# id: ensure-image
# with:
# image_name: aica-technology/backend-api-docs
#
# - name: Get API version to fetch
# id: api-version
# run: |
# VER="$(cat docs/api.version)"
# echo "Version: $VER"
# echo "version=$VER" >> $GITHUB_OUTPUT
#
# - name: Create directory
# run: |
# mkdir -p docs/build/api
#
# - name: Extract Swagger from the built image
# uses: aica-technology/.github/.github/actions/[email protected]
# with:
# image: ${{ steps.ensure-image.outputs.image_name }}:${{ steps.api-version.outputs.version }}
# source: /index.html
# destination: docs/build/api/index.html
#
# # Bundle JSON schema
# - name: Setup node in utils
# uses: actions/setup-node@v3
# with:
# node-version: "16"
# cache: "npm"
# cache-dependency-path: "utils/package-lock.json"
# - name: Install dependencies
# run: |
# cd utils
# npm i
# pip3 install javascript
# - name: Bundle Schemas
# run: |
# python3 utils/bundle.py schemas/applications/schema/application.schema.json application.schema.json
# ls
# mkdir -p docs/build/schema/0-0-0
# mv application.schema.json docs/build/schema/0-0-0/application.schema.json
#
# - name: Deploy
# uses: peaceiris/actions-gh-pages@v3
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# publish_dir: docs/build
- uses: actions/checkout@v3
# Build Docusaurus
- name: Setup node in docs
uses: actions/setup-node@v3
with:
node-version: "16"
cache: "npm"
cache-dependency-path: "docs/package-lock.json"

- name: Cache docusaurus
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/docs/.docusaurus
key: |
${{ runner.os }}-docusaurus
restore-keys: |
${{ runner.os }}-docusaurus
- name: Install dependencies
run: |
npm ci --prefix docs
- name: Lint / Formatting
run: |
npm run typecheck --prefix docs
# TODO: should add more in the future if needed
- name: Build
run: |
npm run build --prefix docs
# Fetch API documentation
- uses: aica-technology/.github/.github/actions/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}

- uses: aica-technology/.github/.github/actions/[email protected]
id: ensure-image
with:
image_name: aica-technology/backend-api-docs

- name: Get API version to fetch
id: api-version
run: |
VER="$(cat docs/api.version)"
echo "Version: $VER"
echo "version=$VER" >> $GITHUB_OUTPUT
- name: Create directory
run: |
mkdir -p docs/build/api
- name: Extract Swagger from the built image
uses: aica-technology/.github/.github/actions/[email protected]
with:
image: ${{ steps.ensure-image.outputs.image_name }}:${{ steps.api-version.outputs.version }}
source: /index.html
destination: docs/build/api/index.html

# Bundle JSON schema
- name: Setup node in utils
uses: actions/setup-node@v3
with:
node-version: "16"
cache: "npm"
cache-dependency-path: "utils/package-lock.json"
- name: Install dependencies
run: |
cd utils
npm i
pip3 install javascript
- name: Bundle Schemas
run: |
python3 utils/bundle.py schemas/applications/schema/application.schema.json application.schema.json
mkdir -p docs/build/schema/${{ steps.versions.outputs.version }}
mv application.schema.json docs/build/schema${{ steps.versions.outputs.id }}
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/build
2 changes: 1 addition & 1 deletion schemas/applications/schema/application.schema.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$id": "/2-0-0/application.schema.json",
"$id": "/0-0-1/application.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "YAML Application Description",
"description": "An AICA application graph description using YAML syntax.",
Expand Down

0 comments on commit ddd5d0d

Please sign in to comment.