Skip to content

Commit

Permalink
added website with build action
Browse files Browse the repository at this point in the history
  • Loading branch information
wassfila committed Apr 21, 2024
1 parent a283a36 commit be48634
Show file tree
Hide file tree
Showing 22 changed files with 3,902 additions and 252 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Deploy to GitHub Pages

on:
# Trigger the workflow every time you push to the `main` branch
# Using a different branch name? Replace `main` with your branch’s name
push:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab on GitHub.
workflow_dispatch:

# Allow this job to clone the repo and create a page deployment
permissions:
contents: read
pages: write
id-token: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout your repository using git
uses: actions/checkout@v4
- name: Install, build, and upload your site
uses: withastro/action@v2
with:
# path: . # The root location of your Astro project inside the repository. (optional)
node-version: 20 # The specific version of Node that should be used to build your site. Defaults to 20. (optional)
package-manager: pnpm@latest # The Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. (optional)

deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
__pycache__
venv
/cache
/dist
18 changes: 0 additions & 18 deletions docs/dependencies.dot

This file was deleted.

109 changes: 0 additions & 109 deletions docs/dependencies.dot.svg

This file was deleted.

116 changes: 0 additions & 116 deletions docs/index.html

This file was deleted.

3 changes: 0 additions & 3 deletions docs/style.css

This file was deleted.

16 changes: 12 additions & 4 deletions graph_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ def graph_to_dot(graph):
dot_string = "digraph G {\n"
nodes_map = {}
for index,node in enumerate(graph["nodes"],1):
nodes_map[node] = int_to_alphabet(index)
nodes_map[node["label"]] = int_to_alphabet(index)
for node in graph["nodes"]:
dot_string += f' {nodes_map[node]} [label="{node}"];\n'
label = node["label"]
node_class = node["class"]
node_shape = shapes_map[node_class]
dot_string += f' {nodes_map[label]} [label="{label}", class="{node_class}", shape="{node_shape}"];\n'
for edge in graph["edges"]:
source = nodes_map[edge["source"]]
target = nodes_map[edge["target"]]
Expand All @@ -34,8 +37,8 @@ def add_edge(source,target):
if(target not in graph["nodes"]):
graph["nodes"].append(target)
graph["edges"].append({
"source":source,
"target":target
"source":source["label"],
"target":target["label"]
})
return

Expand All @@ -52,3 +55,8 @@ def get_graph():
"nodes":[],
"edges":[]
}

shapes_map = {
"job":"box",
"artifact":"ellipse"
}
2 changes: 2 additions & 0 deletions manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ pipeline:
compute-statistics: pipeline.py#compute
build:
generate-website: pipeline.py#build
website:
base: pipeline-visualization
4 changes: 2 additions & 2 deletions runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ def set_artifact(data,filepath,type="generic"):
abs_filepath = join("cache",filepath)
if(ext == ".json"):
utl.save_json(data,abs_filepath)
gutl.add_edge(state.job,id)
gutl.add_edge({"label":state.job,"class":"job"},{"label":id,"class":"artifact"})
return

def get_artifact(id):
if(id not in state.artifacts):
raise ArtifactError(f"Artifact with ID '{id}' does not exist")
artifact = state.artifacts[id]
gutl.add_edge(id,state.job)
gutl.add_edge({"label":id,"class":"artifact"},{"label":state.job,"class":"job"})
if(artifact["ext"] == ".json"):
return utl.load_json(join("cache",artifact["filepath"]))
return None
Expand Down
24 changes: 24 additions & 0 deletions website/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# build output
dist/

# generated types
.astro/

# dependencies
node_modules/

# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# environment variables
.env
.env.production

# macOS-specific files
.DS_Store

# jetbrains setting folder
.idea/
9 changes: 9 additions & 0 deletions website/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineConfig } from 'astro/config';
import {config} from './config.js'

// https://astro.build/config
export default defineConfig({
output: 'static',
outDir: config.outDir,
base: config.base
});
Loading

0 comments on commit be48634

Please sign in to comment.