-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from zgornel/cc-kheops-integration
Kheops integration
- Loading branch information
Showing
4 changed files
with
204 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: Kheops-compiled PULL REQUEST run | ||
env: | ||
REPOSITORY_DIR: "./${{ github.event.repository.name }}" # inside runner | ||
WORKSPACE_DIR: "/workspace" # inside Kheops-compiled container | ||
PROJECT_DIR: "/workspace/src" # inside Kheops-compiled container | ||
CONFIG_PATH: "/workspace/.kheops/input-configuration.json" | ||
INPUT_PARSER: julia | ||
LOG_LEVEL: error | ||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
jobs: | ||
build: | ||
name: Kheops-compiled Docker ${{ github.event_name }} | ||
#runs-on: [self-hosted] | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
arch: | ||
- x64 | ||
steps: | ||
- name: Checkout current project repository | ||
uses: actions/checkout@v3 | ||
with: | ||
path: ${{ env.REPOSITORY_DIR }} | ||
- name: Comment PR | ||
uses: thollander/actions-comment-pull-request@v2 | ||
with: | ||
message: 'Testing architecture ...' | ||
comment_tag: kheops_status_tag | ||
- id: pull_docker_image | ||
name: Pull Kheops-compiled container image | ||
run: | | ||
docker pull ghcr.io/oxoaresearch/kheops-compiled:latest | ||
- id: run_docker_image | ||
name: Run Kheops-compiled | ||
run: | | ||
echo 'DATA_DUMP<<EOF' >> $GITHUB_OUTPUT | ||
echo '```' >> $GITHUB_OUTPUT | ||
docker run --volume=${{ env.REPOSITORY_DIR }}:${{ env.WORKSPACE_DIR }} \ | ||
ghcr.io/oxoaresearch/kheops-compiled:latest kheopscli/bin/kheopscli \ | ||
--project-dir ${{ env.PROJECT_DIR }} \ | ||
--config-path ${{ env.CONFIG_PATH }} \ | ||
--input-parser ${{ env.INPUT_PARSER }} \ | ||
--output-type text \ | ||
--log-level ${{ env.LOG_LEVEL }}>> $GITHUB_OUTPUT | ||
echo '```' >> $GITHUB_OUTPUT | ||
echo '```mermaid' >> $GITHUB_OUTPUT | ||
docker run --volume=${{ env.REPOSITORY_DIR }}:${{ env.WORKSPACE_DIR }} \ | ||
ghcr.io/oxoaresearch/kheops-compiled:latest kheopscli/bin/kheopscli \ | ||
--project-dir ${{ env.PROJECT_DIR }} \ | ||
--config-path ${{ env.CONFIG_PATH }} \ | ||
--input-parser ${{ env.INPUT_PARSER }} \ | ||
--output-type diagram \ | ||
--diagram-type file \ | ||
--diagram-backend mermaid \ | ||
--log-level ${{ env.LOG_LEVEL }} >> $GITHUB_OUTPUT | ||
echo '```' >> $GITHUB_OUTPUT | ||
echo 'EOF' >> $GITHUB_OUTPUT | ||
- name: Edit PR comment | ||
uses: thollander/actions-comment-pull-request@v2 | ||
with: | ||
message: ${{steps.run_docker_image.outputs.DATA_DUMP}} | ||
comment_tag: kheops_status_tag |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Kheops-compiled PUSH run | ||
env: | ||
REPOSITORY_DIR: "./${{ github.event.repository.name }}" # inside runner | ||
WORKSPACE_DIR: "/workspace" # inside Kheops-compiled container | ||
PROJECT_DIR: "/workspace/src" # inside Kheops-compiled container | ||
CONFIG_PATH: "/workspace/.kheops/input-configuration.json" | ||
INPUT_PARSER: julia | ||
LOG_LEVEL: error | ||
on: | ||
push: | ||
branches: | ||
- master | ||
tags: '*' | ||
jobs: | ||
build: | ||
name: Kheops-compiled Docker ${{ github.event_name }} | ||
#runs-on: [self-hosted] | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
arch: | ||
- x64 | ||
steps: | ||
- name: Checkout current project repository | ||
uses: actions/checkout@v3 | ||
with: | ||
path: ${{ env.REPOSITORY_DIR }} | ||
- id: pull_docker_image | ||
name: Pull Kheops-compiled container image | ||
run: | | ||
docker pull ghcr.io/oxoaresearch/kheops-compiled:latest | ||
- id: run_docker_image | ||
name: Run Kheops-compiled | ||
run: | | ||
docker run --volume=${{ env.REPOSITORY_DIR }}:${{ env.WORKSPACE_DIR }} \ | ||
ghcr.io/oxoaresearch/kheops-compiled:latest kheopscli/bin/kheopscli \ | ||
--project-dir ${{ env.PROJECT_DIR }} \ | ||
--config-path ${{ env.CONFIG_PATH }} \ | ||
--input-parser ${{ env.INPUT_PARSER }} \ | ||
--output-type text \ | ||
--log-level ${{ env.LOG_LEVEL }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# For more documentation, on GitLab CI/CD YAML syntax check: | ||
# https://docs.gitlab.com/ee/ci/yaml/ | ||
# | ||
|
||
#image: ghcr.io/oxoaresearch/kheops-compiled:latest | ||
|
||
variables: | ||
REPOSITORY_DIR: "./$CI_PROJECT_DIR" # inside runner | ||
WORKSPACE_DIR: "/tmp" # inside Kheops-compiled container | ||
PROJECT_DIR: "/tmp/src" # inside Kheops-compiled container | ||
CONFIG_PATH: "/tmp/.kheops/input-configuration.json" # inside Kheops-compiled container | ||
OUTPUT_TYPE: "text" | ||
LOG_LEVEL: "debug" | ||
|
||
stages: | ||
- run_kheops_push | ||
- run_kheops_mr | ||
- post_output_mr | ||
|
||
push_job: | ||
stage: run_kheops_push | ||
script: # sample test run | ||
- docker run --volume=./:/tmp ghcr.io/oxoaresearch/kheops-compiled:latest /kheopscli/bin/kheopscli --project-dir /tmp/src --config-path /tmp/.kheops/input-configuration.json --input-parser Julia --output-type text --log-level debug | ||
rules: | ||
- if: $CI_PIPELINE_SOURCE == "push" | ||
|
||
merge_request_job: | ||
stage: run_kheops_mr | ||
artifacts: | ||
paths: | ||
- kheops_output.txt | ||
- kheops_output.plantuml | ||
script: | ||
- docker run --volume=./:/tmp ghcr.io/oxoaresearch/kheops-compiled:latest /kheopscli/bin/kheopscli --project-dir /tmp/src --config-path /tmp/.kheops/input-configuration.json --input-parser Julia --output-type text --log-level error > ./kheops_output.txt | ||
- docker run --volume=./:/tmp ghcr.io/oxoaresearch/kheops-compiled:latest /kheopscli/bin/kheopscli --project-dir /tmp/src --config-path /tmp/.kheops/input-configuration.json --input-parser Julia --output-type diagram --diagram-backend plantuml --log-level error > ./kheops_output.plantuml | ||
rules: | ||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"' | ||
|
||
post_message_to_merge_request: | ||
stage: post_output_mr | ||
rules: | ||
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH | ||
when: never | ||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"' | ||
when: on_success | ||
dependencies: | ||
- merge_request_job | ||
script: | ||
- tree -L 1 ./ | ||
- export GITLAB_TOKEN=glpat-3YKjQp-kcHsHxJW4t_SJ | ||
#TODO: Fix to actually post the contents of kheops_output.txt and kheops_output.plantuml | ||
- 'curl --request POST "https://gitlab.ai.vub.ac.be/api/v4/projects/$CI_MERGE_REQUEST_PROJECT_ID/merge_requests/$CI_MERGE_REQUEST_IID/notes" --header "PRIVATE-TOKEN: $GITLAB_TOKEN" --header "Content-Type: application/json" --data-raw "{ \"body\": \"$(cat kheops_output.txt)\" }"' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"Rules": [ | ||
{ "from": "KNOWLEDGE_BASE", "to": "CONTROL_FLOW"}, | ||
{ "from": "KNOWLEDGE_BASE", "to": "KNOWLEDGE_BASE"}, | ||
{ "from": "KNOWLEDGE_BASE", "to": "PROGRAM_EXECUTION"}, | ||
{ "from": "PROGRAM_EXECUTION", "to": "CONTROL_FLOW"}, | ||
{ "from": "PROGRAM_EXECUTION", "to": "PROGRAM_EXECUTION"}, | ||
{ "from": "CONTROL_FLOW", "to": "CONTROL_FLOW"} | ||
], | ||
"Components": [ | ||
{ | ||
"name": "PROGRAM_EXECUTION", | ||
"sources": [ | ||
{ | ||
"type": "File", | ||
"value": "src/program.jl" | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "CONTROL_FLOW", | ||
"sources": [ | ||
{ | ||
"type": "FileList", | ||
"value": ["src/automaton.jl", "src/transition.jl"] | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "KNOWLEDGE_BASE", | ||
"sources": [ | ||
{ | ||
"type": "FileList", | ||
"value": ["src/kb.jl", "src/sat.jl", "src/utils.jl"] | ||
} | ||
] | ||
} | ||
] | ||
} |