Skip to content

Commit

Permalink
Merge pull request #18 from fuhrmanator/M11-migration
Browse files Browse the repository at this point in the history
M11 migration
  • Loading branch information
fuhrmanator committed Jul 30, 2024
2 parents 4e8b94b + db9eb5f commit 6df4981
Show file tree
Hide file tree
Showing 85 changed files with 3,162 additions and 566 deletions.
59 changes: 0 additions & 59 deletions .github/workflows/ci.yml

This file was deleted.

66 changes: 66 additions & 0 deletions .github/workflows/ci.yml-nope
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Name of the project in the GitHub action panel
name: Run-Tests-and-Generate-Model-Diagram

# Execute the CI on push or pull request on any branch
on:
push:
branches:
- '*' # Allow the workflow to trigger on any branch
pull_request:
branches:
- '*' # Allow the workflow to trigger on any branch
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
# List of images at https://github.com/hpi-swa/smalltalkCI#images
# Use Moose64-11 that includes our visualization tool
smalltalk: [ Moose64-11]
name: ${{ matrix.smalltalk }}
steps:
# Checkout the code from the branch that triggered the workflow
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.ref }} # Checkout the branch that triggered the workflow

# Prepare the CI - download the correct VM
- uses: hpi-swa/setup-smalltalkCI@v1
with:
smalltalk-image: ${{ matrix.smalltalk }}

# Run the tests
- run: smalltalkci -s ${{ matrix.smalltalk }}
shell: bash
timeout-minutes: 15

- name: Generate plantuml representation of meta-model
run: |
$SMALLTALK_CI_VM $SMALLTALK_CI_IMAGE eval "'FamixTypeScript-traits.puml' asFileReference writeStreamDo: [ :stream | stream nextPutAll: (FamixUMLDocumentor new model: FamixTypeScriptModel color: Color lightBlue ; beWithStubs ; generate; exportWith: (FamixUMLPlantUMLBackend new))]"
$SMALLTALK_CI_VM $SMALLTALK_CI_IMAGE eval "'FamixTypeScript.puml' asFileReference writeStreamDo: [ :stream | stream nextPutAll: (FamixUMLDocumentor new model: FamixTypeScriptModel color: Color lightBlue ; generate; exportWith: (FamixUMLPlantUMLBackend new))]"

- name: Generate SVG Diagram from PlantUML
uses: Timmy/plantuml-action@v1
with:
args: -v -tsvg FamixTypeScript-traits.puml FamixTypeScript.puml

- name: Move diagram to doc space
run: |
mkdir -p doc-uml
mv *.svg doc-uml
mv *.puml doc-uml

- name: Push docs to current branch
# do not try if it's a PR, since GitHub Actions checks out the code in a detached state
if: github.event_name == 'push'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add doc-uml
git commit -m "Update docs for branch ${{ github.ref_name }}"
git push origin HEAD:refs/heads/${{ github.ref_name }} # Push to the branch that triggered the workflow
62 changes: 62 additions & 0 deletions .github/workflows/common.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# .github/workflows/common.yml
name: Common Workflow

on:
workflow_call:
inputs:
run_docs:
description: 'Whether to run documentation steps'
required: true
type: boolean

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
# List of images at https://github.com/hpi-swa/smalltalkCI#images
# Use Moose64-11 that includes our visualization tool
smalltalk: [Moose64-11]
name: ${{ matrix.smalltalk }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.ref }} # Checkout the branch that triggered the workflow

# Prepare the CI - download the correct VM
- uses: hpi-swa/setup-smalltalkCI@v1
with:
smalltalk-image: ${{ matrix.smalltalk }}

# Run the tests
- run: smalltalkci -s ${{ matrix.smalltalk }}
shell: bash
timeout-minutes: 15

- name: Generate plantuml representation of meta-model
run: |
$SMALLTALK_CI_VM $SMALLTALK_CI_IMAGE eval "'FamixTypeScript-traits.puml' asFileReference writeStreamDo: [ :stream | stream nextPutAll: (FamixUMLDocumentor new model: FamixTypeScriptModel color: Color lightBlue ; beWithStubs ; generate; exportWith: (FamixUMLPlantUMLBackend new))]"
$SMALLTALK_CI_VM $SMALLTALK_CI_IMAGE eval "'FamixTypeScript.puml' asFileReference writeStreamDo: [ :stream | stream nextPutAll: (FamixUMLDocumentor new model: FamixTypeScriptModel color: Color lightBlue ; generate; exportWith: (FamixUMLPlantUMLBackend new))]"
- name: Generate SVG Diagram from PlantUML
uses: Timmy/plantuml-action@v1
with:
args: -v -tsvg FamixTypeScript-traits.puml FamixTypeScript.puml

- name: Move diagram to doc space
if: inputs.run_docs == 'true'
run: |
mkdir -p doc-uml
mv *.svg doc-uml
mv *.puml doc-uml
- name: Push docs to current branch
if: inputs.run_docs == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add doc-uml
git commit -m "Update docs for branch ${{ github.ref_name }}"
git push origin HEAD:refs/heads/${{ github.ref_name }} # Push to the branch that triggered the workflow
13 changes: 13 additions & 0 deletions .github/workflows/pr_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# .github/workflows/pr.yml
name: PR CI

on:
pull_request:
branches:
- '*' # Trigger on any branch pull request

jobs:
build:
uses: ./.github/workflows/common.yml
with:
run_docs: false
14 changes: 14 additions & 0 deletions .github/workflows/push_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# .github/workflows/ci.yml
name: CI for push on branch

on:
push:
branches:
- '*' # Trigger on any branch push
workflow_dispatch:

jobs:
build:
uses: ./.github/workflows/common.yml
with:
run_docs: true
4 changes: 2 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@

# FamixNG Metamodel for TypeScript.

[![Smalltalk CI](https://github.com/fuhrmanator/FamixTypeScript/actions/workflows/ci.yml/badge.svg)](https://github.com/fuhrmanator/FamixTypeScript/actions/workflows/ci.yml)
[![Smalltalk CI](https://github.com/fuhrmanator/FamixTypeScript/actions/workflows/ci.yml/badge.svg?branch=M11-migration)](https://github.com/fuhrmanator/FamixTypeScript/actions/workflows/ci.yml?query=branch:M11-migration)

This project is normally synchronized with [FamixTypeScriptImporter](https://github.com/fuhrmanator/FamixTypeScriptImporter) as it is the FamixNG metamodel it supports.

## Metamodel documentation (visualization)

The following was generated by CI.

![FamixTypeScript Metamodel](./doc-uml/FamixTypeScript.svg)
![FamixTypeScript Metamodel](./doc-uml/FamixTypeScript-traits.svg)

## Loading from a playground

Expand Down
Loading

0 comments on commit 6df4981

Please sign in to comment.