Skip to content

Commit

Permalink
Merge pull request #9 from theiconic/master
Browse files Browse the repository at this point in the history
Merge changes from theiconic/generate-plantuml-action
  • Loading branch information
grassedge authored Aug 7, 2020
2 parents fed75f8 + 4066a73 commit da54916
Show file tree
Hide file tree
Showing 14 changed files with 7,258 additions and 2,845 deletions.
21 changes: 0 additions & 21 deletions .github/workflows/main.yml

This file was deleted.

19 changes: 19 additions & 0 deletions .github/workflows/plantuml.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: generate plantuml
on:
push:
branches:
- master
jobs:
generate_plantuml:
runs-on: ubuntu-latest
name: plantuml
steps:
- name: checkout
uses: actions/checkout@v2
- name: plantuml
id: plantuml
uses: grassedge/generate-plantuml-action@master
with:
path: example
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33 changes: 33 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: tests
on: push
jobs:
tests:
runs-on: ubuntu-latest
name: tests
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
steps:
- name: checkout
uses: actions/checkout@v2
- name: install node
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: install depedencies
run: npm install
- name: run tests
run: "npm run test:ci"
env:
CI: true
- name: report test results
uses: IgnusG/[email protected]
if: always()
with:
access-token: ${{ secrets.GITHUB_TOKEN }}
check-name: Unit Tests
- name: CodeClimate coverage report
uses: aktions/codeclimate-test-reporter@v1
if: ${{ env.CC_TEST_REPORTER_ID != '' }}
with:
codeclimate-test-reporter-id: ${{ secrets.CC_TEST_REPORTER_ID }}
command: after-build
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,7 @@ typings/
# TernJS port file
.tern-port

/lib
# IDE files
.idea

/lib
32 changes: 29 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[![Maintainability](https://api.codeclimate.com/v1/badges/a21c7671c0a7ae182c28/maintainability)](https://codeclimate.com/github/theiconic/generate-plantuml-action/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/a21c7671c0a7ae182c28/test_coverage)](https://codeclimate.com/github/theiconic/generate-plantuml-action/test_coverage)
[![Actions Status](https://github.com/theiconic/generate-plantuml-action/workflows/tests/badge.svg)](https://github.com/theiconic/generate-plantuml-action/actions)

# generate-plantuml-action

Generate uml diagrams with Plantuml Server and push them to your repository.
Expand All @@ -6,8 +10,25 @@ This action ease you to maintain UML.
UML is very useful, but there are some difficulties to maintain.
[PlantUML](https://plantuml.com/) enables you to write UML with text code, that is engineer-friendly so you would like it.

This actions generate UML diagrams from plantuml code
with [PlantUML Server](https://plantuml.com/en/server) when you commit plantUML files
or Markdown files that plantuml code is written in.

PlantUML files must end in either of
- `.pu`
- `.pml`
- `.puml`
- `.plantuml`

This actions generate UML diagrams from plantuml code with [PlantUML Server](https://plantuml.com/en/server) when you commit `.pu` file or `.md` file that plantuml code is written on.
Markdown files must end in
- `.md`
- `.markdown`
- `.mdown`
- `.mkdn`
- `.mdwn`
- `.mkd`
- `.mdn`
- `.md.txt`

## Usage

Expand All @@ -27,16 +48,21 @@ jobs:
fetch-depth: 1
- name: plantuml
id: plantuml
uses: grassedge/generate-plantuml-action@v1.1
uses: grassedge/generate-plantuml-action@v1.3
with:
path: example
message: "Render PlantUML files"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```

*input*

- `path` : *required* specify the path to save generated svg files.
- `path` : *required* specify the path to save generated svg files -
specify `.` to save each SVG file in the same folder as the source
file it was generated from
- `message` : specify the commit message for the commit of generated
svg files (defaults to `Render PlantUML files`)

*env*

Expand Down
4 changes: 4 additions & 0 deletions __tests__/assets/test5.pml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@startuml
A -> B: test5
B -> C: test5
@enduml
4 changes: 4 additions & 0 deletions __tests__/assets/test6.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@startuml
A -> B: test6
B -> C: test6
@enduml
4 changes: 4 additions & 0 deletions __tests__/assets/test7.plantuml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@startuml
A -> B: test7
B -> C: test7
@enduml
54 changes: 49 additions & 5 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,71 @@ test('retrieveCodes', async() => {
const codes = await retrieveCodes([
'__tests__/assets/test1.md',
'__tests__/assets/test3.pu',
'__tests__/assets/test5.pml',
'__tests__/assets/test6.puml',
'__tests__/assets/test7.plantuml',
]);
await expect(codes).toEqual([
{
name: 'test-1',
code: `@startuml
A -> B: test1
@enduml
`
`,
dir: '__tests__/assets'
},
{
name: 'test_2',
code: `@startuml
A -> B: test2
@enduml
`
`,
dir: '__tests__/assets'
},
{
name: 'test.4',
code: `@startgantt
[Prototype design] lasts 15 days
[Test prototype] lasts 10 days
@endgantt
`
`,
dir: '__tests__/assets'
},
{
name: 'test3',
code: `@startuml
A -> B: test3
B -> C: test3
@enduml
`
`,
dir: '__tests__/assets'
},
{
name: 'test5',
code: `@startuml
A -> B: test5
B -> C: test5
@enduml
`,
dir: '__tests__/assets'
},
{
name: 'test6',
code: `@startuml
A -> B: test6
B -> C: test6
@enduml
`,
dir: '__tests__/assets'
},
{
name: 'test7',
code: `@startuml
A -> B: test7
B -> C: test7
@enduml
`,
dir: '__tests__/assets'
}
]);
});
Expand Down Expand Up @@ -80,16 +114,26 @@ test('updatedFiles', async() => {
{
"files": [
{
"status": "added",
"filename": "file1.txt",
},
{
"status": "modified",
"filename": "file2.txt",
},
{
"status": "removed",
"filename": "file3.txt",
},
{
"status": "renamed",
"filename": "file4.txt",
},
],
"sha": "b",
}
]);
await expect(files).toEqual([ 'file1.txt', 'file2.txt' ]);
await expect(files).toEqual([ 'file1.txt', 'file2.txt', 'file4.txt' ]);
});

const octokitMock = {
Expand Down
Loading

0 comments on commit da54916

Please sign in to comment.